Add torque-driven actuation (per-part, mixable with muscles)#107
Draft
Vittorio-Caggiano wants to merge 4 commits into
Draft
Add torque-driven actuation (per-part, mixable with muscles)#107Vittorio-Caggiano wants to merge 4 commits into
Vittorio-Caggiano wants to merge 4 commits into
Conversation
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.
…into mm_refactor_mjspec
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
myo<part>_torque.xmlactuator 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'storquebranch myoskeleton (mot_*motors, matching gear/forcerange where joint names line up, e.g. legs).build_model(name, actuation=...)now acceptsNone(muscle default), a single string ("torque"applied to every part), or a per-part dict ({"torso": "torque", "arms": "torque", "legs": "muscle"}) — no newBuildStrategy/registry entries needed, since actuation is resolved per part inside the existing builder functions.build_mirrored_child_xml) works unchanged for torque motors since<general>joint actuators have no sites/tendons to mirror.examples/torque_actuation.pydemonstrates a fully muscle-driven, fully torque-driven, and mixed (torque torso+arms / muscle legs)myofullbodybuild.tests/test_torque_actuation.pychecks actuator counts for torque-only and mixed builds.docs/wiki/build-and-composition.md, updatedrepository-map.md, logged indocs/wiki/log.md.Notes / follow-ups
myohand_r,myohands) and abdomen-only (myotorso_abdomen) builds don't have torque files yet; their builders accept theactuationargument 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/mixedmyofullbody, prints nu=416/71/137uv run python -m myo_sim.build.compose --model myofullbody --actuation torqueuv run python -m myo_sim.build.compose --model myofullbody --actuation arms=torque --actuation legs=muscle