File size: 2,415 Bytes
3f7e4b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170b850
3f7e4b4
 
 
170b850
3f7e4b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
tags:
- mujoco
- reinforcement-learning
- robotics
- humanoid
- bipedal-locomotion
---

# 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

<video width="480" height="360" controls>
  <source src="https://huggingface.co/kenpeter123/twoleg/resolve/main/walk_latest.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

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 CAD render](leg.png)

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 constants
- `training/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 accepted
- `training/assets/twoleg.xml` — the generated model
- `robot_item/`, `twoleg_mjcf/` — reference CAD, renders, and assembly clips
- `.audit/` — the decision trail

## Reproduce the gate

```bash
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](https://github.com/kenpeter/twoleg) on GitHub. This repo is a snapshot.