Skip to content

Fix ee_inertia override writing invalid MJCF attribute "ipos" - #100

Open
addisonhammer wants to merge 1 commit into
i2rt-robotics:mainfrom
addisonhammer:fix-ee-inertia-pos
Open

addisonhammer wants to merge 1 commit into
i2rt-robotics:mainfrom
addisonhammer:fix-ee-inertia-pos

Conversation

@addisonhammer

Copy link
Copy Markdown

Fixes #99.

combine_arm_and_gripper_xml() wrote the ee_inertia center of mass as <inertial ipos="...">; MJCF's <inertial> uses pos, so any ee_inertia override failed at model construction with XML Error: Schema violation: unrecognized attribute: 'ipos'.

Changes

  • i2rt/robots/utils.py: write pos instead of ipos (one line).
  • test_combine_xml_with_custom_ee_mass_inertia: expect pos (and assert ipos is absent).
  • New test_custom_ee_inertia_compiles_in_mujoco: compiles the overridden model for every arm/gripper combo and checks the compiled gripper mass and body_ipos. The existing test only inspected XML text, which is how this slipped through.

Testing

  • Without the fix, the new and updated tests fail (60 failures, unrecognized attribute: 'ipos'); with it, test_assembly.py passes (151) and the full suite passes: uv run pytest -n auto → 710 passed, 2 skipped.
  • ruff check / ruff format --check clean on the changed files.
  • Used with the corrected attribute on physical YAM arms (linear-4310 + wrist camera payload) via get_yam_robot(..., ee_inertia=...).

🤖 Generated with Claude Code

https://claude.ai/code/session_01CvajU7exuGGR1wreVadnX1

combine_arm_and_gripper_xml() wrote the end-effector center of mass as
<inertial ipos="..."> but MJCF's <inertial> element names it "pos", so any
get_yam_robot(..., ee_inertia=...) call failed at model construction with
"XML Error: Schema violation: unrecognized attribute: 'ipos'".

Write "pos" instead, update the XML-level test to expect "pos", and add a
test that compiles the overridden model in MuJoCo and checks the resulting
gripper mass and center of mass for every arm/gripper combination (the
existing test only inspected XML text, so it could not catch this).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CvajU7exuGGR1wreVadnX1

This branch has not been deployed

No deployments
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.

ee_inertia override writes invalid MJCF attribute "ipos" (model fails to load)

1 participant