-
Notifications
You must be signed in to change notification settings - Fork 104
Fix bug in importing com if inertia frame orientation and link frame orientation are different #66
Conversation
@hsu ? |
This is a pretty core change, I'm happy to merge it, but can we add a test? |
For sure. I am quite busy at a moment, but I guess I can provide a test in the next month. |
pinging @traversaro: any interest in revisiting this? I can spend a bit of time writing a test case if you're busy, so that we can fast-track this to getting merged. |
@jacquelinekay if you could write a test it would be great, given that I don't have access to a ROS installation and so it would take me a bit of time to set up one. The test I was thinking about was something like this:
and
The only difference between the two models is the rpy of the However due to the bug that this PR solves, if you follow this steps:
|
I'm working on the test, but I'm running into an unrelated issue where I can't call |
I never had this problem, but to be honest I forked this code 2 years ago (to avoid the catkin/ROS/everything else dependency) and apparently I modified the |
Got it. I have a workaround right now (allocate the trees on the heap and call delete manually) that works without using the current urdfdom from source. But, maybe we can gain insight from your fork to improve this copy of The test is written: https://github.com/ros/robot_model/tree/fix-com-import/kdl_parser but I still can't run it because kdl_parser is quite broken, it thinks that KDL tree generated from that URDF has 0 joints and 0 segments. |
I am sorry. : ( |
I figured out the issue with kdl_parser and I've pull requested this commit and my test case in #117. Thanks again. |
The fix and test are merged from my other branch. Thanks for contributing, @traversaro! |
The URDF specification ( http://wiki.ros.org/urdf/XML/link ) specify that the center of mass is expressed in the link reference frame (as xyz of the origin element) while the inertia matrix is expressed in the "inertia reference frame" given by the origin element.
The current version of the parser is flawed because it rotates both the com and the inertia matrix, while only the inertia matrix should be rotated. I guess this went unnoticed because the large majority or URDF models uses an identity (rpy="0 0 0") for the rotational part of the "inertial" origin element.