Skip to content

Add torque-driven actuation (per-part, mixable with muscles)#107

Draft
Vittorio-Caggiano wants to merge 4 commits into
mm_refactor_mjspecfrom
feat/torque-actuation
Draft

Add torque-driven actuation (per-part, mixable with muscles)#107
Vittorio-Caggiano wants to merge 4 commits into
mm_refactor_mjspecfrom
feat/torque-actuation

Conversation

@Vittorio-Caggiano

Copy link
Copy Markdown
Contributor

Summary

  • Adds myo<part>_torque.xml actuator files for leg, arm, and torso — one direct joint <general> motor per independently-actuated DOF (excludes joints driven by polynomial <equality> constraints), modeled on MyoHub/myosuite's torque branch myoskeleton (mot_* motors, matching gear/forcerange where joint names line up, e.g. legs).
  • build_model(name, actuation=...) now accepts None (muscle default), a single string ("torque" applied to every part), or a per-part dict ({"torso": "torque", "arms": "torque", "legs": "muscle"}) — no new BuildStrategy/registry entries needed, since actuation is resolved per part inside the existing builder functions.
  • Mirroring (build_mirrored_child_xml) works unchanged for torque motors since <general> joint actuators have no sites/tendons to mirror.
  • examples/torque_actuation.py demonstrates a fully muscle-driven, fully torque-driven, and mixed (torque torso+arms / muscle legs) myofullbody build.
  • New tests/test_torque_actuation.py checks actuator counts for torque-only and mixed builds.
  • Wiki: new "Torque-driven actuation" section in docs/wiki/build-and-composition.md, updated repository-map.md, logged in docs/wiki/log.md.

Notes / follow-ups

  • Gear/forcerange values for leg DOFs are copied from myosuite's torque-branch myoskeleton (identical OpenSim joint names). Arm and torso values are estimated placeholders (no equivalent joint parameterization upstream) and should be tuned against task-specific RL runs.
  • Hand-only (myohand_r, myohands) and abdomen-only (myotorso_abdomen) builds don't have torque files yet; their builders accept the actuation argument for a uniform dispatch signature but ignore it.

Test plan

  • uv run pytest tests/ -x -n auto --ignore=tests/test_equivalence.py — 87 passed (84 existing + 3 new)
  • uv run python examples/torque_actuation.py — builds muscle/torque/mixed myofullbody, prints nu=416/71/137
  • uv run python -m myo_sim.build.compose --model myofullbody --actuation torque
  • uv run python -m myo_sim.build.compose --model myofullbody --actuation arms=torque --actuation legs=muscle

Vittorio-Caggiano and others added 3 commits June 17, 2026 09:31
Added a conditional import for musclemimic_models in the test_equivalence.py file to ensure that tests can run without errors if the module is not available. This change enhances test robustness by skipping tests that depend on the musclemimic_models package when it is not installed.
Add myo<part>_torque.xml actuator files (leg, arm, torso) with one direct
joint motor per independently-actuated DOF, modeled on MyoHub/myosuite's
torque-branch myoskeleton. build_model() gains an `actuation` argument
(None | "torque" | per-part dict) so any registered model can be built
fully muscle-driven, fully torque-driven, or mixed (e.g. torque torso/arms
with muscle legs) without new BuildStrategy/registry entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Enhance arm and torso model building functions to include a `disable_fingers` parameter, allowing for the removal of finger joints and actuators. This change is implemented in `compose.py` and `hand.py`, with corresponding updates to model loading functions. Additionally, new tests are added to verify the correct behavior of the `disable_fingers` feature and ensure it is not applicable to hand-only models.
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