diff --git a/VirtualRobot/Nodes/RobotNode.cpp b/VirtualRobot/Nodes/RobotNode.cpp index 9d5b3d742509dea322b30aa1af768fb361ad8917..72fdc79f519105a6e77c8c7a789d557c7570b061 100644 --- a/VirtualRobot/Nodes/RobotNode.cpp +++ b/VirtualRobot/Nodes/RobotNode.cpp @@ -359,7 +359,7 @@ namespace VirtualRobot physics.print(); - cout << "* Limits: Lo:" << jointLimitLo << ", Hi:" << jointLimitHi << endl; + cout << "* Limits: Lo:" << (limitless == false ? std::to_string(jointLimitLo) : "no limit") << ", Hi:" << (limitless == false ? std::to_string(jointLimitHi) : "no limit") << endl; std::cout << "* max velocity " << maxVelocity << " [m/s]" << std::endl; std::cout << "* max acceleration " << maxAcceleration << " [m/s^2]" << std::endl; std::cout << "* max torque " << maxTorque << " [Nm]" << std::endl; @@ -551,6 +551,16 @@ namespace VirtualRobot return false; } + void RobotNode::setLimitless(bool limitless) + { + this->limitless = limitless; + } + + bool RobotNode::isLimitless() + { + return limitless; + } + void RobotNode::showCoordinateSystem(bool enable, float scaling, std::string* text, const std::string& visualizationType) { diff --git a/VirtualRobot/Nodes/RobotNode.h b/VirtualRobot/Nodes/RobotNode.h index 6096a3d1e44ee2dc9b08cb15a7e0f67cb92c5ebf..066fb6f167e15dc21c6613bd62da75cd25ca5524 100644 --- a/VirtualRobot/Nodes/RobotNode.h +++ b/VirtualRobot/Nodes/RobotNode.h @@ -191,6 +191,11 @@ namespace VirtualRobot virtual bool isTranslationalJoint() const; virtual bool isRotationalJoint() const; + /** + * @param limitless wheter this node has joint limits or not. + */ + virtual void setLimitless(bool limitless); + bool isLimitless(); /*! Visualize the structure of this RobotNode. @@ -358,6 +363,7 @@ namespace VirtualRobot float jointValueOffset; float jointLimitLo, jointLimitHi; + bool limitless; // whether this joint has limits or not (ignored if nodeType != Joint). DHParameter optionalDHParameter; // When the joint is defined via DH parameters they are stored here float maxVelocity; //! given in m/s float maxAcceleration; //! given in m/s^2 diff --git a/VirtualRobot/XML/RobotIO.cpp b/VirtualRobot/XML/RobotIO.cpp index 731ca4737c0143509a84f7ecb2fa0026dbbe8421..51922cde63e892bd27b0bf9c02ea85769cc91e18 100644 --- a/VirtualRobot/XML/RobotIO.cpp +++ b/VirtualRobot/XML/RobotIO.cpp @@ -537,6 +537,8 @@ namespace VirtualRobot {*/ // create nodes that are not defined via DH parameters robotNode = robotNodeFactory->createRobotNode(robot, robotNodeName, visualizationNode, collisionModel, jointLimitLow, jointLimitHigh, jointOffset, preJointTransform, axis, translationDir, physics, rntype); + // if there was no limits-tag specified, we set this joint as limitless. + if (limitsNode == NULL) robotNode->setLimitless(true); //} } else