Motion Tracking¶
G1 motion tracking tasks live under src/unilab/tasks/motion_tracking/ and are
selected through task owner YAMLs in src/unilab/conf/ppo/, src/unilab/conf/appo/,
and selected off-policy paths.
Motion assets moved to Hugging Face. The
.npzclips are no longer shipped in the repository. On first useMotionLoader(src/unilab/tasks/motion_tracking/common/motion_loader.py) downloads them on demand from unilabsim/unilab-motions viasrc/unilab/assets/hub.py(_HF_MOTIONS_REPO_ID).uv syncalready installs the requiredhuggingface_hubdependency.
Task Owners¶
Each task ships a default motion clip in its Hydra task-owner YAML. Hydra is the
configuration entry point; the selected owner is materialized into the shared
ManagerBasedRlEnvCfg and then consumed by the tensor-only Manager-Based runtime.
CLI Task |
Registered Env |
Default Motion |
Owner Evidence |
|---|---|---|---|
|
|
|
|
Profile differences remain in Hydra: PPO/APPO, SAC, and FlashSAC all compose
the registered G1MotionTracking identity, while algorithm-specific
observation, DR, and tensor-runtime declarations stay in their owner YAML.
Unitree production wall-flip, climb, deploy, and 23-DoF motion profiles live in
unitree_rl_unilab.
PPO And APPO¶
PPO owner iteration budget (the --sim mujoco owner YAML):
g1_motion_tracking runs algo.max_iterations=15000.
uv run train --algo ppo --task g1_motion_tracking --sim mujoco
uv run train --algo ppo --task g1_motion_tracking --sim mujoco
uv run train --algo appo --task g1_motion_tracking --sim mujoco training.no_play=true
uv run train --algo ppo --task g1_motion_tracking --sim mujoco \
algo.num_envs=128 algo.max_iterations=5 training.no_play=true
uv run eval --algo ppo --task g1_motion_tracking --sim mujoco --load-run -1
uv run eval --algo ppo --task g1_motion_tracking --sim mujoco --load-run -1 \
training.cam_tracking=true training.cam_tracking_env_idx=0
SAC Motion Path¶
uv run train --algo sac --task g1_motion_tracking --sim mujoco training.use_amp=true
The g1_motion_tracking owner is the deploy-aligned off-policy observation
profile. When a Motrix sim2sim replay needs a checkpoint from another log root,
pass the absolute path through uv run eval:
uv run eval --algo sac --task g1_motion_tracking --sim mujoco \
algo.load_run=/abs/path/to/logs/sac/G1MotionTracking/2026-04-23_14-06-57_mujoco
Motion Files¶
Motion NPZ files are selected through
env.commands.motion.params.motion_file, which accepts one path or a list of
paths. A standard clip must contain the seven keys fps, joint_pos,
joint_vel, body_pos_w, body_quat_w, body_lin_vel_w, and body_ang_vel_w
(validated in common/motion_loader.py):
env:
commands:
motion:
params:
motion_file:
- motions/g1/dance1_subject2_part.npz
- motions/g1/walk1_subject5_from_csv.npz
Conversion and inspection helpers are in scripts/motion/:
uv run scripts/motion/csv_to_npz.py \
--input_file src/unilab/assets/motions/g1/dance1_subject2.csv \
--output_file src/unilab/assets/motions/g1/dance1_subject2_from_csv.npz \
--input_fps 30 --output_fps 50
uv run scripts/motion/csv_to_npz.py \
--input_file src/unilab/assets/motions/g1/dance1_subject2.csv \
--output_file src/unilab/assets/motions/g1/dance1_subject2_clip.npz \
--input_fps 30 --output_fps 50 --start_time 4.0 --end_time 9.0
uv run scripts/motion/replay_npz.py \
--npz_file src/unilab/assets/motions/g1/dance1_subject2_part.npz --loop
uv run scripts/motion/replay_npz.py \
--npz_file src/unilab/assets/motions/g1/dance1_subject2_part.npz --speed 0.5
If a MuJoCo replay shows obviously displaced bodies, check first: whether the NPZ
holds all seven keys, whether fps matches the control frequency, whether the body
layout needs a remap, and whether the joint order matches the current G1 model.
For more detailed motion conversion notes, see scripts/motion/README.md.
SAC WBT On Crawl-Slope Scene¶
Running g1_motion_tracking on slope terrain requires switching both the motion
clip and the MuJoCo scene file, fixing the episode length, and disabling reset
randomization so the precise clip start state is reused:
CUDA_VISIBLE_DEVICES=1 uv run train --algo sac --task g1_motion_tracking --sim mujoco \
training.use_amp=true algo.seed=1 \
env.commands.motion.params.motion_file=motions/g1/motion_crawl_slope_uni.npz \
env.scene.model_file=src/unilab/assets/robots/g1/scene_crawl_slope.xml \
env.commands.motion.params.sampling_mode=start \
env.commands.motion.params.truncate_on_clip_end=true \
env.max_episode_seconds=20.0 \
'env.commands.motion.params.pose_range={x:[0,0],y:[0,0],z:[0,0],roll:[0,0],pitch:[0,0],yaw:[0,0]}' \
'env.commands.motion.params.velocity_range={x:[0,0],y:[0,0],z:[0,0],roll:[0,0],pitch:[0,0],yaw:[0,0]}' \
'env.commands.motion.params.joint_position_range=[0,0]'
Key overrides: env.commands.motion.params.motion_file selects the crawl-slope
clip; env.scene.model_file switches to the slope scene
(scene_crawl_slope.xml exists under src/unilab/assets/robots/g1/);
sampling_mode=start plus truncate_on_clip_end=true starts from the clip
beginning and truncates there; and zeroing the command reset ranges reuses the
exact clip initial state.
Interactive Debugging¶
Routine checkpoint replay uses uv run eval. When you need a target-body or reward
debug overlay, src/unilab/scripts/play_interactive.py is the low-level MuJoCo viewer entry
point; it is not currently exposed as a uv run eval flag.