Skip to content

refactor(mujoco): drive each arm through a SimArm built from the robot profile - #328

Open
maxxgx wants to merge 2 commits into
max/mujoco-menagerie-so101from
max/mujoco-robot-profiles
Open

maxxgx wants to merge 2 commits into
max/mujoco-menagerie-so101from
max/mujoco-robot-profiles

Conversation

@maxxgx

@maxxgx maxxgx commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #312. Prepares the MuJoCo plugin for robots other than the SO-101. The simulation behaves exactly as before.

Changes

  • RobotProfile is the single source of an arm's joints, ranges, gripper, wrist camera and autopilot kinematics.
  • A new SimArm drives one arm under a name prefix. MuJoCoSO101 uses one, BiMuJoCoSO101 two, with no hardcoded SO-101 joint or camera names.
  • The Studio probe now checks the owner's joint names, so the single-arm entry no longer attaches to a bimanual simulation (and vice versa).
  • Removed duplicate constants (JOINT_LIMITS_DEG, NUM_JOINTS, BIMANUAL_NUM_JOINTS); nothing outside the plugin used them.

Validation

Next: add Trossen WidowX AI (trossen_wxai) as a second profile.

@maxxgx
maxxgx requested review from a team as code owners October 2, 2026 15:25
@maxxgx
maxxgx added this pull request to stack #313 October 2, 2026 15:25
maxxgx and others added 2 commits October 2, 2026 17:31
…t profile

The robot profile is now the single source of an arm's joint names, gripper,
wrist camera and autopilot kinematics. Each arm is a SimArm, a profile under a
mount prefix, which resolves its joints and actuators after every compile,
reads state, writes targets, converts units and homes. MuJoCoSO101 holds one
arm and BiMuJoCoSO101 two; their joint order and wrist camera names follow
from the profile and prefixes instead of hardcoded SO-101 lists.

Remove constants that duplicated the profile (JOINT_LIMITS_DEG, NUM_JOINTS,
BIMANUAL_NUM_JOINTS). The unit helpers move to sim_arm and take a gripper
mask instead of guessing the gripper from joint names.

Observations, actions, autopilot and homing are bit-identical to before on
every scene in both units.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry's joints

Studio's single-arm and bimanual MuJoCo followers shared one probe that only
checked that the owner name answered, so either entry could attach to the
other's simulation and fail on its first action. Each entry now probes for its
own joint order and logs the mismatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maxxgx
maxxgx force-pushed the max/mujoco-robot-profiles branch from e2919be to 2450462 Compare October 2, 2026 15:31
Copilot AI balanced review requested due to automatic review settings October 2, 2026 15:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Profile-driven behavior remains incomplete in model loading and conveyor automation.

Review effort: Balanced
Findings: 3 Medium severity

Open (3)
What changed in this PR

Refactors SO-101 simulation around profile-based arms, preparing the MuJoCo plugin for other robots while tightening Studio discovery.

Changes:

  • Adds SimArm for joint binding, state, actions, units and homing.
  • Moves kinematics and camera naming into profile-driven paths.
  • Adds stricter joint-layout probes, regression tests and documentation.
File Description
packages/​physicalai-mujoco-so101-plugin/​tests/​test_studio_catalog.py Tests joint-aware probes.
packages/​physicalai-mujoco-so101-plugin/​tests/​test_sim_arm.py Tests arm binding and operations.
packages/​physicalai-mujoco-so101-plugin/​tests/​test_scene_models.py Updates scene compatibility checks.
packages/​physicalai-mujoco-so101-plugin/​tests/​test_robot_profile.py Checks profile-derived layouts.
packages/​physicalai-mujoco-so101-plugin/​tests/​test_mujoco_robot.py Updates unit-conversion tests.
packages/​physicalai-mujoco-so101-plugin/​tests/​test_main.py Checks arm-derived camera streams.
packages/​physicalai-mujoco-so101-plugin/​src/​physicalai_mujoco_so101_plugin/​studio_catalog.py Validates owner joint layouts.
packages/​physicalai-mujoco-so101-plugin/​src/​physicalai_mujoco_so101_plugin/​sim_arm.py Introduces per-arm simulation handling.
packages/​physicalai-mujoco-so101-plugin/​src/​physicalai_mujoco_so101_plugin/​robot_profile.py Adds gripper and kinematics metadata.
packages/​physicalai-mujoco-so101-plugin/​src/​physicalai_mujoco_so101_plugin/​mujoco_robot.py Delegates joint operations to arms.
packages/​physicalai-mujoco-so101-plugin/​src/​physicalai_mujoco_so101_plugin/​conveyor_demo.py Accepts profile-defined kinematics.
packages/​physicalai-mujoco-so101-plugin/​src/​physicalai_mujoco_so101_plugin/​constants.py Removes duplicated layout constants.
packages/​physicalai-mujoco-so101-plugin/​src/​physicalai_mujoco_so101_plugin/​__main__.py Derives cameras from robot arms.
packages/​physicalai-mujoco-so101-plugin/​README.md Documents profile-based arms.
packages/​physicalai-mujoco-so101-plugin/​CHANGELOG.md Records refactor and probe changes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

model: object,
conveyor: ConveyorSort,
config: DemoConfig | None = None,
profile: RobotProfile = SO101_PROFILE,
self.conveyor = conveyor
self.config = config or DemoConfig()
self.ik = ArmIK(model)
self.ik = ArmIK(model, profile.kinematics)
"""Validate and adopt the joint unit.
"""Validate the joint unit and build the unbound arms that use it."""
self._unit: JointUnit = validate_joint_unit(unit)
self._arms: tuple[SimArm, ...] = tuple(SimArm(self.PROFILE, prefix, self._unit) for prefix in self.ARM_PREFIXES)

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.

2 participants