Skip to content
Snippets Groups Projects
Commit 0c07b170 authored by Mirko Wächter's avatar Mirko Wächter
Browse files

made enforcement of joint limits optional

parent 65fe0fda
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@
#include "../XML/BaseIO.h"
#include <cmath>
#include <iomanip>
#include <boost/optional/optional_io.hpp>
#include <algorithm>
#include <Eigen/Core>
......@@ -125,6 +125,16 @@ namespace VirtualRobot
}
bool RobotNode::getEnforceJointLimits() const
{
return enforceJointLimits;
}
void RobotNode::setEnforceJointLimits(bool value)
{
enforceJointLimits = value;
}
RobotPtr RobotNode::getRobot() const
{
RobotPtr result(robot);
......@@ -181,15 +191,17 @@ namespace VirtualRobot
}
else
{
// non-limitless joint: clamp to borders
if (q < jointLimitLo)
if(enforceJointLimits)// non-limitless joint: clamp to borders
{
q = jointLimitLo;
}
if (q < jointLimitLo)
{
q = jointLimitLo;
}
if (q > jointLimitHi)
{
q = jointLimitHi;
if (q > jointLimitHi)
{
q = jointLimitHi;
}
}
}
......
......@@ -339,7 +339,10 @@ namespace VirtualRobot
*/
virtual void setJointValueNoUpdate(float q);
protected:
bool getEnforceJointLimits() const;
void setEnforceJointLimits(bool value);
protected:
/*!
Queries parent for global pose and updates visualization accordingly
*/
......@@ -370,6 +373,7 @@ namespace VirtualRobot
float jointValueOffset;
float jointLimitLo, jointLimitHi;
bool enforceJointLimits = true;
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment