Risk-Aware Walking for a Humanoid on a Pretrained Policy: 3D Risk Maps, Spatio-Temporal MPPI and Narrow-Gap Side-Stepping
Abstract
We replace only the planning layer above a pretrained, velocity-commanded humanoid walking policy and leave the policy untouched. The layer builds a dense 3D risk grid in which each obstacle contributes a severity-weighted Gaussian of its distance at every body height, plus a severity-independent collision core, and plans with sampling-based MPPI. Three additions matter in the experiments: (i) height-aware risk avoids a chest-height overhang that 2D methods hit (0/20 vs 1/20 collisions); (ii) evaluating moving people at their predicted position at each rollout time instead of smearing their future path into the map cuts person contacts from 18/30 to 3/30 and falls from 3 to 0, and to 0/30 when the person yields; (iii) a rule-based narrow-gap mode side-steps a 0.33–0.36 m opening 20/20 where plain MPPI never finds the centimetre-level alignment. The risk grid can also be built from a noisy virtual depth camera with a voxel map and unknown-space risk, matching the ground-truth map on the overhang task. All results come from frozen-parameter batch evaluations (1,000+ episodes); negative results and superseded versions are reported.
1. Introduction
Learned locomotion policies for humanoids now walk robustly when commanded a body velocity, so the open problem for deployment is the layer that decides where and how fast to walk. Common navigation stacks inherit a 2D occupancy costmap from wheeled robots: every obstacle is equally dangerous, overhangs are invisible to a LiDAR slice, and moving people are either ignored or inflated. This work asks how much a humanoid gains from three changes to that layer, measured in closed loop on a real pretrained policy in physics simulation.
Contributions.
- A dense 3D risk grid with per-obstacle severity and a collision core, queried at four body heights by MPPI (numpy, 4 ms per plan).
- A spatio-temporal ("4D") person cost and a demonstration that the common alternative — smearing predicted positions into one map — is worse than no prediction.
- A narrow-gap side-step mode for a humanoid whose depth is smaller than its width, and the measured body and tracking models it needs.
- A camera-built version of the grid (noisy depth, voxel map, unknown-space risk, tracker, drift) evaluated against the ground-truth map.
- A frozen-parameter evaluation protocol with superseded versions and negative results kept.
2. Method
2.1 Static 3D risk
Body points x are sampled on a footprint at heights 0.1, 0.5, 0.9 and 1.2 m. For obstacles k with severity Sk (wall 1, cabinet 3, vase 5, shelf 8, person 10) and signed distance dk:
with σ = 0.25 m. The collision core exists because a pure severity Gaussian made touching a severity-1 wall cost only 1: the planner either brushed walls or froze. The grid is a dense window (8 × 6 × 2 m at 0.1 m, built in 6 ms) around the robot; a smooth field compresses poorly in an octree and MPPI needs ≈30k vectorised lookups per plan.
2.2 Camera-built grid
A head camera (87° × 58°, 212 × 120) renders depth through mujoco-realsensor's sensor model (z² noise, edge holes, 0.2–10 m); MuJoCo segmentation supplies class labels as a stand-in for a detector. Points update a world-fixed voxel map with log-odds L ← clip(L + 0.85 per hit, − 0.4 per ray pass); a voxel is occupied when L > 1.0, i.e. after two hits. Per class, an exact 3D Euclidean distance transform (2D per layer, exact 1D lower envelope along z) gives dk. Unseen voxels add Ru = su exp(−du2/2σ2), su = 1, combined by max, which slows the robot into unexplored space. The robot's own footprint column is cleared each tick. People are not mapped; a tracker takes the centroid of their points and an EMA velocity. A drift variant integrates odometry with 1 % scale error and 0.5°/m yaw drift and builds the map in that frame; the goal stays fixed in the map frame.
2.3 Moving people: spatio-temporal cost
Agent j observed now at (pj, vj) is evaluated at the time tk = (k+1)Δt of rollout step k, with uncertainty growing in time (σv = 0.15 m/s):
The earlier version put the person in the static grid at its current and four predicted positions with weights 1 − 0.5i/n (max over them). Figure 2 shows why that fails.
2.4 MPPI
Rollouts use a body-frame unicycle with measured tracking gains (vx, vy, ω scaled by 1.006, 0.823, 0.786 for the 29-dof G1). For each of 256 samples over H = 30 steps of 0.1 s, with goal g, rollout poses (pt, ψt), bearing βt to the goal and body points xt,b:
Weights wg = 10, wT = 10, wr = 1, wc = 0.005, wh = 3, wb = 10, wl = 0.5, λ = 0.1, β = 0.5; 20 % of samples are drawn around zero with doubled noise. Each term was added for a measured failure: a too-large control cost made standing optimal; a fixed temperature gave near-uniform weights; without the terminal term "stand still" beat any risky-but-feasible pass (deadlock); without the heading terms the goal was position-only, so walking backward was as cheap as walking forward and the robot back-stepped after the gap (57 commands with vx < −0.1 on one seed, down to −0.78 m/s). R0 is the risk at the current pose with people at t = 0 only.
2.5 Narrow-gap mode and body models
Scan lines across the goal heading find the widest free interval w of the lethal grid on each line. An opening with depth ≤ w < 2 × half-width triggers a feedback controller (Figure 3). MPPI alone never threaded such a gap: the feasible pelvis window is 8–11 cm wide, and even a hand-made ideal turn-and-slide hit the core from 2° of yaw error. The 12-dof G1 model has forearms fixed forward (0.44 m deep at 0.8–0.95 m height vs 0.36 m wide), so side-stepping gains nothing; the gap study uses the 29-dof model with arms PD-held (0.23 m × 0.37 m), after copying the policy's joint armature/damping/friction into it (without them it falls immediately). For the person study, the 12-dof outline including the forearms (x −0.07…+0.38 m, y ±0.18 m) is the "body12" footprint; the earlier pelvis column + 0.25 m missed the forearms, which caused every remaining contact with a yielding person.
3. Experimental setup
MuJoCo 3.14, Unitree G1 with the unitree_rl_gym pretrained 12-joint leg policy (50 Hz, velocity command), planning at 10 Hz with a 0.4 low-pass on commands. CPU only.
| scenario | what it tests | layout |
|---|---|---|
| shelf | overhang invisible to a 2D slice | shelf at 0.95–1.05 m protruding 0.55–0.75 m, low cabinet opposite so the floor-level free space lies under the shelf |
| gap | opening narrower than the body width | full-height partition, opening 0.33–0.36 m (29-dof G1: 0.23 m deep, 0.37 m wide) |
| crossing | a person crossing the path | doorways in both walls; person 0.6–1.0 m/s, started to reach the centreline when a 0.6 m/s robot would (± 1.5 s); planners see only its current velocity |
| crossing_yield | a person who yields | as above, but the person stops while the robot is ahead within 0.5 m |
Metrics. Success (goal within 0.3 m, 0.5 m for drift), falls, contacts (MuJoCo contacts between robot and obstacle geoms), minimum distance from the body column to the highest-severity obstacle, and risk exposure ∫ maxb R dt scored with the same ground-truth grid for every method.
Protocol. Acceptance tests were written before each implementation. Parameters were tuned on seed 0 only, frozen and hashed (sha256) before batch runs of 20–30 seeds. Any later change produced a new version (v2, v3) and the old hashes are recorded as superseded; earlier negative results are kept.
4. Results
4.1 Overhang
| map | method | collisions | shelf distance mean (worst) | exposure | time |
|---|---|---|---|---|---|
| ground truth | 3D risk | 0/20 | 0.49 m (0.44) | 8.08 | 15.3 s |
| ground truth | 2D slice risk | 1/20 | 0.27 m (0.18) | 10.30 | 13.1 s |
| ground truth | 2D binary inflation (Nav2-like) | 1/20 | 0.32 m (0.20) | 8.69 | 12.9 s |
| camera | 3D risk | 0/20 | 0.49 m (0.42) | 8.91 | 18.1 s |
| camera | 2D slice | 0/20 | 0.33 m (0.22) | 9.78 | 14.9 s |
| camera + drift | 3D risk | 0/20 | 0.49 m (0.43) | 9.95 | 18.8 s |
3D risk keeps about twice the clearance of 2D methods. On the camera map the 2D slice did not collide in this run, so the advantage there is in clearance, not in collisions; 0/20 vs 1/20 is not a statistically strong difference.


