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"
27 
28 
29 #include <RobotAPI/interface/components/ViewSelectionInterface.h>
30 
31 using namespace armarx;
32 using namespace CoupledInteractionGroup;
33 
34 // DO NOT EDIT NEXT LINE
36 
37 
38 
40  XMLStateTemplate < CarryTable > (stateData), CarryTableGeneratedBase < CarryTable > (stateData)
41 {
42 }
43 
45 {
46 
47  CoupledInteractionGroupStatechartContext* context = getContext<CoupledInteractionGroupStatechartContext>();
48  ChannelRefBasePtr memoryChannel = context->getObjectMemoryObserverProxy()->requestObjectClassRepeated(objectName, 250, armarx::DEFAULT_VIEWTARGET_PRIORITY);
49 
50 
51  if (memoryChannel)
52  {
53  memoryChannel->validate();
54  return ChannelRefPtr::dynamicCast(memoryChannel);
55  }
56  else
57  {
58  return nullptr;
59  }
60 }
61 
63 {
64  std::string leftHandNameInMemory = in.getLeftHandNameInMemory();
65  local.setLeftHandMemoryChannelRef(getChannelRef(leftHandNameInMemory));
66  ARMARX_CHECK_EXPRESSION(local.getLeftHandMemoryChannelRef());
67 
68  std::string rightHandNameInMemory = in.getRightHandNameInMemory();
69  local.setRightHandMemoryChannelRef(getChannelRef(rightHandNameInMemory));
70  ARMARX_CHECK_EXPRESSION(local.getRightHandMemoryChannelRef());
71  CoupledInteractionGroupStatechartContext* context = getContext<CoupledInteractionGroupStatechartContext>();
72  armarx::ChannelRefPtr poseRef = context->getChannelRef(context->getPlatformUnitObserverName(), "platformPose");
73  Eigen::Vector3f tableStartPose;
74  tableStartPose(0) = poseRef->getDataField("positionX")->getFloat();
75  tableStartPose(1) = poseRef->getDataField("positionY")->getFloat();
76  tableStartPose(2) = poseRef->getDataField("rotation")->getFloat();
77 
78  Eigen::Vector3f tableTargetPose = in.getTableTargetPose_2()->toEigen();
79  local.setTablePose(FramedDirection(tableStartPose, "Global", "Armar3"));
80  local.setTableTargetPose(FramedDirection(tableTargetPose, "Global", "Armar3"));
81 
82 }
83 
84 
85 
87 {
88 
89  // put your user code for the exit point here
90  // execution time should be short (<100ms)
91 
92 }
93 
94 // DO NOT EDIT NEXT FUNCTION
95 std::string CarryTable::GetName()
96 {
97  return "CarryTable";
98 }
99 
100 // DO NOT EDIT NEXT FUNCTION
102 {
103  return XMLStateFactoryBasePtr(new CarryTable(stateData));
104 }
105 
armarx::CoupledInteractionGroup::CoupledInteractionGroupStatechartContext::getObjectMemoryObserverProxy
memoryx::ObjectMemoryObserverInterfacePrx getObjectMemoryObserverProxy()
Definition: CoupledInteractionGroupStatechartContext.h:129
RemoteRobot.h
armarx::CoupledInteractionGroup::CarryTable::CreateInstance
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Definition: CarryTable.cpp:101
armarx::CoupledInteractionGroup::CarryTable
Definition: CarryTable.h:33
armarx::XMLStateConstructorParams
Definition: XMLState.h:50
armarx::CoupledInteractionGroup::CarryTable::getChannelRef
ChannelRefPtr getChannelRef(std::string objectName)
Definition: CarryTable.cpp:44
armarx::CoupledInteractionGroup::CarryTable::CarryTable
CarryTable(XMLStateConstructorParams stateData)
Definition: CarryTable.cpp:39
armarx::StatechartContext::getChannelRef
ChannelRefPtr getChannelRef(const std::string &observerName, const std::string &channelName) override
Definition: StatechartContext.cpp:142
armarx::CoupledInteractionGroup::CarryTable::Registry
static SubClassRegistry Registry
Definition: CarryTable.h:48
IceInternal::Handle< ChannelRef >
armarx::CoupledInteractionGroup::CarryTable::onExit
void onExit() override
Definition: CarryTable.cpp:86
armarx::CoupledInteractionGroup::CoupledInteractionGroupStatechartContext::getPlatformUnitObserverName
std::string getPlatformUnitObserverName()
Definition: CoupledInteractionGroupStatechartContext.h:152
armarx::XMLStateTemplate
Class for legacy to stay compatible with old statecharts.
Definition: XMLState.h:137
armarx::CoupledInteractionGroup::CarryTable::GetName
static std::string GetName()
Definition: CarryTable.cpp:95
armarx::XMLStateFactoryBasePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
Definition: XMLState.h:65
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
armarx::VariantType::FramedDirection
const VariantTypeId FramedDirection
Definition: FramedPose.h:38
armarx::CoupledInteractionGroup::CoupledInteractionGroupStatechartContext
Definition: CoupledInteractionGroupStatechartContext.h:88
CarryTable.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::CoupledInteractionGroup::CarryTable::onEnter
void onEnter() override
Definition: CarryTable.cpp:62