PickAndPlaceGroupStatechartContext.h
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::PickAndPlaceGroup
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 
26 #pragma once
27 
31 
32 
33 // Custom Includes
34 #include <RobotAPI/interface/core/RobotState.h>
35 #include <RobotAPI/interface/observers/KinematicUnitObserverInterface.h>
36 #include <RobotAPI/interface/units/ForceTorqueUnit.h>
37 #include <RobotAPI/interface/units/HeadIKUnit.h>
38 #include <RobotAPI/interface/units/KinematicUnitInterface.h>
39 #include <RobotAPI/interface/units/TCPControlUnit.h>
40 
41 #include <MemoryX/interface/components/PriorKnowledgeInterface.h>
42 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
43 #include <MemoryX/interface/observers/ObjectMemoryObserverInterface.h>
44 //#include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
45 #include <VirtualRobot/VirtualRobot.h>
46 
48 {
49 
51  {
54  {
55  defineOptionalProperty<std::string>("KinematicUnitName",
56  "Name of the kinematic unit that should be used");
57  defineOptionalProperty<std::string>(
58  "KinematicUnitObserverName",
59  "Name of the kinematic unit observer that should be used");
60  defineOptionalProperty<std::string>(
61  "RobotStateComponentName",
62  "RobotStateComponent",
63  "Name of the robot state component that should be used");
64  defineOptionalProperty<std::string>(
65  "TCPControlUnitName",
66  "TCPControlUnit",
67  "Name of the tcp control unit component that should be used");
68  //defineOptionalProperty<std::string>("TCPControlUnitObserverName", "TCPControlUnitObserver", "Name of the tcp control unit observer that should be used");
69  //defineOptionalProperty<std::string>("ForceTorqueUnitName", "ForceTorqueUnit", "Name of the force torque unit component that should be used");
70  defineOptionalProperty<std::string>(
71  "ForceTorqueObserverName",
72  "ForceTorqueObserver",
73  "Name of the force torque observer that should be used");
74  //defineOptionalProperty<std::string>("SimulatorName", "Simulator", "Name of the simulator component that should be used");
75  defineOptionalProperty<std::string>(
76  "HeadIKUnitName", "HeadIKUnit", "Name of the head unit that should be used.");
77  defineOptionalProperty<std::string>(
78  "HeadIKKinematicChainName",
79  "",
80  "Name of the inematic chain that should be used for head IK.");
81  defineOptionalProperty<std::string>(
82  "WorkingMemoryName",
83  "WorkingMemory",
84  "Name of the WorkingMemory component that should be used");
85  defineOptionalProperty<std::string>(
86  "ObjectMemoryObserverName",
87  "ObjectMemoryObserver",
88  "Name of the ObjectMemoryObserver component that should be used");
89  defineOptionalProperty<std::string>(
90  "PriorKnowledgeName",
91  "PriorKnowledge",
92  "Name of the PriorKnowledge component that should be used");
93  }
94  };
95 
96  /**
97  * @class PickAndPlaceGroupStatechartContext is a custom implementation of the StatechartContext
98  * for a statechart
99  */
101  virtual public XMLStatechartContext
102  {
103  public:
104  // inherited from Component
105  virtual std::string
107  {
108  return "PickAndPlaceGroupStatechartContext";
109  }
110 
111  virtual void onInitStatechartContext();
112  virtual void onConnectStatechartContext();
113 
116  {
117  return remoteRobot;
118  }
119 
122  {
123  return robotStateComponent;
124  }
125 
126  KinematicUnitInterfacePrx
128  {
129  return kinematicUnitPrx;
130  }
131 
132  std::string
134  {
135  return getProperty<std::string>("KinematicUnitObserverName").getValue();
136  }
137 
138  TCPControlUnitInterfacePrx
140  {
141  return tcpControlPrx;
142  }
143 
144  //std::string getTCPControlUnitObserverName() { return getProperty<std::string>("TCPControlUnitObserverName").getValue(); }
145  //ForceTorqueUnitInterfacePrx getForceTorqueUnit() { return ftUnitPrx;}
146  ForceTorqueUnitObserverInterfacePrx
148  {
149  return ftUnitObserverPrx;
150  }
151 
152  std::string
154  {
155  return getProperty<std::string>("ForceTorqueObserverName").getValue();
156  }
157 
158  //SimulatorInterfacePrx getSimulatorUnit(){ return simulatorProxy;}
159  HeadIKUnitInterfacePrx
161  {
162  return headIKUnitPrx;
163  }
164 
165  std::string
167  {
168  return headIKKinematicChainName;
169  }
170 
171  memoryx::WorkingMemoryInterfacePrx
173  {
174  return workingMemoryProxy;
175  }
176 
177  memoryx::ObjectMemoryObserverInterfacePrx
179  {
180  return objectMemoryObserverProxy;
181  }
182 
183  memoryx::PriorKnowledgeInterfacePrx
185  {
186  return priorKnowledgeProxy;
187  }
188 
189  private:
190  /**
191  * @see PropertyUser::createPropertyDefinitions()
192  */
193  virtual PropertyDefinitionsPtr createPropertyDefinitions();
194 
195 
196  RobotStateComponentInterfacePrx robotStateComponent;
197  KinematicUnitInterfacePrx kinematicUnitPrx;
198  KinematicUnitObserverInterfacePrx kinematicUnitObserverPrx;
199  TCPControlUnitInterfacePrx tcpControlPrx;
200  //TCPControlUnitObserverInterfacePrx tcpControlUnitObserverPrx;
201  //ForceTorqueUnitInterfacePrx ftUnitPrx;
202  ForceTorqueUnitObserverInterfacePrx ftUnitObserverPrx;
203  VirtualRobot::RobotPtr remoteRobot;
204  memoryx::WorkingMemoryInterfacePrx workingMemoryProxy;
205  memoryx::ObjectMemoryObserverInterfacePrx objectMemoryObserverProxy;
206  memoryx::PriorKnowledgeInterfacePrx priorKnowledgeProxy;
207  //SimulatorInterfacePrx simulatorProxy;
208  HeadIKUnitInterfacePrx headIKUnitPrx;
209  std::string headIKKinematicChainName;
210  std::string headIKUnitName;
211  };
212 
213 } // namespace armarx::PickAndPlaceGroup
armarx::XMLStatechartContext
Definition: StatechartContext.h:208
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getWorkingMemoryProxy
memoryx::WorkingMemoryInterfacePrx getWorkingMemoryProxy()
Definition: PickAndPlaceGroupStatechartContext.h:172
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getPriorKnowledgeProxy
memoryx::PriorKnowledgeInterfacePrx getPriorKnowledgeProxy()
Definition: PickAndPlaceGroupStatechartContext.h:184
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getObjectMemoryObserverProxy
memoryx::ObjectMemoryObserverInterfacePrx getObjectMemoryObserverProxy()
Definition: PickAndPlaceGroupStatechartContext.h:178
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
armarx::PickAndPlaceGroup
Definition: PickAndPlace.h:35
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getHeadIKUnit
HeadIKUnitInterfacePrx getHeadIKUnit()
Definition: PickAndPlaceGroupStatechartContext.h:160
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext
Definition: PickAndPlaceGroupStatechartContext.h:100
StatechartContext.h
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getForceTorqueUnitObserver
ForceTorqueUnitObserverInterfacePrx getForceTorqueUnitObserver()
Definition: PickAndPlaceGroupStatechartContext.h:147
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getKinematicUnitObserverName
std::string getKinematicUnitObserverName()
Definition: PickAndPlaceGroupStatechartContext.h:133
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getKinematicUnit
KinematicUnitInterfacePrx getKinematicUnit()
Definition: PickAndPlaceGroupStatechartContext.h:127
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getDefaultName
virtual std::string getDefaultName()
Definition: PickAndPlaceGroupStatechartContext.h:106
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getRobotStateComponent
RobotStateComponentInterfacePrx getRobotStateComponent()
Definition: PickAndPlaceGroupStatechartContext.h:121
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContextProperties::PickAndPlaceGroupStatechartContextProperties
PickAndPlaceGroupStatechartContextProperties(std::string prefix)
Definition: PickAndPlaceGroupStatechartContext.h:52
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getForceTorqueObserverName
std::string getForceTorqueObserverName()
Definition: PickAndPlaceGroupStatechartContext.h:153
Component.h
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getHeadIKKinematicChainName
std::string getHeadIKKinematicChainName()
Definition: PickAndPlaceGroupStatechartContext.h:166
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getTCPControlUnit
TCPControlUnitInterfacePrx getTCPControlUnit()
Definition: PickAndPlaceGroupStatechartContext.h:139
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContextProperties
Definition: PickAndPlaceGroupStatechartContext.h:50
armarx::PickAndPlaceGroup::PickAndPlaceGroupStatechartContext::getRobot
const VirtualRobot::RobotPtr getRobot()
Definition: PickAndPlaceGroupStatechartContext.h:115
armarx::StatechartContextPropertyDefinitions
The StatechartContextPropertyDefinitions class contains properties associated with all statecharts.
Definition: StatechartContext.h:56
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19
ImportExportComponent.h