Risk-Aware Walking for the Unitree G1

A planning layer for a pretrained humanoid walking policy: a 3D risk map that knows which obstacles matter and at what height, MPPI that compares the robot and a moving person at the same future time, and a side-step mode for gaps narrower than the robot's shoulders. The walking policy itself is never retrained.

MuJoCo, 2× speed. The opening (0.33–0.36 m) is narrower than the G1's shoulders (0.37 m) and wider than its depth (0.23 m): the robot detects it in its risk map, turns sideways, slides through, and turns back.

18 → 3/ 30

contacts with a person crossing the path, after replacing a smeared prediction with a spatio-temporal cost; falls 3 → 0

0/ 20

collisions with a chest-height shelf on both ground-truth and camera-built maps; 2D LiDAR-slice and Nav2-style planners hit it 1/20 on the ground-truth map

20/ 20

clean passes through a gap narrower than the robot's shoulders, where a circular-footprint MPPI passes 0/20

How it works

SenseGround-truth obstacles, or a virtual D435i head depth camera into a voxel map with unknown-space risk and a person tracker
3D risk mapSeverity × Gaussian of distance at four body heights, plus a collision core; exact 3D distance transform per class
4D MPPI256 rollouts × 3 s; people evaluated at their predicted position at each rollout time; heading and forward-walking costs; 4 ms per plan
WalkVelocity commands to the unchanged pretrained G1 policy (unitree_rl_gym) in MuJoCo; a rule-based side-step mode for narrow gaps

Highlights

Passing behind a crossing personSame seed, the smeared-prediction planner slows on the crossing line, is hit and falls; the 4D cost keeps 0.44 m.
Planning from what the camera sawHead depth with noise and holes, and the perceived risk map from above: the chest-height shelf is avoided at 0.46 m.

What I did

  • Designed and implemented the risk map, MPPI planner, spatio-temporal person cost, narrow-gap controller and camera-map pipeline (Python, numpy, OpenCV, MuJoCo).
  • Measured the robot instead of assuming it: body outlines from collision meshes, command-tracking gains, lateral sway, and the joint dynamics missing from the 29-dof model.
  • Ran 1,000+ closed-loop episodes with parameters frozen and hashed before each batch; kept superseded versions and negative results, such as prediction smearing making contacts worse than no prediction.
  • Traced failures to causes with evidence: flying-pixel phantom obstacles, a position-only goal causing backward walking, and forearm contacts outside the planner's footprint.

Stack and limits

MuJoCo 3.14MPPInumpyOpenCVPyTorch (policy inference)Voxel mapping3D EDTUnitree G1unitree_rl_gymmujoco-realsensor

Simulation only. Labels come from segmentation and drift is a model, not SLAM; severities are hand-set; the crossing person is kinematic. Camera-based person avoidance and a real robot are the next steps.