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
37using 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
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());
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 {
108 }
109} // namespace armarx::MotionControlGroup
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
static void addDataPaths(const std::string &dataPathList)
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
Property< PropertyType > getProperty(const std::string &name)
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
void onInitStatechartContext() override
onInitStatechartonInitStatechartContext can be implemented by subclasses
void onConnectStatechartContext() override
onConnectStatechartContext can be implemented by subclasses
Mimics the behaviour of the VirtualRobot::Robot class while redirecting everything to an Ice proxy.
VirtualRobot::RobotPtr createLocalClone()
Clones the structure of this remote robot to a local instance.
This class holds a pool of local VirtualRobots for multi threaded applications that can be requested ...
Definition RobotPool.h:41
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:193
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.