LiftTable.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::LiftTableGroup
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 "LiftTable.h"
26
28
31
32using namespace armarx;
33using namespace CoupledInteractionGroup;
34
35// DO NOT EDIT NEXT LINE
37
39 XMLStateTemplate<LiftTable>(stateData), LiftTableGeneratedBase<LiftTable>(stateData)
40{
41}
42
43void
45{
47 getContext<CoupledInteractionGroupStatechartContext>();
48 context->getTCPControlUnit()->request();
49 Eigen::Matrix4f leftTcpPoseBase =
50 context->getRobot()->getRobotNode(in.getLeftHandName())->getPoseInRootFrame();
51 Eigen::Matrix4f rightTcpPoseBase =
52 context->getRobot()->getRobotNode(in.getRightHandName())->getPoseInRootFrame();
53 ARMARX_INFO << "LeftHandName in Liftable " << in.getLeftHandName();
54 ARMARX_INFO << "RightHandName in Liftable " << in.getRightHandName();
55 ARMARX_INFO << "Lift Offset " << in.getLiftOffset();
56 FramedPose leftTcpPose =
57 FramedPose(leftTcpPoseBase, std::string("Armar3"), std::string("Armar3_Base"));
58 FramedPose rightTcpPose =
59 FramedPose(rightTcpPoseBase, std::string("Armar3"), std::string("Armar3_Base"));
60 local.setInitialLeftTcpPose(leftTcpPose);
61 local.setInitialRightTcpPose(rightTcpPose);
62}
63
64void
66{
67 // put your user code for the execution-phase here
68 // runs in seperate thread, thus can do complex operations
69 // should check constantly whether isRunningTaskStopped() returns true
70}
71
72void
74{
75 // put your user code for the breaking point here
76 // execution time should be short (<100ms)
77}
78
79void
81{
82
83 // put your user code for the exit point here
84 // execution time should be short (<100ms)
86 getContext<CoupledInteractionGroupStatechartContext>();
87 context->getTCPControlUnit()->release();
88
89 // we attach table to left hand
90 // this code should go to a dedicated state, since it is also executed on falure!
91
92 // set motion model AttachedToOtherObject
93 //if (in.isObjectInstanceChannelSet())
94 {
95 // todo: get objetc name
96 std::string objName =
97 "lighttable"; //in.getObjectInstanceChannel()->getDataField("className")->getString();
98 ARMARX_VERBOSE << "Attch to hand... Object Name:" << objName << ", hand name:"
99 << in.getLeftHandMemoryChannel()->getDataField("className")->getString();
100 auto handInstances = context->getObjectMemoryObserverProxy()->getObjectInstancesByClass(
101 in.getLeftHandMemoryChannel()->getDataField("className")->getString());
102
103 ARMARX_CHECK_EXPRESSION(handInstances.size() != 0);
104 ChannelRefBasePtr handChannel = handInstances.front();
105
108 ChannelRefPtr::dynamicCast(handChannel));
109 memoryx::ObjectInstancePtr object = memoryx::ObjectInstancePtr::dynamicCast(
110 context->getWorkingMemoryProxy()->getObjectInstancesSegment()->getEntityByName(
111 objName));
112
113 context->getWorkingMemoryProxy()->getObjectInstancesSegment()->setNewMotionModel(
114 object->getId(), newMotionModel);
116 << "Attached " << objName << " to "
117 << ChannelRefPtr::dynamicCast(handChannel)->getDataField("className")->getString();
118 }
119}
120
121// DO NOT EDIT NEXT FUNCTION
122std::string
124{
125 return "LiftTable";
126}
127
128// DO NOT EDIT NEXT FUNCTION
LiftTable(XMLStateConstructorParams stateData)
Definition LiftTable.cpp:38
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
The FramedPose class.
Definition FramedPose.h:281
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...
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
Definition Logging.h:190
#define ARMARX_VERBOSE
The logging level for verbose information.
Definition Logging.h:187
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition XMLState.h:64
IceInternal::Handle< MotionModelAttachedToOtherObject > MotionModelAttachedToOtherObjectPtr
IceInternal::Handle< ObjectInstance > ObjectInstancePtr