Skip to content

Latest commit

 

History

History
87 lines (67 loc) · 5.06 KB

README.md

File metadata and controls

87 lines (67 loc) · 5.06 KB

MyoSuite Tutorials

pip install jupyter ipykernel
python -m ipykernel install --user --name=myosuite
# video playback in notebooks: conda install conda-forge::ffmpeg  (or brew install ffmpeg)

On Colab, opening a notebook from GitHub does not install the package. Add an install cell (for example !pip install -U myosuite), or install locally:

# from a clone
pip install -e .
# or, if you only have the notebook
pip install git+https://github.com/MyoHub/myosuite.git

Then build an env with the public API (importing myosuite registers every env id):

from myosuite import make_env

env = make_env("myoElbowPose1D6MRandom-v0")

Tutorials by track

Notebooks are numbered <track>.<number>_Name.ipynb. Within a track they go from simple to advanced; extra files of notebook X.Y live in files/X.Y/.

# Notebook Needs
1 — Basics
1.1 Get Started pip install -e .
1.2 Load Policy — run a policy in a video rollout: your own mjlab/SB3 checkpoint, else the default policy from the Hugging Face baselines (myohub/myosuite-3-baselines; random policy if none is found) nothing (optional: a checkpoint from 2.1 or 2.2)
2 — Training
2.1 Train SB3 Policy — PPO on CPU pip install -e ".[rl]"
2.2 Train MjLab Policy — thousands of parallel envs on GPU, playback on CPU NVIDIA GPU (Linux or Windows), pip install -e ".[mjlab]"
2.3 SAR — synergistic action representations pip install -e ".[rl]" (full training is hours; set MYOSUITE_FULL_SAR=1)
2.4 MyoReflex Walk — reflex-based walking baseline —
3 — Analysis
3.1 Analyse Movements — kinematics and synergies pip install stable-baselines3 scikit-learn
3.2 Inverse Kinematics pip install "myosuite[examples]" (mink)
3.3 Inverse Dynamics osqp
3.4 Computed Muscle Control —
3.5 Playback Mot File — OpenSim .mot playback —
4 — Modelling and conditions
4.1 Move Hand Fingers —
4.2 Fatigue Modeling —
4.3 Modular Task Config — experimental; prefer the TaskSpec / ModelBuilder workflow (docs/wiki/adding-a-new-task.md) —
5 — MuscleMimic
5.1 Fullbody Load Policy integration README
5.2 Fullbody Train Policy — CPU PPO and ghost-body rendering as 5.1
5.3 Fullbody Train MjLab Policy — GPU backend (Colab T4); the bimanual clips on Hugging Face are gated, request access first CUDA
5.4 MuscleMimic Directional Locomotion (Colab) —
5.5 MuscleMimic SAR as 5.1

Defaults that keep the notebooks quick: 3.3 and 3.4 use the first 80 trajectory frames (set FULL_ID = True for the full CSV); 5.2 trains 256 PPO steps (MYOSUITE_FULL_MIMIC=1 for the 50k demo); 5.3 skips Warp env creation on macOS / CPU; 5.4 stays in QUICK_MODE unless MYOSUITE_FULL_BC=1.

Rendering

Use render_mode="rgb_array" and env.render(). Models without a named camera (elbow) use the free camera (camera_id=-1). Hand actuators use a _r suffix (FDP2_r, EDC2_r).

Headless video on Linux often needs MUJOCO_GL=egl; on macOS use MUJOCO_GL=glfw (the default if unset in the SAR helpers).

Models

The models come from the myo-sim package, which MyoSuite pins to 0.2.3 on PyPI and installs automatically. A plain pip install myosuite or pip install -e . therefore gives the same XML assets the notebooks use; no extra install step is needed. The few MPL, YCB and furniture assets are bundled in myosuite/envs/myo/assets/.

The .[dev] extra is only for development (tests and linters), not for models. Do not install a different myo-sim version unless you intend to retrain: the baseline policies in the tutorials are tied to 0.2.3.

Inverse kinematics

python tutorials/files/3.2/inverse_kinematics.py --no-viewer
# interactive (macOS): mjpython tutorials/files/3.2/inverse_kinematics.py

SAR full training (notebook 2.3) is hours of SB3. The notebook skips those cells unless MYOSUITE_FULL_SAR=1. Precomputed-SAR cells still run. Check the install with:

python tutorials/files/2.3/run_sar_full.py --help
python tutorials/files/2.3/run_sar_full.py --dry-run