4.2 Narrow gap
| map | method | clean passes | contacts | yaw in gap | time |
|---|---|---|---|---|---|
| ground truth | side-step gap mode | 20/20 | 0/20 | 87° | 24.9 s |
| ground truth | circular-footprint MPPI | 0/20 | 0/20 | – | timeout |
| camera | side-step gap mode | 20/20 | 0/20 | – | 33.9 s |
| camera + drift | side-step gap mode | 17/20 | 1/20 | – | 33.7 s |
The circular baseline cannot fit by construction (its 0.215 m core leaves no free centres), so this compares the gap mode with plain MPPI; oriented-footprint MPPI without the mode also failed.
4.3 A person crossing the path
| method | no yield: contacts | falls | success | yields: contacts | worst distance | success |
|---|---|---|---|---|---|---|
| 3D, prediction smeared | 18/30 | 3 | 27/30 | 2/30 | 0.30 m | 28/30 |
| 3D, no prediction | 16/30 | 3 | 27/30 | 4/30 | 0.19 m | 27/30 |
| 2D binary inflation | 14/30 | 3 | 27/30 | 4/30 | 0.16 m | 26/30 |
| 4D spatio-temporal | 3/30 | 0 | 29/30 | 0/30 | 0.54 m | 30/30 |
The 4D cost is also the fastest (14.6 s vs 16.1–16.3 s for a non-yielding person). With the earlier pelvis-column footprint the ranking was the same (4D 11/30 vs smeared 23/30 contacts, 0 vs 5 falls). The remaining contacts come from a person who walks into the robot without yielding. Camera-map variants scored 0/30 in both conditions but arrived about 5 s later than the person's timing assumes and never met it (minimum distance ≥ 0.84 m), so they are not evidence of avoidance.


