CarryTable.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2014-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package RobotSkillTemplates::CarryTableGroup
19 * @author [Author Name] ( [Author Email] )
20 * @date 2014
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#include "CarryTable.h"
26
27#include <RobotAPI/interface/components/ViewSelectionInterface.h>
29
30using namespace armarx;
31using namespace CoupledInteractionGroup;
32
33// DO NOT EDIT NEXT LINE
34CarryTable::SubClassRegistry CarryTable::Registry(CarryTable::GetName(),
36
38 XMLStateTemplate<CarryTable>(stateData), CarryTableGeneratedBase<CarryTable>(stateData)
39{
40}
41
43CarryTable::getChannelRef(std::string objectName)
44{
45
47 getContext<CoupledInteractionGroupStatechartContext>();
48 ChannelRefBasePtr memoryChannel =
49 context->getObjectMemoryObserverProxy()->requestObjectClassRepeated(
50 objectName, 250, armarx::DEFAULT_VIEWTARGET_PRIORITY);
51
52
53 if (memoryChannel)
54 {
55 memoryChannel->validate();
56 return ChannelRefPtr::dynamicCast(memoryChannel);
57 }
58 else
59 {
60 return nullptr;
61 }
62}
63
64void
66{
67 std::string leftHandNameInMemory = in.getLeftHandNameInMemory();
68 local.setLeftHandMemoryChannelRef(getChannelRef(leftHandNameInMemory));
69 ARMARX_CHECK_EXPRESSION(local.getLeftHandMemoryChannelRef());
70
71 std::string rightHandNameInMemory = in.getRightHandNameInMemory();
72 local.setRightHandMemoryChannelRef(getChannelRef(rightHandNameInMemory));
73 ARMARX_CHECK_EXPRESSION(local.getRightHandMemoryChannelRef());
75 getContext<CoupledInteractionGroupStatechartContext>();
76 armarx::ChannelRefPtr poseRef =
77 context->getChannelRef(context->getPlatformUnitObserverName(), "platformPose");
78 Eigen::Vector3f tableStartPose;
79 tableStartPose(0) = poseRef->getDataField("positionX")->getFloat();
80 tableStartPose(1) = poseRef->getDataField("positionY")->getFloat();
81 tableStartPose(2) = poseRef->getDataField("rotation")->getFloat();
82
83 Eigen::Vector3f tableTargetPose = in.getTableTargetPose_2()->toEigen();
84 local.setTablePose(FramedDirection(tableStartPose, "Global", "Armar3"));
85 local.setTableTargetPose(FramedDirection(tableTargetPose, "Global", "Armar3"));
86}
87
88void
90{
91
92 // put your user code for the exit point here
93 // execution time should be short (<100ms)
94}
95
96// DO NOT EDIT NEXT FUNCTION
97std::string
99{
100 return "CarryTable";
101}
102
103// DO NOT EDIT NEXT FUNCTION
ChannelRefPtr getChannelRef(std::string objectName)
CarryTable(XMLStateConstructorParams stateData)
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
FramedDirection is a 3 dimensional direction vector with a reference frame.
Definition FramedPose.h:87
ChannelRefPtr getChannelRef(const std::string &observerName, const std::string &channelName) override
Class for legacy to stay compatible with old statecharts.
Definition XMLState.h:147
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< ChannelRef > ChannelRefPtr
Definition ChannelRef.h:40
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition XMLState.h:64