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 {
42  {
43  // Register dependencies
44  ARMARX_INFO << "KinematicUnitName " << getProperty<std::string>("KinematicUnitName").getValue();
45  ARMARX_INFO << "KinematicUnitObserverName " << getProperty<std::string>("KinematicUnitObserverName").getValue();
46  ARMARX_INFO << "RobotStateComponentName " << getProperty<std::string>("RobotStateComponentName").getValue();
47  ARMARX_INFO << "TCPControlUnitName " << getProperty<std::string>("TCPControlUnitName").getValue();
48 
49  usingProxy(getProperty<std::string>("KinematicUnitName").getValue());
50  usingProxy(getProperty<std::string>("KinematicUnitObserverName").getValue());
51  usingProxy(getProperty<std::string>("RobotStateComponentName").getValue());
52  usingProxy(getProperty<std::string>("TCPControlUnitName").getValue());
53 
54  offeringTopic("DebugDrawerUpdates");
55  }
56 
58  {
59  // retrieve proxies
60  robotStateComponent = getProxy<RobotStateComponentInterfacePrx>(getProperty<std::string>("RobotStateComponentName").getValue());
61  kinematicUnitPrx = getProxy<KinematicUnitInterfacePrx>(getProperty<std::string>("KinematicUnitName").getValue());
62  kinematicUnitObserverPrx = getProxy<KinematicUnitObserverInterfacePrx>(getProperty<std::string>("KinematicUnitObserverName").getValue());
63  tcpControlPrx = getProxy<TCPControlUnitInterfacePrx>(getProperty<std::string>("TCPControlUnitName").getValue());
64 
65  // initialize remote robot
66  remoteRobot.reset(new RemoteRobot(robotStateComponent->getSynchronizedRobot()));
67  std::string robotfilepath = robotStateComponent->getRobotFilename();
68  if (!ArmarXDataPath::getAbsolutePath(robotfilepath, robotfilepath, {}, false))
69  {
70  auto packages = robotStateComponent->getArmarXPackages();
71  for (auto& p : packages)
72  {
73  CMakePackageFinder finder(p);
75  }
76  if (!ArmarXDataPath::getAbsolutePath(robotfilepath, robotfilepath))
77  {
78  ARMARX_WARNING << "Could not get absolute robot model filepath for relative path : " << robotfilepath << " - using network clone";
79  robotfilepath = "";
80  }
81  }
82  localrobot = RemoteRobot::createLocalClone(robotStateComponent, robotfilepath);
83  localCollisionRobot = RemoteRobot::createLocalClone(robotStateComponent, robotfilepath, {}, VirtualRobot::RobotIO::eCollisionModel);
84  localStructureRobot = RemoteRobot::createLocalClone(robotStateComponent, robotfilepath, {}, VirtualRobot::RobotIO::eStructure);
85  robotPool.reset(new RobotPool(localCollisionRobot));
86  debugDrawerTopicProxy = getTopic<DebugDrawerInterfacePrx>("DebugDrawerUpdates");
87  debugObserverProxy = getProxy<DebugObserverInterfacePrx>("DebugObserver", false, "", false);
88  }
89 
90  PropertyDefinitionsPtr MotionControlGroupStatechartContext::createPropertyDefinitions()
91  {
94  }
95 }
96 
armarx::MotionControlGroup::MotionControlGroupStatechartContext::onInitStatechartContext
void onInitStatechartContext() override
onInitStatechartonInitStatechartContext can be implemented by subclasses
Definition: MotionControlGroupStatechartContext.cpp:41
armarx::CMakePackageFinder
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
Definition: CMakePackageFinder.h:53
armarx::MotionControlGroup
Definition: CalculateGazeIk.h:29
Statechart.h
armarx::CMakePackageFinder::getDataDir
std::string getDataDir() const
Definition: CMakePackageFinder.h:176
armarx::RobotPool
This class holds a pool of local VirtualRobots for multi threaded applications that can be requested ...
Definition: RobotPool.h:39
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:74
CMakePackageFinder.h
armarx::RemoteRobot
Mimics the behaviour of the VirtualRobot::Robot class while redirecting everything to an Ice proxy.
Definition: RemoteRobot.h:139
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::ArmarXDataPath::addDataPaths
static void addDataPaths(const std::string &dataPathList)
Definition: ArmarXDataPath.cpp:559
armarx::RemoteRobot::createLocalClone
VirtualRobot::RobotPtr createLocalClone()
Clones the structure of this remote robot to a local instance.
Definition: RemoteRobot.cpp:328
armarx::ManagedIceObject::offeringTopic
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
Definition: ManagedIceObject.cpp:290
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:111
armarx::MotionControlGroup::MotionControlGroupStatechartContext::onConnectStatechartContext
void onConnectStatechartContext() override
onConnectStatechartContext can be implemented by subclasses
Definition: MotionControlGroupStatechartContext.cpp:57
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
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:151
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h