-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add export to urdf of joint dynamics: damping and static friction coefficients #1094
Conversation
Thanks a lot for this work! I want to comment a bit in depth in the PR, but before of that, it seems that there are a few memory-related error catched by the valgrind tests:
Can you check them? To get more informative errors, you can compile locally in Debug model and so you will get the line numbers related to this. |
@@ -59,7 +59,13 @@ class iDynTree::JointElement : public iDynTree::XMLElement { | |||
double velocity; | |||
}; | |||
|
|||
struct DyamicParams { |
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.
struct DyamicParams { | |
struct JointDynamicParams { |
Two changes:
- Fix typo
- Be more precise on which type of "Dynamics" is, as iDynTree is a "dynamics" library "dynamics" is quite an overloaded term.
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.
Fixed the name!
@mfussi66 sorry, I broke your branch with the commit mfussi66@8dfc3f9, but for some reason I couldn't easy create a PR out of it. However, it implements (in the interface) what we discuss, if you could modify the rest of the PR to be aligned it would be great, thanks! |
This is still not ready for review, but probably @francesco-romano may be interested in this. |
info.joint->setStaticFriction(0, m_dynamic_params->staticFriction); | ||
} else if (m_jointType == "revolute" || m_jointType == "prismatic") { | ||
std::string errStr = "Joint " + m_jointName + " misses the dynamics tag."; | ||
reportWarning("JointElement", "", errStr.c_str()); |
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.
The dynamics
element is optional in the URDF spec (see http://wiki.ros.org/urdf/XML/joint#Elements), so I guess we should not print a warning if it is not present in the URDF?
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.
Good point, I removed the warning.
@@ -405,7 +405,19 @@ bool exportJoint(IJointConstPtr joint, LinkConstPtr parentLink, LinkConstPtr chi | |||
xmlNewProp(limit_xml, BAD_CAST "velocity", BAD_CAST bufStr.c_str()); | |||
} | |||
|
|||
// TODO(traversaro) : handle friction | |||
if (joint->getJointDynamicsType() != NoJointDynamics && joint->getNrOfDOFs() == 1) |
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.
if (joint->getJointDynamicsType() != NoJointDynamics && joint->getNrOfDOFs() == 1) | |
if (joint->getJointDynamicsType() == URDFJointDynamics && joint->getNrOfDOFs() == 1) |
(Just to be safe in case a new joint dynamics type that does not use damping or static friction is added).
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.
Done 👍
@@ -59,14 +61,14 @@ class iDynTree::JointElement : public iDynTree::XMLElement { | |||
double velocity; | |||
}; | |||
|
|||
struct DyamicParams { | |||
uint8_t jointDynamicsType; | |||
struct JointDyamicsParams { |
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.
struct JointDyamicsParams { | |
struct JointDynamicsParams { |
Seems like there are errors related to fortran libraries: Matlab tests:
Debian tests:
Are they an issue for this PR? |
No, please ignore, thanks. |
@@ -221,6 +221,7 @@ void testFramesNotInTraversal() { | |||
|
|||
int main() | |||
{ | |||
// IDYNTREE_TESTS_URDFS_NR |
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.
// IDYNTREE_TESTS_URDFS_NR | |
// IDYNTREE_TESTS_URDFS_NR |
leftover?
Co-authored-by: Silvio Traversaro <silvio@traversaro.it>
Thanks @mfussi66 ! |
This PR aims to expand the Joints objects (Fixed, Revolute, Prismatic, IJoint) to support dynamic parameters present in URDF models.
These parameters are damping coefficient (N*s/m for prismatic and N*m*s/rad for revolute) and static friction coefficient (N for prismatic and N*m for revolute) .
The parameters can be imported from a urdf file or exported into one.
cc @traversaro @Nicogene