CoupledInteractionGroupStatechartContext.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::CoupledInteractionGroup
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// Custom Includes
35#include <VirtualRobot/VirtualRobot.h>
36
39#include <RobotAPI/interface/components/ViewSelectionInterface.h>
40#include <RobotAPI/interface/core/RobotState.h>
41#include <RobotAPI/interface/observers/KinematicUnitObserverInterface.h>
42#include <RobotAPI/interface/observers/PlatformUnitObserverInterface.h>
43#include <RobotAPI/interface/units/KinematicUnitInterface.h>
44#include <RobotAPI/interface/units/PlatformUnitInterface.h>
45#include <RobotAPI/interface/units/TCPControlUnit.h>
47
49#include <MemoryX/interface/components/PriorKnowledgeInterface.h>
50#include <MemoryX/interface/components/WorkingMemoryInterface.h>
51#include <MemoryX/interface/observers/ObjectMemoryObserverInterface.h>
54//#include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
56
58{
59
61 {
64 {
65 // defineRequiredProperty<std::string>("KinematicUnitName", "Name of the kinematic unit that should be used");
66 // defineRequiredProperty<std::string>("KinematicUnitObserverName", "Name of the kinematic unit observer that should be used");
67 // defineOptionalProperty<std::string>("RobotStateComponentName", "RobotStateComponent", "Name of the robot state component that should be used");
68 // defineOptionalProperty<std::string>("TCPControlUnitName", "TCPControlUnit", "Name of the tcp control unit component that should be used");
69 defineRequiredProperty<std::string>("KinematicUnitName",
70 "Name of the kinematic unit that should be used");
72 "KinematicUnitObserverName",
73 "Name of the kinematic unit observer that should be used");
75 "RobotStateComponentName",
76 "RobotStateComponent",
77 "Name of the robot state component that should be used");
79 "TCPControlUnitName",
80 "TCPControlUnit",
81 "Name of the tcp control unit component that should be used");
83 "WorkingMemoryName",
84 "WorkingMemory",
85 "Name of the WorkingMemory component that should be used");
87 "ObjectMemoryObserverName",
88 "ObjectMemoryObserver",
89 "Name of the ObjectMemoryObserver component that should be used");
91 "PriorKnowledgeName",
92 "PriorKnowledge",
93 "Name of the PriorKnowledge component that should be used");
94 defineOptionalProperty<std::string>("PlatformUnitName",
95 "PlatformUnitDynamicSimulation",
96 "Name of the PlatformUnit to use");
97 defineOptionalProperty<std::string>("PlatformUnitObserverName",
98 "PlatformUnitObserver",
99 "Name of the PlatformUnitObserver to use");
100 defineOptionalProperty<std::string>("ForceTorqueObserverName",
101 "ForceTorqueObserver",
102 "Name of the ForceTorqueObserver to use");
104 "TCPControlUnitObserverName",
105 "TCPControlUnitObserver",
106 "Name of the tcp control unit observer that should be used");
108 "ViewSelectionName",
109 "ViewSelection",
110 "Name of the ViewSelection component that should be used");
111 }
112 };
113
114 /**
115 * @class CoupledInteractionGroupStatechartContext is a custom implementation of the StatechartContext
116 * for a statechart
117 */
119 virtual public XMLStatechartContext
120 {
121 public:
122 // inherited from Component
123 std::string
124 getDefaultName() const override
125 {
126 return "CoupledInteractionGroupStatechartContext";
127 }
128
129 void onInitStatechartContext() override;
130 void onConnectStatechartContext() override;
131
134 {
135 return remoteRobot;
136 }
137
140 {
141 return robotStateComponent;
142 }
143
144 KinematicUnitInterfacePrx
146 {
147 return kinematicUnitPrx;
148 }
149
150 std::string
152 {
153 return getProperty<std::string>("KinematicUnitObserverName").getValue();
154 }
155
156 TCPControlUnitInterfacePrx
158 {
159 return tcpControlPrx;
160 }
161
162 TCPControlUnitObserverInterfacePrx
164 {
165 return tcpControlUnitObserverPrx;
166 }
167
168 memoryx::WorkingMemoryInterfacePrx
170 {
171 return workingMemoryProxy;
172 }
173
174 memoryx::ObjectMemoryObserverInterfacePrx
176 {
177 return objectMemoryObserverProxy;
178 }
179
180 memoryx::PriorKnowledgeInterfacePrx
182 {
183 return priorKnowledgeProxy;
184 }
185
186 PlatformUnitInterfacePrx
188 {
189 return platformUnitPrx;
190 }
191
192 PlatformUnitObserverInterfacePrx
194 {
195 return platformUnitObserverPrx;
196 }
197
200 {
201 return debugDrawerTopicProxy;
202 }
203
204 //SimulatorInterfacePrx getSimulatorProxy() { return simulatorPrx; }
205
206 std::string
208 {
209 return platformUnitObserverName;
210 }
211
212 Eigen::Matrix4f getRobotPose();
213
214 ViewSelectionInterfacePrx
216 {
217 return viewSelectionProxy;
218 }
219
220 ForceTorqueUnitObserverInterfacePrx
222 {
223 return ftUnitObserverPrx;
224 }
225
226 //SimpleLocationInterfacePrx getSimpleLocation() { return simpleLocationPrx;}
227 std::string
229 {
230 return getProperty<std::string>("ForceTorqueObserverName").getValue();
231 }
232
233 private:
234 /**
235 * @see PropertyUser::createPropertyDefinitions()
236 */
237 PropertyDefinitionsPtr createPropertyDefinitions() override;
238
239
240 RobotStateComponentInterfacePrx robotStateComponent;
241 KinematicUnitInterfacePrx kinematicUnitPrx;
242 KinematicUnitObserverInterfacePrx kinematicUnitObserverPrx;
243 TCPControlUnitInterfacePrx tcpControlPrx;
244 TCPControlUnitObserverInterfacePrx tcpControlUnitObserverPrx;
245 VirtualRobot::RobotPtr remoteRobot;
246
247 memoryx::WorkingMemoryInterfacePrx workingMemoryProxy;
248 memoryx::ObjectMemoryObserverInterfacePrx objectMemoryObserverProxy;
249 memoryx::PriorKnowledgeInterfacePrx priorKnowledgeProxy;
250
251 //SimulatorInterfacePrx simulatorPrx;
252 armarx::DebugDrawerInterfacePrx debugDrawerTopicProxy;
253 ViewSelectionInterfacePrx viewSelectionProxy;
255 PlatformUnitInterfacePrx platformUnitPrx;
256 PlatformUnitObserverInterfacePrx platformUnitObserverPrx;
257 std::string platformUnitName;
258 std::string platformUnitObserverName;
259 //SimpleLocationInterfacePrx simpleLocationPrx;
260 ForceTorqueUnitObserverInterfacePrx ftUnitObserverPrx;
261 };
262
263} // namespace armarx::CoupledInteractionGroup
#define ARMARXCOMPONENT_IMPORT_EXPORT
Property< PropertyType > getProperty(const std::string &name)
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
PropertyDefinition< PropertyType > & defineRequiredProperty(const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface > DebugDrawerInterfacePrx
IceInternal::Handle< AgentInstance > AgentInstancePtr
Typedef of AgentEntityPtr as IceInternal::Handle<AgentEntity> for convenience.