PlatformContext.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package RobotSkillTemplates::MovePlatform
17 * @author Valerij Wittenbeck
18 * @date 2014
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 
24 #pragma once
25 
30 #include <RobotAPI/interface/units/PlatformUnitInterface.h>
31 #include <RobotAPI/interface/observers/PlatformUnitObserverInterface.h>
32 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
33 #include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h>
37 
39 //#include <VirtualRobot/VirtualRobot.h>
40 #include <IceUtil/Time.h>
41 #include <RobotAPI/interface/ArViz/Component.h>
42 
43 namespace armarx
44 {
45 
46  // ****************************************************************
47  // Component and context
48  // ****************************************************************
49 
51  {
54  {
55  defineOptionalProperty<std::string>("PlatformUnitName", "PlatformUnit", "Name of the PlatformUnit to use");
56  defineOptionalProperty<std::string>("PlatformUnitObserverName", "PlatformUnitObserver", "Name of the PlatformUnitObserver to use");
57  defineOptionalProperty<std::string>("DebugDrawerTopic", "DebugDrawerUpdates", "Name of the DebugDrawerTopic to use");
58  defineOptionalProperty<std::string>("PriorKnowledgeName", "PriorKnowledge", "Name of the PriorKnowledge memory to use");
59  defineOptionalProperty<std::string>("GraphNodePoseResolverName", "GraphNodePoseResolver", "Name of the GraphNodePoseResolver to use");
60  defineOptionalProperty<std::string>("ArVizTopicName", "ArVizTopic", "Name of the ar viz topic that should be used");
61  defineOptionalProperty<std::string>("MemoryNameSystemName", "MemoryNameSystem", "Name of the Memory Name System that should be used");
62  }
63  };
65  virtual public XMLStatechartContext
66  {
67  public:
68  // inherited from Component
69  std::string getDefaultName() const override
70  {
71  return "PlatformContext";
72  }
73  void onInitStatechartContext() override
74  {
75  ARMARX_INFO << "Init PlatformContext" << flush;
76 
77  platformUnitObserverName = getProperty<std::string>("PlatformUnitObserverName").getValue();
78  platformUnitDynamicSimulationName = getProperty<std::string>("PlatformUnitName").getValue();
79  priorKnowledgeName = getProperty<std::string>("PriorKnowledgeName").getValue();
80 
81  usingProxy(platformUnitDynamicSimulationName);
82  usingProxy(platformUnitObserverName);
83  offeringTopic(getProperty<std::string>("DebugDrawerTopic").getValue());
84  offeringTopic("DebugObserver");
85  usingProxy(priorKnowledgeName);
86  offeringTopic(getProperty<std::string>("ArVizTopicName").getValue());
87  usingProxy(getProperty<std::string>("GraphNodePoseResolverName").getValue());
88  usingProxyFromProperty("MemoryNameSystemName");
89  }
90 
92  {
93  ARMARX_INFO << "Starting PlatformContext" << flush;
94 
95  // retrieve proxies
96  debugObserverPrx = getTopic<DebugObserverInterfacePrx>("DebugObserver");
97  platformUnitPrx = getProxy<PlatformUnitInterfacePrx>(platformUnitDynamicSimulationName);
98  platformUnitObserverPrx = getProxy<PlatformUnitObserverInterfacePrx>(platformUnitObserverName);
99  debugDrawer = getTopic<DebugDrawerInterfacePrx>(getProperty<std::string>("DebugDrawerTopic").getValue());
100  priorKnowledgePrx = getProxy<memoryx::PriorKnowledgeInterfacePrx>(priorKnowledgeName);
101  graphNodePoseResolverPrx = getProxy<memoryx::GraphNodePoseResolverInterfacePrx>(getProperty<std::string>("GraphNodePoseResolverName").getValue());
102  arvizTopic = getTopic<armarx::viz::TopicPrx>(getProperty<std::string>("ArVizTopicName").getValue());
103  getProxyFromProperty(memoryNameSystemPrx, "MemoryNameSystemName");
104  }
105 
106 
107  /**
108  * @see PropertyUser::createPropertyDefinitions()
109  */
111  {
113  getConfigIdentifier()));
114  }
116  {
117  return platformUnitObserverName;
118  }
119 
120  PlatformUnitInterfacePrx platformUnitPrx;
121  PlatformUnitObserverInterfacePrx platformUnitObserverPrx;
123  memoryx::GraphNodePoseResolverInterfacePrx graphNodePoseResolverPrx;
128  armarx::armem::mns::MemoryNameSystemInterfacePrx memoryNameSystemPrx;
129 
130  std::string priorKnowledgeName;
131  memoryx::PriorKnowledgeInterfacePrx priorKnowledgePrx;
132 
133  private:
134 
135  };
136 }
137 
armarx::PlatformContext::getPlatformUnitObserverName
std::string getPlatformUnitObserverName()
Definition: PlatformContext.h:115
RemoteRobot.h
armarx::PlatformContextProperties
Definition: PlatformContext.h:50
armarx::XMLStatechartContext
Definition: StatechartContext.h:196
armarx::PlatformContext::onInitStatechartContext
void onInitStatechartContext() override
onInitStatechartonInitStatechartContext can be implemented by subclasses
Definition: PlatformContext.h:73
armarx::PlatformContext::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: PlatformContext.h:69
armarx::PlatformContext::graphNodePoseResolverPrx
memoryx::GraphNodePoseResolverInterfacePrx graphNodePoseResolverPrx
Definition: PlatformContext.h:123
armarx::PlatformContext::platformUnitDynamicSimulationName
std::string platformUnitDynamicSimulationName
Definition: PlatformContext.h:125
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
armarx::PlatformContext::onConnectStatechartContext
void onConnectStatechartContext() override
onConnectStatechartContext can be implemented by subclasses
Definition: PlatformContext.h:91
RobotAPIObjectFactories.h
StatechartContext.h
armarx::PlatformContext::priorKnowledgeName
std::string priorKnowledgeName
Definition: PlatformContext.h:130
PriorKnowledge.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::flush
const LogSender::manipulator flush
Definition: LogSender.h:251
armarx::PlatformContext::platformUnitObserverName
std::string platformUnitObserverName
Definition: PlatformContext.h:124
IceStorm::TopicPrx
::IceInternal::ProxyHandle< ::IceProxy::IceStorm::Topic > TopicPrx
Definition: IceManager.h:70
armarx::PlatformContextProperties::PlatformContextProperties
PlatformContextProperties(std::string prefix)
Definition: PlatformContext.h:52
Component.h
GraphNodePoseResolver.h
armarx::PlatformContext::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PlatformContext.h:110
armarx::PlatformContext::debugObserverPrx
DebugObserverInterfacePrx debugObserverPrx
Definition: PlatformContext.h:126
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::PlatformContext::arvizTopic
armarx::viz::TopicPrx arvizTopic
Definition: PlatformContext.h:127
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
armarx::PlatformContext::platformUnitPrx
PlatformUnitInterfacePrx platformUnitPrx
Definition: PlatformContext.h:120
armarx::PlatformContext::priorKnowledgePrx
memoryx::PriorKnowledgeInterfacePrx priorKnowledgePrx
Definition: PlatformContext.h:131
armarx::PlatformContext
Definition: PlatformContext.h:64
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
armarx::PlatformContext::memoryNameSystemPrx
armarx::armem::mns::MemoryNameSystemInterfacePrx memoryNameSystemPrx
Definition: PlatformContext.h:128
PlatformUnitObserver.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::StatechartContextPropertyDefinitions
The StatechartContextPropertyDefinitions class contains properties associated with all statecharts.
Definition: StatechartContext.h:58
armarx::PlatformContext::debugDrawer
DebugDrawerInterfacePrx debugDrawer
Definition: PlatformContext.h:122
armarx::PlatformContext::platformUnitObserverPrx
PlatformUnitObserverInterfacePrx platformUnitObserverPrx
Definition: PlatformContext.h:121
ImportExportComponent.h