Skip to content

Bad Inertia Test (False Positive) #32

@guru-florida

Description

@guru-florida

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions