MotionControlGroupStatechartContext.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::MotionControlGroup
19  * @author Peter Kaiser ( peter dot kaiser at kit dot edu )
20  * @author Manfred Kroehnert ( Manfred dot Kroehnert at kit dot edu )
21  * @date 2014
22  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
23  * GNU General Public License
24  */
25 
27 
28 //#include <RobotAPI/libraries/core/remoterobot/RemoteRobot.h>
29 //#include <RobotAPI/libraries/core/Pose.h>
30 
36 
37 using namespace armarx;
38 
40 {
41  void
43  {
44  // Register dependencies
45  ARMARX_INFO << "KinematicUnitName "
46  << getProperty<std::string>("KinematicUnitName").getValue();
47  ARMARX_INFO << "KinematicUnitObserverName "
48  << getProperty<std::string>("KinematicUnitObserverName").getValue();
49  ARMARX_INFO << "RobotStateComponentName "
50  << getProperty<std::string>("RobotStateComponentName").getValue();
51  ARMARX_INFO << "TCPControlUnitName "
52  << getProperty<std::string>("TCPControlUnitName").getValue();
53 
54  usingProxy(getProperty<std::string>("KinematicUnitName").getValue());
55  usingProxy(getProperty<std::string>("KinematicUnitObserverName").getValue());
56  usingProxy(getProperty<std::string>("RobotStateComponentName").getValue());
57  usingProxy(getProperty<std::string>("TCPControlUnitName").getValue());
58 
59  offeringTopic("DebugDrawerUpdates");
60  }
61 
62  void
64  {
65  // retrieve proxies
66  robotStateComponent = getProxy<RobotStateComponentInterfacePrx>(
67  getProperty<std::string>("RobotStateComponentName").getValue());
68  kinematicUnitPrx = getProxy<KinematicUnitInterfacePrx>(
69  getProperty<std::string>("KinematicUnitName").getValue());
70  kinematicUnitObserverPrx = getProxy<KinematicUnitObserverInterfacePrx>(
71  getProperty<std::string>("KinematicUnitObserverName").getValue());
72  tcpControlPrx = getProxy<TCPControlUnitInterfacePrx>(
73  getProperty<std::string>("TCPControlUnitName").getValue());
74 
75  // initialize remote robot
76  remoteRobot.reset(new RemoteRobot(robotStateComponent->getSynchronizedRobot()));
77  std::string robotfilepath = robotStateComponent->getRobotFilename();
78  if (!ArmarXDataPath::getAbsolutePath(robotfilepath, robotfilepath, {}, false))
79  {
80  auto packages = robotStateComponent->getArmarXPackages();
81  for (auto& p : packages)
82  {
83  CMakePackageFinder finder(p);
85  }
86  if (!ArmarXDataPath::getAbsolutePath(robotfilepath, robotfilepath))
87  {
88  ARMARX_WARNING << "Could not get absolute robot model filepath for relative path : "
89  << robotfilepath << " - using network clone";
90  robotfilepath = "";
91  }
92  }
93  localrobot = RemoteRobot::createLocalClone(robotStateComponent, robotfilepath);
94  localCollisionRobot = RemoteRobot::createLocalClone(
95  robotStateComponent, robotfilepath, {}, VirtualRobot::RobotIO::eCollisionModel);
96  localStructureRobot = RemoteRobot::createLocalClone(
97  robotStateComponent, robotfilepath, {}, VirtualRobot::RobotIO::eStructure);
98  robotPool.reset(new RobotPool(localCollisionRobot));
99  debugDrawerTopicProxy = getTopic<DebugDrawerInterfacePrx>("DebugDrawerUpdates");
100  debugObserverProxy = getProxy<DebugObserverInterfacePrx>("DebugObserver", false, "", false);
101  }
102 
104  MotionControlGroupStatechartContext::createPropertyDefinitions()
105  {
106  return PropertyDefinitionsPtr(
108  }
109 } // namespace armarx::MotionControlGroup
armarx::MotionControlGroup::MotionControlGroupStatechartContext::onInitStatechartContext
void onInitStatechartContext() override
onInitStatechartonInitStatechartContext can be implemented by subclasses
Definition: MotionControlGroupStatechartContext.cpp:42
armarx::CMakePackageFinder
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
Definition: CMakePackageFinder.h:52
armarx::MotionControlGroup
Definition: CalculateGazeIk.h:29
Statechart.h
armarx::CMakePackageFinder::getDataDir
std::string getDataDir() const
Definition: CMakePackageFinder.h:194
armarx::RobotPool
This class holds a pool of local VirtualRobots for multi threaded applications that can be requested ...
Definition: RobotPool.h:40
MotionControlGroupStatechartContext.h
Component.h
armarx::MotionControlGroup::MotionControlGroupStatechartContextProperties
Definition: MotionControlGroupStatechartContext.h:50
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:79
CMakePackageFinder.h
armarx::RemoteRobot
Mimics the behaviour of the VirtualRobot::Robot class while redirecting everything to an Ice proxy.
Definition: RemoteRobot.h:144
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
armarx::ArmarXDataPath::addDataPaths
static void addDataPaths(const std::string &dataPathList)
Definition: ArmarXDataPath.cpp:554
armarx::RemoteRobot::createLocalClone
VirtualRobot::RobotPtr createLocalClone()
Clones the structure of this remote robot to a local instance.
Definition: RemoteRobot.cpp:381
armarx::ManagedIceObject::offeringTopic
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
Definition: ManagedIceObject.cpp:300
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::ArmarXDataPath::getAbsolutePath
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
Definition: ArmarXDataPath.cpp:109
armarx::MotionControlGroup::MotionControlGroupStatechartContext::onConnectStatechartContext
void onConnectStatechartContext() override
onConnectStatechartContext can be implemented by subclasses
Definition: MotionControlGroupStatechartContext.cpp:63
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:193
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
ArmarXDataPath.h
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:154
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
ImportExportComponent.h