diff --git a/source/RobotAPI/libraries/core/remoterobot/RemoteRobot.cpp b/source/RobotAPI/libraries/core/remoterobot/RemoteRobot.cpp index f444d8c2c31b8388c815a57ffb002656d0c29665..16d718d9b110fb7fa214a69f25959d734fc2b4d9 100644 --- a/source/RobotAPI/libraries/core/remoterobot/RemoteRobot.cpp +++ b/source/RobotAPI/libraries/core/remoterobot/RemoteRobot.cpp @@ -30,6 +30,9 @@ #include <VirtualRobot/Nodes/RobotNodeFixedFactory.h> #include <VirtualRobot/Nodes/RobotNodePrismaticFactory.h> #include <VirtualRobot/Nodes/RobotNodeRevoluteFactory.h> + + + #include <VirtualRobot/CollisionDetection/CollisionChecker.h> #include <Eigen/Geometry> #include <ArmarXCore/core/system/cmake/CMakePackageFinder.h> @@ -72,13 +75,13 @@ namespace armarx } - RobotNodePtr RemoteRobot::getRootNode() + RobotNodePtr RemoteRobot::getRootNode() const { + // lazy initialization needed since shared_from_this() must not be called in constructor if (!_root) { _root = RemoteRobot::createRemoteRobotNode(_robot->getRootNode(), shared_from_this()); } - return _root; } @@ -156,7 +159,7 @@ namespace armarx return _robot->hasRobotNodeSet(name); } - RobotNodeSetPtr RemoteRobot::getRobotNodeSet(const string& nodeSetName) + RobotNodeSetPtr RemoteRobot::getRobotNodeSet(const string& nodeSetName) const { vector<RobotNodePtr> storeNodes; RobotNodeSetInfoPtr info = _robot->getRobotNodeSet(nodeSetName); @@ -165,7 +168,7 @@ namespace armarx } - void RemoteRobot::getRobotNodeSets(vector<RobotNodeSetPtr>& storeNodeSet) + void RemoteRobot::getRobotNodeSets(vector<RobotNodeSetPtr>& storeNodeSet) const { NameList sets = _robot->getRobotNodeSets(); @@ -399,7 +402,7 @@ namespace armarx else { Ice::StringSeq includePaths; - for (const std::string & projectName : packages) + for (const std::string& projectName : packages) { if (projectName.empty()) { diff --git a/source/RobotAPI/libraries/core/remoterobot/RemoteRobot.h b/source/RobotAPI/libraries/core/remoterobot/RemoteRobot.h index eb417383092289a463d92414e60fa25a3d9bc35a..496899ec87deed0478a8057ed459831eb34047ed 100644 --- a/source/RobotAPI/libraries/core/remoterobot/RemoteRobot.h +++ b/source/RobotAPI/libraries/core/remoterobot/RemoteRobot.h @@ -21,7 +21,7 @@ * @copyright http://www.gnu.org/licenses/gpl-2.0.txt * GNU General Public License */ - +#pragma once #ifndef _ARMARX_REMOTE_ROBOT_H__ #define _ARMARX_REMOTE_ROBOT_H__ @@ -41,6 +41,13 @@ #include <boost/utility/enable_if.hpp> #include <boost/type_traits/is_base_of.hpp> +//namespace VirtualRobot +//{ +// class RobotNodeRevolute; +// class RobotNodePrismatic; +// class RobotNodeFixed; +//} + namespace armarx { // forward declaration of RemoteRobotNode @@ -150,7 +157,7 @@ namespace armarx RemoteRobot(SharedRobotInterfacePrx robot); - virtual VirtualRobot::RobotNodePtr getRootNode(); + virtual VirtualRobot::RobotNodePtr getRootNode() const; virtual bool hasRobotNode(const std::string& robotNodeName); virtual bool hasRobotNode(VirtualRobot::RobotNodePtr); @@ -159,8 +166,8 @@ namespace armarx virtual void getRobotNodes(std::vector< VirtualRobot::RobotNodePtr >& storeNodes, bool clearVector = true); virtual bool hasRobotNodeSet(const std::string& name); - virtual VirtualRobot::RobotNodeSetPtr getRobotNodeSet(const std::string& nodeSetName); - virtual void getRobotNodeSets(std::vector<VirtualRobot::RobotNodeSetPtr>& storeNodeSet); + virtual VirtualRobot::RobotNodeSetPtr getRobotNodeSet(const std::string& nodeSetName) const; + virtual void getRobotNodeSets(std::vector<VirtualRobot::RobotNodeSetPtr>& storeNodeSet) const; /** * @@ -258,7 +265,7 @@ namespace armarx protected: SharedRobotInterfacePrx _robot; std::map<std::string, VirtualRobot::RobotNodePtr> _cachedNodes; - VirtualRobot::RobotNodePtr _root; + mutable VirtualRobot::RobotNodePtr _root; static boost::recursive_mutex m;