PAC-MAN
A Unitree G1 that dodges thrown balls from onboard depth alone
License
MIT
MIT covers the code. Checked 2026-09-10: the Unitree G1 model files and the retargeted AMP motion clips derive from their upstream sources and keep those terms — the clips are retargeted from the NVIDIA SEED mocap dataset and are redistributed here for research use, so the source dataset's licence governs any commercial use of the motion data.
Overview
PAC-MAN is the training pipeline, benchmark and hardware deployment stack for a Unitree G1 humanoid that dodges thrown balls using nothing but a head-mounted depth camera. Safety is shaped at training time by control-barrier-function rewards over every body link rather than enforced by a runtime filter, and an adversarial motion prior over retargeted human dodges keeps the resulting reflexes human-like. The deployed policy sees the threat only as ball-only masked depth pooled to a sparse 16×9 frame stack — the exact representation an EfficientTAM segmenter produces on the real robot — so the sim-to-real gap collapses to the perception layer. It transfers zero-shot: 19 of 20 hand throws dodged with no falls.
The barrier structure comes in two forms and the repository treats the difference as the finding, not an implementation detail. Link-CBF puts one clearance barrier on every robot link and penalises violating the barrier condition at the most-binding link; it enters only through the training reward, with nothing to enforce online, which is exactly why the checkpoint deploys as-is. Joint-CBF projects the desired joint velocity onto a safe half-space and is stronger when ball states are accurate, but it degrades under a fixed camera when used as training guidance alone, and recovers with a ball-tracking gimbal or a privileged runtime projection. That privileged filter is a simulation ceiling, not a hardware configuration.
Training runs on mjlab over MuJoCo Warp, with the AMP implementation adapted from AMP_mjlab and PPO from rsl_rl, and the repository ships one launcher per experiment cell in the paper so the ablation table can be reproduced cell by cell. The deploy/ tree is a separate, self-contained Python 3.8 uv project that runs three processes over localhost UDP: a ZED camera node doing EfficientTAM ball segmentation, the ONNX dodge policy with an automatic walk-to-dodge mode switch, and a Unitree DDS hardware bridge. Both deployed checkpoints are committed to the repository, and there is a pytest suite covering the CBF terms, omni throws and gimbal aiming.
Why it matters
Safety layers for humanoids are usually demonstrated with privileged state and quietly lose their guarantees the moment the robot has to see the hazard for itself. PAC-MAN puts the barrier structure in the training reward and gives the policy only what an onboard camera can produce, then publishes the result on hardware. It is also unusually complete for a humanoid RL release: most stop at the training code, and this one carries the benchmark, the ONNX checkpoints that were actually deployed, and the camera and DDS bridge that ran them.
Problem it solves
Whole-body safety for a humanoid is easy to demonstrate when the hazard's position is handed to the controller and hard to keep when the robot has to perceive it. PAC-MAN closes that gap by training against the degraded observation the robot will actually have, so what the benchmark measures is what the hardware runs.
Key takeaways
- Deployed zero-shot on a Unitree G1: 19 of 20 hand throws dodged, no falls, with perception running entirely onboard
- The policy's only view of the threat is ball-only masked depth pooled to a sparse 16×9 frame stack, matching what EfficientTAM produces on the robot
- Link-CBF shapes safety through the training reward alone, with nothing to enforce at runtime, which is what makes the checkpoint transfer without fine-tuning
- Joint-CBF is the stronger barrier with accurate ball states but degrades under a fixed camera; a tracking gimbal or a privileged filter recovers it
- Duck, sidestep and leap emerge from the barrier rewards and the motion prior — no evasion behaviour is scripted
- deploy/ is a complete hardware stack — ZED node, EfficientTAM segmentation, ONNX policy with walk-to-dodge switching, Unitree DDS bridge — with the deployed checkpoints committed
- Because the policy sees only segmentation-masked depth, the same weights dodge balls that were never in training
Who it is for
- Humanoid whole-body control and safe-RL researchers
- Unitree G1 owners looking for a complete sim-to-real deployment path
- Control-barrier-function researchers wanting a reward-shaping reference implementation
- Practitioners studying depth-only, perception-in-the-loop policies
Limitations
- One threat model: balls thrown at a standing robot. Nothing here covers general obstacle avoidance or navigating a cluttered scene
- The +filter configuration needs privileged ball states and is a simulation-only ceiling rather than something that can run on hardware
- Linux x86_64 and an NVIDIA GPU are required for training; the hardware path additionally needs a Unitree G1, a ZED camera and a built Unitree SDK
- The AMP prior rests on roughly 100 seconds of retargeted motion, a small corpus for the range of evasive behaviour being claimed
- The motion clips are retargeted from the NVIDIA SEED mocap dataset, which carries its own terms — the repository redistributes them for research use only
- Two deploy dependencies are the author's own forks pinned as submodules (RealtimeEfficientTAM, unitree_sdk2_wrapper), so the hardware path rests on personally maintained repositories
- The repository runs from source with PYTHONPATH rather than installing as a package, which makes it awkward to depend on from other code