5. Failures found and what changed
- Prediction smear. The first person model made things worse than no prediction (23/30 contacts, 5 falls); replaced by the spatio-temporal cost.
- Position-only goal. Backward walking after the gap; a backward-speed clamp hid it but changed paths and exposed a false gap, so it was removed in favour of heading and forward-walking costs.
- Flying pixels. Depth edges of the partition, seen through the gap and never re-observed, became phantom lethal voxels next to the robot; the speed cap then crawled at 2 %. Fixed by a two-hit occupancy rule and footprint clearing.
- Detector hardening that backfired. Requiring observed-free space, then bounded openings, dropped camera-map gap success to 2/8; both were reverted and are listed as open work.
- Body model. Contacts with a yielding person were the 12-dof forearms at +0.37 m; the footprint did not cover them.
- Mutual waiting. With the smeared prediction, a yielding person and the robot could wait for each other until timeout.
- GL backend. Depth renders differ slightly between EGL and GLFW and changed a camera-map outcome; the backend is pinned.
6. Limitations
Simulation only; labels from segmentation; drift is a model, not SLAM; hand-set severities; a kinematic person that never avoids; 20–30 seeds; a rule-based gap mode that assumes a barrier perpendicular to the goal heading; camera-based person avoidance not yet tested fairly.
7. Future work
- Trigger the crossing person on the robot's position so every method meets it, and evaluate the camera 4D planner over 100 seeds.
- A real detector or injected label noise; real odometry/SLAM (e.g. KISS-ICP) and an octree or nvblox map.
- CVaR instead of the maximum over the rollout, interactive pedestrian models, data-driven severities.
- Whole-body responses (ducking under the shelf) with a motion tracker such as SuperMimic, then transfer to a real G1 with a D435i calibrated through mujoco-realsensor.
8. Reproducibility
Frozen parameter hashes (sha256 prefixes): v2 params.json 3ba09cb8, params_gap.json 6f387727, params_perc.json eccb6344, params_gap_perc.json 39d63592; v3 params_v3.json 76dab463, params_perc_v3.json 3292be3b. Superseded v1 hashes and every design change with its evidence are in progress.txt.
export MUJOCO_GL=egl UNITREE_RL_GYM=/path/to/unitree_rl_gym REALSENSOR_ROOT=/path/to/mujoco-realsensor python eval.py # shelf + corridor (v2) python eval.py --gap # narrow gap python eval.py --perc # camera map, drift python eval.py --body12 # crossing, both person models (v3) for t in tests/test_*.py; do python $t; done
References
- G. Williams et al., "Aggressive driving with model predictive path integral control," ICRA 2016.
- A. Hornung et al., "OctoMap: an efficient probabilistic 3D mapping framework based on octrees," Autonomous Robots, 2013.
- S. Macenski et al., "The Marathon 2: a navigation system," IROS 2020 (Nav2 costmaps).
- P. F. Felzenszwalb, D. P. Huttenlocher, "Distance transforms of sampled functions," Theory of Computing, 2012.
- Unitree Robotics, unitree_rl_gym (pretrained G1 policy). MuJoCo, Google DeepMind. mujoco-realsensor (virtual camera model).