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 
29 
31 #include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h>
32 #include <RobotAPI/interface/observers/PlatformUnitObserverInterface.h>
33 #include <RobotAPI/interface/units/PlatformUnitInterface.h>
34 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
37 
40 //#include <VirtualRobot/VirtualRobot.h>
41 #include <IceUtil/Time.h>
42 
43 #include <RobotAPI/interface/ArViz/Component.h>
44 
45 namespace armarx
46 {
47 
48  // ****************************************************************
49  // Component and context
50  // ****************************************************************
51 
53  {
55  {
56  defineOptionalProperty<std::string>(
57  "PlatformUnitName", "PlatformUnit", "Name of the PlatformUnit to use");
58  defineOptionalProperty<std::string>("PlatformUnitObserverName",
59  "PlatformUnitObserver",
60  "Name of the PlatformUnitObserver to use");
61  defineOptionalProperty<std::string>(
62  "DebugDrawerTopic", "DebugDrawerUpdates", "Name of the DebugDrawerTopic to use");
63  defineOptionalProperty<std::string>(
64  "PriorKnowledgeName", "PriorKnowledge", "Name of the PriorKnowledge memory to use");
65  defineOptionalProperty<std::string>("GraphNodePoseResolverName",
66  "GraphNodePoseResolver",
67  "Name of the GraphNodePoseResolver to use");
68  defineOptionalProperty<std::string>(
69  "ArVizTopicName", "ArVizTopic", "Name of the ar viz topic that should be used");
70  defineOptionalProperty<std::string>(
71  "MemoryNameSystemName",
72  "MemoryNameSystem",
73  "Name of the Memory Name System that should be used");
74  }
75  };
76 
78  {
79  public:
80  // inherited from Component
81  std::string
82  getDefaultName() const override
83  {
84  return "PlatformContext";
85  }
86 
87  void
89  {
90  ARMARX_INFO << "Init PlatformContext" << flush;
91 
92  platformUnitObserverName =
93  getProperty<std::string>("PlatformUnitObserverName").getValue();
94  platformUnitDynamicSimulationName =
95  getProperty<std::string>("PlatformUnitName").getValue();
96  priorKnowledgeName = getProperty<std::string>("PriorKnowledgeName").getValue();
97 
98  usingProxy(platformUnitDynamicSimulationName);
99  usingProxy(platformUnitObserverName);
100  offeringTopic(getProperty<std::string>("DebugDrawerTopic").getValue());
101  offeringTopic("DebugObserver");
102  usingProxy(priorKnowledgeName);
103  offeringTopic(getProperty<std::string>("ArVizTopicName").getValue());
104  usingProxy(getProperty<std::string>("GraphNodePoseResolverName").getValue());
105  usingProxyFromProperty("MemoryNameSystemName");
106  }
107 
108  void
110  {
111  ARMARX_INFO << "Starting PlatformContext" << flush;
112 
113  // retrieve proxies
114  debugObserverPrx = getTopic<DebugObserverInterfacePrx>("DebugObserver");
115  platformUnitPrx = getProxy<PlatformUnitInterfacePrx>(platformUnitDynamicSimulationName);
116  platformUnitObserverPrx =
117  getProxy<PlatformUnitObserverInterfacePrx>(platformUnitObserverName);
118  debugDrawer = getTopic<DebugDrawerInterfacePrx>(
119  getProperty<std::string>("DebugDrawerTopic").getValue());
120  priorKnowledgePrx = getProxy<memoryx::PriorKnowledgeInterfacePrx>(priorKnowledgeName);
121  graphNodePoseResolverPrx = getProxy<memoryx::GraphNodePoseResolverInterfacePrx>(
122  getProperty<std::string>("GraphNodePoseResolverName").getValue());
123  arvizTopic = getTopic<armarx::viz::TopicPrx>(
124  getProperty<std::string>("ArVizTopicName").getValue());
125  getProxyFromProperty(memoryNameSystemPrx, "MemoryNameSystemName");
126  }
127 
128  /**
129  * @see PropertyUser::createPropertyDefinitions()
130  */
133  {
134  return PropertyDefinitionsPtr(new PlatformContextProperties(getConfigIdentifier()));
135  }
136 
137  std::string
139  {
140  return platformUnitObserverName;
141  }
142 
143  PlatformUnitInterfacePrx platformUnitPrx;
144  PlatformUnitObserverInterfacePrx platformUnitObserverPrx;
146  memoryx::GraphNodePoseResolverInterfacePrx graphNodePoseResolverPrx;
151  armarx::armem::mns::MemoryNameSystemInterfacePrx memoryNameSystemPrx;
152 
153  std::string priorKnowledgeName;
154  memoryx::PriorKnowledgeInterfacePrx priorKnowledgePrx;
155 
156  private:
157  };
158 } // namespace armarx
armarx::PlatformContext::getPlatformUnitObserverName
std::string getPlatformUnitObserverName()
Definition: PlatformContext.h:138
RemoteRobot.h
armarx::PlatformContextProperties
Definition: PlatformContext.h:52
armarx::XMLStatechartContext
Definition: StatechartContext.h:208
armarx::PlatformContext::onInitStatechartContext
void onInitStatechartContext() override
onInitStatechartonInitStatechartContext can be implemented by subclasses
Definition: PlatformContext.h:88
armarx::PlatformContext::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: PlatformContext.h:82
armarx::PlatformContext::graphNodePoseResolverPrx
memoryx::GraphNodePoseResolverInterfacePrx graphNodePoseResolverPrx
Definition: PlatformContext.h:146
armarx::PlatformContext::platformUnitDynamicSimulationName
std::string platformUnitDynamicSimulationName
Definition: PlatformContext.h:148
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
armarx::PlatformContext::onConnectStatechartContext
void onConnectStatechartContext() override
onConnectStatechartContext can be implemented by subclasses
Definition: PlatformContext.h:109
RobotAPIObjectFactories.h
StatechartContext.h
armarx::PlatformContext::priorKnowledgeName
std::string priorKnowledgeName
Definition: PlatformContext.h:153
PriorKnowledge.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
IceStorm::TopicPrx
::IceInternal::ProxyHandle<::IceProxy::IceStorm::Topic > TopicPrx
Definition: IceManager.h:70
armarx::flush
const LogSender::manipulator flush
Definition: LogSender.h:251
armarx::PlatformContext::platformUnitObserverName
std::string platformUnitObserverName
Definition: PlatformContext.h:147
armarx::PlatformContextProperties::PlatformContextProperties
PlatformContextProperties(std::string prefix)
Definition: PlatformContext.h:54
Component.h
GraphNodePoseResolver.h
armarx::PlatformContext::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PlatformContext.h:132
armarx::PlatformContext::debugObserverPrx
DebugObserverInterfacePrx debugObserverPrx
Definition: PlatformContext.h:149
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
armarx::PlatformContext::arvizTopic
armarx::viz::TopicPrx arvizTopic
Definition: PlatformContext.h:150
IceUtil::Handle
Definition: forward_declarations.h:30
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
armarx::PlatformContext::platformUnitPrx
PlatformUnitInterfacePrx platformUnitPrx
Definition: PlatformContext.h:143
armarx::PlatformContext::priorKnowledgePrx
memoryx::PriorKnowledgeInterfacePrx priorKnowledgePrx
Definition: PlatformContext.h:154
armarx::PlatformContext
Definition: PlatformContext.h:77
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
armarx::PlatformContext::memoryNameSystemPrx
armarx::armem::mns::MemoryNameSystemInterfacePrx memoryNameSystemPrx
Definition: PlatformContext.h:151
PlatformUnitObserver.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::StatechartContextPropertyDefinitions
The StatechartContextPropertyDefinitions class contains properties associated with all statecharts.
Definition: StatechartContext.h:56
armarx::PlatformContext::debugDrawer
DebugDrawerInterfacePrx debugDrawer
Definition: PlatformContext.h:145
armarx::PlatformContext::platformUnitObserverPrx
PlatformUnitObserverInterfacePrx platformUnitObserverPrx
Definition: PlatformContext.h:144
ImportExportComponent.h