-
Notifications
You must be signed in to change notification settings - Fork 141
Extend parsing of acceleration, deceleration and jerk limits from limit
tag
#212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,6 +140,11 @@ bool parseJointLimits(JointLimits &jl, tinyxml2::XMLElement* config) | |
{ | ||
try { | ||
jl.effort = strToDouble(effort_str); | ||
if (jl.effort < 0.0) | ||
{ | ||
CONSOLE_BRIDGE_logError("effort value (%s) is negative", effort_str); | ||
return false; | ||
} | ||
} catch(std::runtime_error &) { | ||
CONSOLE_BRIDGE_logError("effort value (%s) is not a valid float", effort_str); | ||
return false; | ||
|
@@ -156,12 +161,80 @@ bool parseJointLimits(JointLimits &jl, tinyxml2::XMLElement* config) | |
{ | ||
try { | ||
jl.velocity = strToDouble(velocity_str); | ||
if (jl.velocity < 0.0) | ||
{ | ||
CONSOLE_BRIDGE_logError("velocity value (%s) is negative", velocity_str); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say that it would help parsing the error logs to say There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure |
||
return false; | ||
} | ||
} catch(std::runtime_error &) { | ||
CONSOLE_BRIDGE_logError("velocity value (%s) is not a valid float", velocity_str); | ||
return false; | ||
} | ||
} | ||
|
||
// Get joint acceleration limit | ||
const char* acceleration_str = config->Attribute("acceleration"); | ||
if (acceleration_str == NULL){ | ||
CONSOLE_BRIDGE_logDebug("urdfdom.joint_limit: no acceleration, using default value"); | ||
jl.acceleration = std::numeric_limits<double>::infinity(); | ||
} | ||
else | ||
{ | ||
try { | ||
jl.acceleration = strToDouble(acceleration_str); | ||
if (jl.acceleration < 0.0) | ||
{ | ||
CONSOLE_BRIDGE_logError("acceleration value (%s) is negative", velocity_str); | ||
return false; | ||
} | ||
} catch(std::runtime_error &) { | ||
CONSOLE_BRIDGE_logError("acceleration value (%s) is not a valid float", acceleration_str); | ||
return false; | ||
} | ||
} | ||
|
||
// Get joint deceleration limit | ||
const char* deceleration_str = config->Attribute("deceleration"); | ||
if (deceleration_str == NULL){ | ||
CONSOLE_BRIDGE_logDebug("urdfdom.joint_limit: no deceleration, using acceleration limit"); | ||
jl.deceleration = jl.acceleration; | ||
} | ||
else | ||
{ | ||
try { | ||
jl.deceleration = strToDouble(deceleration_str); | ||
if (jl.deceleration < 0.0) | ||
{ | ||
CONSOLE_BRIDGE_logError("deceleration value (%s) is negative", deceleration_str); | ||
return false; | ||
} | ||
} catch(std::runtime_error &) { | ||
CONSOLE_BRIDGE_logError("deceleration value (%s) is not a valid float", deceleration_str); | ||
return false; | ||
} | ||
} | ||
|
||
// Get joint jerk limit | ||
const char* jerk_str = config->Attribute("jerk"); | ||
if (jerk_str == NULL){ | ||
CONSOLE_BRIDGE_logDebug("urdfdom.joint_limit: no jerk, using default value"); | ||
jl.jerk = std::numeric_limits<double>::infinity(); | ||
} | ||
else | ||
{ | ||
try { | ||
jl.jerk = strToDouble(jerk_str); | ||
if(jl.jerk < 0.0) | ||
{ | ||
CONSOLE_BRIDGE_logError("jerk value (%s) is negative", jerk_str); | ||
return false; | ||
} | ||
} catch(std::runtime_error &) { | ||
CONSOLE_BRIDGE_logError("jerk value (%s) is not a valid float", jerk_str); | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -197,6 +197,9 @@ | |||||||||
<xs:attribute name="upper" type="xs:double" default="0" /> | ||||||||||
<xs:attribute name="effort" type="xs:double" default="0" /> | ||||||||||
<xs:attribute name="velocity" type="xs:double" default="0" /> | ||||||||||
<xs:attribute name="acceleration" type="xs:double" default="INF" /> | ||||||||||
<xs:attribute name="decceleration" type="xs:double" default="INF" /> | ||||||||||
<xs:attribute name="decceleration" type="xs:double" default="INF" /> | ||||||||||
Comment on lines
+201
to
+202
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the second
Suggested change
EDIT: After further reviewing my comment, I realized deceleration ( |
||||||||||
</xs:complexType> | ||||||||||
|
||||||||||
<!-- safety controller node type --> | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a value of zero valid for velocity, acceleration, and jerk limits? Seems to only make sense as a backward way of disabling the joint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, by default the velocity limit is set to zero, that's the reason I'm only checking for the negative values