Skip to content

mujoco: support non-contiguous actuated DOFs - #197

Open
ahoereth wants to merge 1 commit into
amazon-far:mainfrom
ahoereth:fix/mujoco-noncontiguous-dofs
Open

ahoereth wants to merge 1 commit into
amazon-far:mainfrom
ahoereth:fix/mujoco-noncontiguous-dofs

Conversation

@ahoereth

@ahoereth ahoereth commented Aug 31, 2026 •

Copy link
Copy Markdown

Issue #, if available:

N/A

Description of changes:

MuJoCo models can contain passive joints interleaved with actuated joints. Holosoma currently treats every named non-free robot joint as a public DOF and represents the resulting state using contiguous slices. This can include passive joints in the public state tensors and cause their shape and ordering to differ from robot_config.dof_names.

This aligns MuJoCo’s public DOF selection with Isaac Sim, which resolves and indexes only the joints listed in robot_config.dof_names.

This change:

  • selects public DOFs using robot_config.dof_names, excluding passive model joints;
  • validates that the configured DOF ordering matches the model ordering;
  • preserves the existing zero-copy path for contiguous layouts;
  • gathers only configured joints when their MuJoCo qpos/qvel addresses are non-contiguous;
  • refreshes filtered state after simulation updates and explicit DOF writes;
  • adds a minimal actuated → passive → actuated MJCF regression covering passive-joint exclusion and state preservation;
  • covers both proxy-backed Classic storage and tensor-backed storage used by Warp.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ahoereth
ahoereth marked this pull request as ready for review August 31, 2026 07:08
@ahoereth

ahoereth commented Aug 31, 2026 •

Copy link
Copy Markdown
Author

Additional context:

Isaac Sim already supports this contract for articulations containing additional joints. It resolves only the configured joints with find_joints(..., preserve_order=True) and consistently uses the resulting joint IDs for:

This allows passive or otherwise unconfigured joints to remain in the articulation without appearing in Holosoma's public DOF tensors.

MuJoCo currently differs in two ways:

  1. every named non-free robot joint is treated as a public DOF, including passive joints not present in robot_config.dof_names;
  2. the selected qpos/qvel addresses are converted into a single min..max slice, which also includes any passive joints interleaved between configured joints.

As a result, valid MuJoCo models containing linkage, pulley, or other passive joints can produce public state tensors with the wrong shape and ordering.

This PR brings MuJoCo closer to the existing Isaac Sim behavior.

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.

1 participant