Skip to content

Conversation

@Giulero
Copy link
Collaborator

@Giulero Giulero commented Nov 21, 2025

This pull request adds support for the INERTIAL_FIXED_REPRESENTATION frame velocity representation throughout the rigid body dynamics algorithms.

Support for INERTIAL_FIXED_REPRESENTATION in core algorithms:

  • Added INERTIAL_FIXED_REPRESENTATION to the Representations enum in constants.py.
  • Updated all major rigid body dynamics methods (block_index, jacobian, relative_jacobian, jacobian_dot, CoM_jacobian, rnea, aba, and related helper logic) in rbd_algorithms.py to implement logic for the inertial-fixed representation, including appropriate transformations, Jacobians, and derivatives. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Test infrastructure updates:

  • Included INERTIAL_FIXED_REPRESENTATION in the list of velocity representations tested in conftest.py, ensuring coverage in all relevant robot configurations.
  • Updated test setup to handle the new representation when configuring the test robot's kinematics and dynamics.

📚 Documentation preview 📚: https://adam-docs--144.org.readthedocs.build/en/144/

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the INERTIAL_FIXED_REPRESENTATION frame velocity representation to the rigid body dynamics algorithms in the ADAM library. This expands the library's capability to handle a third type of velocity representation alongside the existing body-fixed and mixed representations.

Key changes include:

  • Added INERTIAL_FIXED_REPRESENTATION to the Representations enum
  • Implemented transformation logic across all core RBD algorithms (CRBA, Jacobian computations, RNEA, ABA) to properly handle the inertial-fixed frame
  • Updated test infrastructure to include the new representation in test configurations

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/adam/core/constants.py Added INERTIAL_FIXED_REPRESENTATION enum value to support the new frame representation type
src/adam/core/rbd_algorithms.py Implemented inertial-fixed representation logic across all major algorithms including appropriate adjoint transformations, Jacobians, and dynamics computations
tests/conftest.py Extended test configuration to include INERTIAL_FIXED_REPRESENTATION in velocity representation test cases and added mapping to iDynTree representation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Giulero Giulero requested a review from traversaro November 21, 2025 14:35
Comment on lines 635 to 737
B_X_BI = math.factory.eye(batch_shape + (6,))
B_X_I = math.factory.eye(batch_shape + (6,))
transformed_acc = math.factory.zeros(batch_shape + (6,))
elif self.frame_velocity_representation == Representations.MIXED_REPRESENTATION:
B_X_BI = math.adjoint_mixed_inverse(base_transform)
B_X_I = math.adjoint_mixed_inverse(base_transform)
omega = base_velocity[..., 3:]
vlin = base_velocity[..., :3]
skew_omega_times_vlin = math.mxv(math.skew(omega), vlin)
top3 = -math.mxv(B_X_BI[..., :3, :3], skew_omega_times_vlin)
top3 = -math.mxv(B_X_I[..., :3, :3], skew_omega_times_vlin)
bot3 = math.factory.zeros(batch_shape + (3,))
transformed_acc = math.concatenate([top3, bot3], axis=-1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes in the non-inertial fixed code path intentional?

Copy link
Collaborator Author

@Giulero Giulero Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! Before everything was written in mixed (e.g. B_X_BI), also for body fixed and I wanted to make it more generic.
But now, thinking twice, I could define a generic frame C and specify in a comment to which frame I'm referring to (e.g. C = B[I]).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in aac1bcb!

Copy link
Contributor

@traversaro traversaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor comment.

@Giulero Giulero requested a review from traversaro November 26, 2025 11:37
@Giulero
Copy link
Collaborator Author

Giulero commented Nov 26, 2025

Thanks @traversaro! Merging.

@Giulero Giulero merged commit 03dcbdf into main Nov 26, 2025
13 checks passed
@Giulero Giulero deleted the add-inertial-repr branch November 26, 2025 13:24
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.

3 participants