Skip to content

Fix frame inconsistencies in pinocchio plugin#304

Open
justagist wants to merge 3 commits into
ros-controls:masterfrom
justagist:fix/frame-diff-bug
Open

Fix frame inconsistencies in pinocchio plugin#304
justagist wants to merge 3 commits into
ros-controls:masterfrom
justagist:fix/frame-diff-bug

Conversation

@justagist

@justagist justagist commented Jun 19, 2026

Copy link
Copy Markdown

Description

This PR fixes some frame consistency issues (wrt KDL implementation) in my original implementation of the pinocchio plugin.
Primarily, this addresses:

  1. The calculate_frame_difference was computing the angular term different to how KDL does it, which would break any controllers that use this and expects the same behviour as the KDL plugin.
  2. Jacobian was being computed in the wrong frame whenever a custom "base" (if rotated wrt universe) is selected. This could result in getting a different output when compared to the KDL version for all jacobian-based APIs. I see that this issue was raised in KDL and pinocchio use different reference frames for jacobian calculation result #256 and was attempted to address in Fix #256: Change pinocchio jacobian frame from LOCAL to LOCAL_WORLD_ALIGNED to match KDL #257, but the PR is now stale and also was not a full fix for the issue.

Fixes #256

Is this user-facing behavior change?

Downstream code that compensated for the previous (incorrect) universe- /
local-frame behaviour will need to be updated. After this change the Pinocchio plugin
matches the KDL plugin, which is the documented and intended behaviour.

Did you use Generative AI?

Yes, Claude Code (Sonnet 4.6) was used for creating unit tests.

Additional Information

New tests created:

  • **Frame difference testing** (added to the shared kinematics_interface_common_tests.hpp, so every plugin is checked): expects the angular velocity about +yin the base frame. Pre-fix Pinocchio returns it about+x` and fails; KDL passes.
  • Pinocchio-KDL frame consistency tests: test_pinocchio_kdl_frame_consistency.cpp created to make sure the results from pinocchio plugin matches KDL (used as oracle) when using default or custom base.

TODOs

To send us a pull request, please:

  • Fork the repository.
  • Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
  • Ensure local tests pass. (colcon test and pre-commit run (requires you to install pre-commit by pip3 install pre-commit)
  • Commit to your fork using clear commit messages.
  • Send a pull request, answering any default questions in the pull request interface.
  • Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KDL and pinocchio use different reference frames for jacobian calculation result

1 participant