kdl_parser
kdl_parser copied to clipboard
Bad Inertia Test (False Positive)
Take a closer look at the code for this test: https://github.com/ros/kdl_parser/blob/melodic-devel/kdl_parser/test/test_inertia_rpy.cpp
Torques output arrays are zero-size Test does not properly size the torques_1 or torques_2 JntArrays. Therefor solver.CartToJnt(...) call actually returns -4 (E_SIZE_MISMATCH) because the first thing CartToJnt() method does is check that all the JntArray have the same size (matching number of joints). Unfortunately, the error value from CartToJnt() is not captured or checked/asserted.
False Positive This test passes because the two torques_1 and 2 arrays are black (0 elements) and therefor are still considered equal but the CartToJnt() method is not actually tested.
Recommendations:
- Before the CartToJnt() call, add torques_1.resize(chain.getNrOfJoints())
- Also Wrap the solver.CartToJnt() call in an ASSERT() checking that it returns KDL::SolverI::E_NOERROR
- perhaps also ensure that at least 1 torques_ array is non-zero?
For reference, CartToJnt() method code: http://docs.ros.org/jade/api/orocos_kdl/html/chainidsolver__recursive__newton__euler_8cpp_source.html
Thanks!
I know we are approaching a year since this was opened, so sorry about that. If you'd be willing to open a pull request to fix the test as you think it should be, we can iterate there. Thanks for opening this issue.
Sure, I can do that. I have some other tickets to attend to first but I will schedule this out.
Feel free to assign this to me.