Skip to content

Fix COM frame composition in mjCBody::AccumulateInertia#3250

Open
gholmes829 wants to merge 1 commit intogoogle-deepmind:mainfrom
gholmes829:fix/accumulate-inertia-com-frame-order
Open

Fix COM frame composition in mjCBody::AccumulateInertia#3250
gholmes829 wants to merge 1 commit intogoogle-deepmind:mainfrom
gholmes829:fix/accumulate-inertia-com-frame-order

Conversation

@gholmes829
Copy link
Copy Markdown

@gholmes829 gholmes829 commented Apr 29, 2026

mjCBody::AccumulateInertia calls mjuu_frameaccum with the body pose and inertial offset arguments swapped, composing body_ipose ∘ body_pose instead of the documented body_pose ∘ body_ipose. The merged center-of-mass is wrong whenever the body pose and inertial offset don't commute as transforms.

Most commonly triggered by URDF fixed-joint children with degenerate-eigenvalue inertia (typical of capsule/cylinder approximations), where mjuu_fullInertia returns a non-trivial principal-axes rotation.

Distinct from #2982, which patched the inertia-tensor rotation in the same function. #2982's reproduction (child with pos = 0) collapses both arg orders to the same answer, so it could not have caught this.

Added test fails before the fix with merged body_ipos = (0, 0, 0.5) and passes after with (0.5, 0, 0).

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.

2 participants