TwoLeg: a biped learning to walk in MuJoCo
Work in progress. The robot does not walk yet. This repo holds the training code, the eval gate, and the audit trail of every attempt.
Latest rollout
8 s rollout from run 2026-10-18_21-53-55, training step 94,208,000 (checkpoint step_94208000.pt), held command 0.3 m/s forward. The clip stays upright (torso 0.263-0.286 m) but advances only about 0.03 m, so it still does not walk.
Leg assembly this policy drives: hip, knee, and ankle servos per leg, generated from the reference CAD by training/scripts/generate_twoleg_model.py.
What counts as walking
training/scripts/verify_metrics.py returns WALKS only when one rollout satisfies all six, per environment:
- torso upright across the final 50-step window
- each foot loaded more than half the steps
- signed forward speed above 0.05 m/s
- stance transfers above 0.4 Hz
- knee bends more than 0.35 rad peak-to-peak
- hip swings more than 0.20 rad peak-to-peak
Speed is signed travel along each environment's own heading, so walking backwards fails. A missing or stale measurement file fails the loop instead of reading defaults.
What is here
training/src/twoleg_training/โ the mjlab velocity task, rewards, curriculum, and robot constantstraining/scripts/โverify_metrics.py(the gate),eval_walk.py(long-horizon signed travel),walk_loop.py(train-and-gate loop)training/tests/โ gate unit tests, including three failure shapes the old gate acceptedtraining/assets/twoleg.xmlโ the generated modelrobot_item/,twoleg_mjcf/โ reference CAD, renders, and assembly clips.audit/โ the decision trail
Reproduce the gate
uv run python training/scripts/verify_metrics.py \
--checkpoint <path/to/model.pt> --command 0.1 \
--steps 250 --envs 4 --device cuda:0
Exit 0 is WALKS, 1 is NO-WALK. The sidecar lands next to the checkpoint as verify_metrics_cmd0.10.json.
Source
Development happens at kenpeter/twoleg on GitHub. This repo is a snapshot.
