Run an Isaac Lab G1 locomotion policy on a real Unitree G1 — or on MuJoCo over the same DDS topics, so the rehearsal and the real thing are the same code path.
The robot-facing half needs numpy, torch and unitree_sdk2py. No simulator, no Isaac Lab, no
GPU: the policy is a 208K-parameter MLP that runs in 0.016 ms on a single CPU thread, 0.1% of the
20 ms control period. A laptop or the G1's own computer is enough.
g1_deploy/
core.py the deployment contract: joint order, observation layout, PD gains, default pose
tracking.py finite reference-motion playback with the mimic actor's 154-value observation
controller.py reads rt/lowstate, writes rt/lowcmd — the only part that talks to the robot
recording.py asynchronous DDS and policy recording, enabled by default on hardware
analysis.py offline timing, joint motion, heading and vibration diagnostics
hardware.py power-on to policy control, and putting the robot down safely
bootstrap.py CycloneDDS library path fix (Linux dev boxes only; a no-op elsewhere)
benchmark.py shared command schedule and scoring, used by every runner
teleop.py keyboard command source — terminal keys, and viewer keys in --sim sync
data/ training contracts dumped from Isaac Lab, one per --policy_physics profile
sim/ MuJoCo stand-in for the robot — optional, the only part needing mujoco
scripts/
run_policy_loop.py entry point, for both the robot and the simulator
run_sim_loop.py free-running simulator that answers on rt/lowstate / rt/lowcmd
benchmark_*.py quantitative comparison runners
record_video.py offscreen recording of a rehearsal
analyze_deployment.py plots and metrics from a deployment recording
git clone <this repo> && cd g1_deploy
pip install -e . # robot only
pip install -e ".[sim,video]" # plus MuJoCo rehearsal and recording
# unitree_sdk2py is not on PyPI
git clone https://github.com/unitreerobotics/unitree_sdk2_python
pip install -e unitree_sdk2_pythonTake unitree_sdk2py's cyclonedds==0.10.2 pin literally. Installing it with --no-deps against
a newer CycloneDDS looks fine and is not: 0.11+ enforces XTypes type-consistency at match time, and
the SDK's Python IDL hashes differently from the robot's C++ IDL, so readers silently never match.
Measured against a real G1 on rt/odommodestate:
ours (Python) [MINIMAL fce8a80b52eff039d4683fc3ad80]/[COMPLETE 4014d13a03d68f246f38f1449cb2]
robot (C++) [MINIMAL 9fa6ccdc5cafdeaab8a762e31044]/[COMPLETE e59749630fff75cc170afb238783]
The failure mode is nasty because sim-to-sim still passes: both ends are the same Python
serialiser, so the hashes agree and everything works right up until the hardware. Symptom on the
robot is subscription_matched.total_count == 0 on every complex type, while trivially-shaped
topics like rt/wirelesscontroller do match and make it look like the network is fine. There are
macOS arm64 wheels for 0.10.2, so no source build is needed.
DDS domain ids must satisfy 7400 + 250 * id < 65536, i.e. stay under about 230; above that
CycloneDDS fails to open its discovery socket with a port "out of range".
You also need an exported TorchScript policy (policy.pt) from isaaclab play.
Every runner takes --policy_physics, and it names the layout the checkpoint was trained
against, not a simulator you want to use now. Three exist, and they are not interchangeable:
| value | joints | observation | what it is |
|---|---|---|---|
newton |
37 | 600 | the superseded g1_minimal.usd, depth first (whole left leg, then the right) |
physx |
37 | 600 | the same USD, breadth first (both hip pitches, then the waist, then both hip rolls) |
g1_29dof |
43 | 690 | the current robot description, the one that matches hardware |
physx and newton describe one robot in two orders, so getting them wrong is silent: the policy
loads, the observation is the right size, and the actions drive the wrong motors. g1_29dof is a
different robot, so getting it wrong is loud — load_policy probes the network with a
(1, OBS_DIM) zero vector and a 690-input checkpoint refuses a 600-element one. If you hit a
shape mismatch loading a checkpoint trained on the current asset, this flag is the answer.
Under g1_29dof all 29 motors are policy driven and UNMAPPED_ROBOT_MOTORS comes out empty; under
the other two, six motors — the waist roll and pitch, and both wrist pitches and yaws — have no
policy joint behind them and are held at _UNMAPPED_HOLD_GAINS instead. The PD gains and the
default pose come from g1_deploy/data/g1_dr29_contract.json, dumped from the training environment
with randomization off: read live from a randomized env, the leg stiffness comes back as one
sample of the trained band (146.7 on a hip whose nominal is 200), and deploying that sample would
put the wrong PD on the robot.
Two terminals. The simulator answers on the same DDS topics the robot does, so the controller cannot tell them apart.
# terminal 1 — a stand-in robot, held up for 4 s like a gantry, with a viewer
python scripts/run_sim_loop.py --domain_id 41 --hoist_s 4.0 --viz
# terminal 2 — the exact hardware sequence, minus the factory-controller release
python scripts/run_policy_loop.py --real --skip_release_mode \
--policy policy.pt --policy_physics newton --vx 0.5 --duration 20 --ramp_s 3.0 --domain_id 41The simulator does not reset between runs. Restart terminal 1 for each attempt.
On macOS pass --interface lo0; lo is the Linux name and CycloneDDS will not find it. --viz has
to be launched with mjpython, which MuJoCo requires for a viewer on macOS.
The free-running simulator steps physics on a worker thread. Depth rendering and the viewer use a separate state snapshot, so a slow frame does not pause physics. Both physics and policy loops discard overdue wall-clock deadlines instead of accelerating to replay missed periods. Shutdown logs report timing overruns separately for physics, graphics, and control; sustained physics overruns still mean the machine is not keeping real time. Policy loaders use one PyTorch CPU thread to avoid large thread pools exceeding the 20 ms control budget.
--vx/--vy/--heading are otherwise read once at startup. --teleop makes them live, in every mode
including --real on hardware:
python scripts/run_policy_loop.py --sim sync --teleop \
--policy policy.pt --vx 0.5 --duration inf --domain_id 41 --interface lo0w/s forward +/- 0.1 m/s q/e turn the heading target +/- 15 deg
a/d left/right +/- 0.1 m/s space stop r face the current heading x quit ? help
Arrow keys work too. Keys are read from the terminal in every mode; with --sim sync --viz the
viewer window accepts them as well, since the controller owns it.
--duration inf runs until you stop it. Prefer x or closing the viewer window over Ctrl-C: under
mjpython the script does not run on the main thread, so Python hands KeyboardInterrupt to
mjpython's event loop and the control loop never sees it.
--sim sync cannot share a DDS domain with anything else. It brings its own simulator, so a
run_sim_loop.py left open in another terminal puts two robots on the same rt/lowstate. Two 500 Hz
publishers overrun the SDK reader's queue, the reliable writer back-pressures, and the loop wedges
inside dds_write in C -- where Ctrl-C cannot reach it either. The run now probes the domain for a
second before starting and refuses rather than wedging, but give the two modes different
--domain_id values and the question does not come up.
The command is clamped to the ranges training sampled: vx 0 to 1.0 m/s, vy -0.5 to 0.5 m/s.
There is no reverse gear -- UniformVelocityCommandCfg.ranges.lin_vel_x starts at 0, so a
backward command is extrapolation, not a missing feature.
q/e move the heading target, not a yaw rate, because that is what the policy reads: this task
trains with heading_command=True, so the third command element is a proportional controller on
heading error recomputed every step. A teleoperated run therefore stays on the same distribution a
fixed --heading run is on. r adopts the heading the robot is currently at, which zeroes the error
and stops the turn.
Note that space is not a way to make the robot stand: at vx = 0 this policy falls in about 2 s,
for the asset reason below.
The seven exports in policies/mimic run through the same loop with
--tracking. Each directory includes the original training checkpoint, executable policy.pt,
reference motion and its own 29-joint deployment contract.
# macOS: play the walking clip once, with a viewer
mjpython scripts/run_policy_loop.py --sim sync --viz \
--tracking policies/mimic/walk --domain_id 81 --interface lo0
# Linux: the same local DDS rehearsal without a viewer
python scripts/run_policy_loop.py --sim sync \
--tracking policies/mimic/walk --domain_id 81 --interface loReplace walk with kick, run, cartwheel, speed-vault or cr7 to select another clip.
double-kong is also retained, but its final training evaluation did not complete a full clip.
These actors consume reference joint positions/velocities, torso orientation error, pelvis gyro,
joint feedback and previous actions. They need neither base linear velocity nor anchor position.
The package determines gains, action scaling and joint order; --policy_physics does not select
a tracking layout. Velocity teleoperation does not apply to a fixed motion clip.
Playback starts at frame zero after the existing ramp/alignment sequence, aligns the reference
heading once, and by default ends at the clip boundary even with --duration inf.
--hold_at_end keeps tracking the final frame; a shorter --duration stops earlier. Tracking compares torso tilt to the reference instead of treating an intentional
inversion as a fall; --tracking_max_tilt_error defaults to 0.8 rad. Only the 29-DoF hardware
variant (mode_machine=5) is accepted. The hardware path retains operator abort and damp-down.
The included validation covers numerical parity and local simulation; hardware has not been tested.
For active standing while waiting, add a separate --stand_policy bundle:
python scripts/run_policy_loop.py --sim sync \
--tracking policies/mimic/walk --stand_policy policies/mimic/kick \
--domain_id 81 --interface loType go to engage the standing actor, which keeps running at 50 Hz with its reference fixed at
frame zero. Type go2 to blend both actors' outputs over one second, then start the motion from
frame zero. Waiting and blending do not consume the clip. This reuses the existing kick actor;
it is not a separately trained straight-leg standing policy. Its stable posture has bent knees.
Both bundles must have matching motor Kp/Kd, which stay unchanged throughout. The initial takeover
blends from the measured joint targets over 0.3 seconds while the standing actor runs.
The same option works with --real and replaces the passive ramp/alignment hold. --align_word
and --align_timeout select the second confirmation word and waiting timeout (default go2,
300 s); --stand_transition_s sets the blend duration (default 1 s). An input disconnect, timeout,
stale state or operator abort exits through the hardware damp-down path. Clip completion also
damps down unless --hold_at_end is set; that option keeps the motion actor tracking its final
frame until stopped, without switching back to the standing actor. --duration limits motion
playback and final-frame holding, excluding the initial standing wait and transition.
--stand_policy and --stand_kp select alternative standing modes and cannot be combined.
Recordings distinguish standing, transition and motion, and store the two actors' inference
streams separately.
A depth student reads the 690-value proprioception contract and a stack of three 64x38 depth
frames. policies/<name>/contract.json carries everything needed to run one: joint order, default
pose, gains, action scale, and the camera the frames must come from.
The camera is a D435i on the robot's PC2 and pyrealsense2 has no macOS build, so PC2 does the
camera-side work and sends only what the policy consumes — 64x38 as uint16 millimetres, 4.9 kB per
frame, 238 kB/s at 50 Hz. run_sim_loop.py --depth emits the same wire format, so the control
loop cannot tell the simulator from the robot.
# on PC2
python3 ~/depth_publisher.py --host 192.168.123.222
# on the laptop
python scripts/run_policy_loop.py --real \
--depth policies/depth_student_w100 --policy_physics g1_29dof \
--vx 0.4 --vy 0.0 --duration 20 --ramp_s 3.0 --action_limit 8 \
--domain_id 0 --interface en6The publisher crops before downsampling, and that is not cosmetic. Measured on this robot the D435i streams 89.6 x 58.7 degrees at 848x480 while the policy trained on 87.0 x 58.8. Resizing the whole frame would squeeze 89.6 degrees of world into an image that means 87.0 — every array is still 38x64, so nothing downstream can notice, and the policy reads terrain 3% narrower than it believes. Cropping to 810x480 first leaves 86.97 x 58.70, a residual of 0.03 degrees.
Three things will stop a run rather than let it continue on bad input: the first frame must arrive
before the operator is prompted (20 s), the newest frame must be under --depth_max_age (200 ms, ten
control periods), and the contract's joint order must match --policy_physics.
To preview and record the consumed depth while the policy runs, add --depth_echo 5602 to the
policy command and use a separate terminal on the Mac:
conda activate deploy
python scripts/view_depth.py --port 5602 --window --gray --hz 20 --timeout 360 --recordInstall the existing video extra (python -m pip install 'opencv-python>=4.8') if needed.
--record creates recordings/depth_<timestamp>.mp4; pass --record path.mp4 to choose the name.
Ctrl+C in the viewer terminal, or closing the window, finalizes the MP4 without stopping the policy.
The video uses the preview's grayscale/colour settings, zoom and --hz frame rate; it is a visual
recording, not raw metric depth. It samples the latest frame and holds the last image if the stream
pauses. The policy's echo starts after alignment, when policy execution begins. For camera-only
preview/recording, use port 5601 while the policy is not using it; two receivers cannot share it.
That 200 ms is measured, not guessed: the worst frame age seen in rehearsal is 32 ms, across flat
and generated terrain, with and without a viewer, and with the policy running in the same process.
The limit started at 100 ms because five control periods sounded reasonable, and a lone hiccup
tripped it at 103 ms with zero frames dropped — a limit three times the observed worst case is too
tight to survive one stall. Every run now prints the age distribution, so a trip can be read as
either an outlier (p99.9 far below the limit) or a machine that cannot keep up (p99.9 near it).
Install the optional runtime with python -m pip install -e '.[leapp]'. Keep the official
YAML, ONNX and initial-state safetensors together. Add --leapp to the usual depth command:
python scripts/run_policy_loop.py --real --align --teleop --no_strafe \
--depth policies/height35-student-s43-i16000 \
--leapp /path/to/exported-policy/Isaac-Velocity-Rough-G1-29Dof-AirTime100-Yms-DepthDistill.yaml \
--policy_physics g1_29dof --vx 0.0 --duration inf --ramp_s 3.0 \
--domain_id 0 --interface en6 --depth_echo 5602With --leapp, --depth supplies the matching contract.json; policy.pt is not loaded.
Without --leapp, the existing TorchScript path is unchanged. The adapter calls the official
leapp.InferenceManager, which owns normalization, history, previous actions and target scaling.
The YAML supplies joint order and PD gains; the contract supplies the start pose and absent-finger
positions. YAML and contract joint orders must agree with --policy_physics.
The current Newton-exported graph includes a 180-degree image flip. --leapp_depth_rotation 180
(default) converts the existing G1 camera stream to that graph's input convention, retaining the
same image orientation at the network. Use 0 only for a stream already in the graph's convention.
Nonpositive/nonfinite camera pixels become far range as in the existing G1 deployment. No depth
normalization or history is applied outside LEAPP. This sensor convention differs from passing raw
zero-depth pixels directly to the exported graph, where zero means near range.
Loading and warm-up happen before control ownership or ramping. The existing alignment, depth-age
check, remote stop and damping flow apply. --action_limit is rejected because the exported graph
already produces joint targets; --clamp_targets still works. Recordings use leapp_policy for
graph inputs and joint targets, and include the YAML and artifact hashes in their metadata.
Isaac Lab's official leapp deploy command runs the bundle in simulation. Its InferenceManager
can also be called independently; g1_deploy.leapp.G1LeappPolicyRunner exposes this adapter without
importing the control script or opening DDS. A separate hardware entry point still needs state,
camera, scheduling and motor I/O.
# terminal 1 — simulator, camera and the training foot geometry. mjpython is required for --viz.
mjpython scripts/run_sim_loop.py --domain_id 41 --interface lo0 --hoist_s 4 \
--viz --depth policies/depth_student_w100 --foot_plate
# terminal 2
python scripts/run_policy_loop.py --real --skip_release_mode \
--depth policies/depth_student_w100 --policy_physics g1_29dof \
--vx 0.5 --vy 0.0 --duration 20 --ramp_s 3 --domain_id 41 --interface lo0--viz costs frames: 2887 received without it against 1033 with. Neither tripped the staleness
guard here, but raise --depth_max_age if yours does.
The viewer shows the robot; this shows the observation, which is the thing that can be silently wrong.
python scripts/view_depth.py --port 5601It binds the same port the control loop uses, so run it before the control loop or on its own. Expect a gradient from far at the top to near at the bottom, and a centre row near 1.7 m — that is flat ground under a camera 1.26 m up pitched 47.6 degrees down. Measured against a real D435i the per-row profile matched MuJoCo to 0.01 m at the image centre (1.79 against 1.80).
python scripts/benchmark_depth_mujoco.py --episodes 15 --foot_plate
python scripts/benchmark_depth_mujoco.py --episodes 15 --foot_plate --blind # controlRead the speed ratio, not the survival rate. "Survived" only means "did not fall", and a policy
that stands still through a walk command scores 100% on it. For depth_student_w100 on flat ground:
80% survived sighted against 60% blind, but the tracking error is 0.70 m/s against commanded speeds
of 0-1.12 m/s, and the failure is entirely lateral — vy = 0 tracks at 0.8-0.96 of commanded, every
vy = -0.5 episode runs away at over twice commanded speed, and every vy = +0.5 episode stalls.
The teacher (ckpt/policy_newasset.pt) tracks all of them correctly in the same environment, so this
is the distillation, not the benchmark. Command forward only until that is fixed.
scripts/make_terrain.py builds the training task's ground for MuJoCo using Isaac Lab's own
generators — they are numpy and trimesh, so they import from a checkout without Isaac Sim. Only the
orchestrator needs pxr; it just tiles sub-terrains by difficulty, so one tile is generated
directly.
python scripts/make_terrain.py --list
python scripts/make_terrain.py --terrain random_rough --difficulty 0.5 --out /tmp/rough.xml
python scripts/benchmark_depth_mujoco.py --xml /tmp/rough.xml --episodes 5 --foot_plateHeight-field terrains are emitted as a MuJoCo hfield and mesh terrains as a mesh. That split
matters: MuJoCo collides a mesh by its convex hull, which turns rough ground into a single dome —
random_rough as a mesh scored 0% at 0.28 s per episode, and as an hfield 60%.
Two caveats before trusting a number from this:
- The terrain is assumed, not verified. This reads Isaac Lab's stock
ROUGH_TERRAINS_CFG. WhetherIsaac-Velocity-Rough-G1-29Dof-AirTime100-DepthDistill-W100uses it is a question for the training machine'senv_cfg.scene.terrain.terrain_generator. - The contacts are not tuned. An
hfieldepisode was observed reaching 13.56 m/s, which is the solver ejecting the robot, not locomotion. Flat-ground numbers are usable; terrain numbers are not yet.
The G1 has no hardware emergency stop. Unitree's documented one is a remote combination that asks
the factory controller to damp — and once this program owns rt/lowcmd, relying on the factory
layer still listening is a bet, not a design. So the abort is handled here: every loop that commands
the robot parses the remote out of rt/lowstate and damps down on it. This is what Unitree's own
unitree_rl_lab does (LT + B → its Passive state, kp=0 kd=3).
g1_deploy/remote.py aborts on L2 + B, L1 + A, or select, during the ramp, the
hold and the policy loop alike.
The remote's mapping changed at Motion Control 8.2.0.0. Damping is
L2 + Bon 8.2.0.0 and later,L1 + Abefore it — and on that older firmwareL1 + Bis zero torque, which drops a hanging robot with no damping at all. Check the sticker that came with your controller. All three abort combos are accepted here so that guessing the firmware wrong is not what decides whether the stop works.
The combos that must not abort — L2 + A (debug-mode confirm pose), L2 + R2 (enter debug
mode), start — are tested to be ignored.
Composite of Unitree's Quick Start
and their own RL recipe in unitree_rl_gym/deploy/deploy_real/README.md:
- Hang the G1 on the protective rack, wheels locked. Every relevant Unitree page says to.
- Power on. Wait ~1 min for initialisation (all joints go zero-torque), then another 30 s.
L2 + B→ damping. LED solid orange.L2 + R2→ debug mode. LED solid yellow. Confirm withL2 + A(diagnostic pose) thenL2 + Bback to damping; repeatL2 + R2ifL2 + Adid nothing. In debug mode the joints are in the damping state — they sag under gravity but resist.- Wired ethernet. The robot's locomotion computer is 192.168.123.161; set your machine static in
192.168.123.0/24(Unitree's docs say 192.168.123.99), mask 255.255.255.0, andping 192.168.123.161.ifconfiggives the interface name to pass to--interface. DDS domain is 0. - Read-only check first — confirm
mode_machine == 5(29-DoF) and thattickadvances, before anything writesrt/lowcmd. --dry_run, hoisted, feet clear. See below.- Only then the policy, and lower the hoist so the feet take weight before engaging it.
Undocumented and worth knowing: there is no published number for the motor watchdog — how long
rt/lowcmd may stop arriving before the drives cut out. Unitree's docs do not state one and their
repos contain no such constant. unitree_mujoco has no equivalent either, so the rehearsal here does
not exercise it. That is why there is no operator prompt between the ramp and engaging the policy.
--dry_run stops after the ramp. It releases the factory controller, interpolates to the policy's
start pose, holds it while you look at the robot, reports per-joint tracking, and damps down. The
policy is never engaged and the robot is never asked to balance, so this is the step that proves
the joint order, the joint directions and the start pose while nothing can go wrong yet.
python scripts/run_policy_loop.py --real --dry_run \
--policy policy.pt --policy_physics newton \
--ramp_s 3.0 --hold_s 5.0 --domain_id 0 --interface eth0The pose it ramps to is a slight crouch — hips -11.5°, knees +24.1°, ankles -13.2°, shoulders 20° forward and 9° out, elbows 50°. Waist roll/pitch and the wrist pitch/yaw joints have no policy counterpart and are held at 0 with real stiffness, not left limp.
What the tracking report is for: every motor answering and holding. One large row is a dead motor, a joint against a stop, or a limit collision. Measured on hardware, hoisted with the feet clear, the whole robot tracks to 0.036 rad (2°) worst, 0.012 rad mean — the shoulders are the worst and the unloaded ankles are fine. In the MuJoCo rehearsal the ankles instead sit ~0.17 rad short, because there the hoist leaves them carrying load at kp 20; do not read the simulator's number as the target.
It does not check the joint ordering. --policy_physics orders the policy's own observation and
action vectors, while build_default_pose() is assembled by joint name — so the ramp target is
byte-identical under all three layouts, g1_29dof included, and a wrong choice is invisible in the
pose. What validates that is the MuJoCo benchmark: a scrambled action order does not walk. And a
small error means the robot went where it was told, not that the pose is right — look at it.
The gains are not identical, and the dry run does hold the robot at them. Going from newton to
g1_29dof the four wrist pitch/yaw motors move from the unmapped hold gains to what training used —
kd 1.0 → 10.0 at the same kp 40 — because under the old asset those joints do not exist and are
merely held, while under the current one the policy drives them. Nothing else changes. Expect the
wrists to feel notably more damped when you back-drive them by hand; that is the trained value, not
a mis-set one.
--real releases the factory motion controller, ramps from the robot's current pose to the policy's
start pose, refuses to engage unless that ends upright, and damps down on every exit path.
python scripts/run_policy_loop.py --real \
--policy policy.pt --policy_physics newton \
--vx 0.0 --duration 10 --ramp_s 3.0 \
--domain_id 0 --interface eth0 # macOS: en0/en5/en7, find it with ifconfigUse a wired link. A 50 Hz control loop over WiFi is not something to find out about on the robot.
The robot must be supported — hung or held — through the ramp. It cannot hold its own default pose at these gains: MuJoCo drops it in 1.46 s and Isaac Lab in about 1.5 s, because ankle kp is 20 N·m/rad and that is not enough to balance statically. Lower it only once the policy is running.
There is exactly one operator prompt and it comes before anything moves. There is deliberately none
between the ramp and engaging the policy: nothing sends rt/lowcmd while a prompt is waiting, so the
motor watchdog times out and drops the robot.
N/M control steps would have been clamped is expected and is not a reason to pass
--clamp_targets. The policy drives the soft ankles with deliberately far-away targets — ankle kp is
20, so a target 0.9 rad away is simply how it asks for 18 N·m — and every achieved ankle angle
stays inside the mechanical travel. Clamping cuts the same command to about 4 N·m. Turn it on only if
the joints are actually reaching their stops.
Isaac Lab's shipped g1.usd and g1_minimal.usd (6.0 and 6.1) match
g1_unitree_deprecated.urdf, not Unitree's current one. Against the real robot:
| old (training) | current (URDF / MJCF / hardware) | |
|---|---|---|
| hip roll joint z | 0 | −0.0305 m |
| pelvis → ankle | 0.6865 m | 0.7429 m |
| total mass | 32.24 kg | 35.11 kg |
Same joint command, 6 cm taller stance. Measured on the 45-episode hold suite with one checkpoint:
| MuJoCo geometry | success | tracking error | standing |
|---|---|---|---|
| current (≈ hardware) | 75.6% | 0.364 m/s | 0% |
| old (≈ training) | 97.8% | 0.118 m/s | 100% |
So expect a policy trained on the shipped asset to walk but not stand, and to undershoot commanded
speed. g1_deploy/sim/align.py can rewrite MuJoCo's legs to the old geometry, which reproduces Isaac
Lab exactly (0.000 mm forward kinematics across six joint configurations, four held out) — useful for
explaining the gap, not for predicting hardware. The real fix is to retrain on a current asset;
NVIDIA's i4h-asset-catalog ships one (Robots/UnitreeG1/g1_29dof_wholebody_dex3/) whose leg joints
match the current URDF to 0.000 mm.
That retrain has since happened, and its checkpoints deploy through --policy_physics g1_29dof —
see Which joint layout. The limitation above therefore
applies to physx and newton checkpoints only; it is kept here because those are still the ones
every number on this page was measured with.
Every run_policy_loop.py --real ... run now creates its own directory under recordings/.
Keep using the same deployment command. Use --log_dir /path/to/runs to choose a different parent
or to enable the same recorder in simulation; --no_log disables it. The existing command-only
--record PATH.npz option is unchanged.
The recorder starts before ramping and includes alignment, policy execution and damping. It saves:
- Full
rt/lowstatesamples received by this controller: all 35 protocol motor slots, IMU, remote buttons/sticks, mode, tick, faults, temperatures, sensor and reserved fields. - Every
rt/lowcmdwrite attempt, including target position/velocity, feedforward torque, gains and modes; separate completion records distinguish successful and failed local DDS writes. DDS write success is not an acknowledgement from a motor. - The exact policy input history, consumed depth stack for vision policies, and raw model output before action clipping. Control-step records identify the state sample, velocity command, heading target and iteration that produced each decision.
- Host monotonic timestamps, robot tick, inference and write durations, depth age, phase transitions and termination events. Robot tick and host time are separate clocks; receipt age measures time since the local callback, not end-to-end sensor/network latency.
- Policy SHA-256, deployment arguments, contract, joint mappings, code commit/diff, dependency versions and DDS field definitions. Preserve the policy export beside the logs for replay.
Serialization and disk writes run on a background thread. The bounded queue drops records rather
than waiting when storage cannot keep up. metadata.json reports drops, writer errors and whether
shutdown completed; a completed shutdown alone does not mean a lossless recording. SQLite commits
about once a second, so committed data remains readable after a process crash. A forced kill can
lose the current transaction and queued tail; this is not a power-loss durability guarantee.
The data is all received telemetry, not a promise that every packet transmitted by the robot arrived.
The recording rate follows DDS delivery, while policy samples follow the control loop. Budget roughly
60 MB/min for 500 Hz lowstate alone; observations and depth stacks add to that. Measure actual size
for your policy before long runs. There is no automatic deletion of earlier recordings.
Analyze after the robot is stopped:
pip install -e '.[analysis]' # once, on the analysis machine
python scripts/analyze_deployment.py recordings/<run>
# Equivalent after installing the entry point:
g1-analyze recordings/<run>The analysis/ subdirectory contains <run>.deploynose, overview.png (IMU, heading error, control intervals and state
age), joints.png (29 commanded joints), spectrum.png (joint-velocity spectra when sufficient regular
samples exist), summary.json and states.npz. The SQLite file remains the complete raw archive.
Analysis is offline: it does not create DDS endpoints. For custom analysis, g1_deploy.analysis.records
iterates a stream; pass include_depth=True for the policy stream to also read its input_1 stacks.
The archive does not use pickle.
Generate one portable file, open the app, and drag the file into its window:
python scripts/analyze_deployment.py recordings/<run> --no_plots
# Output: recordings/<run>/analysis/<run>.deploynose
python scripts/deploynose.py
# Equivalent after installing the entry point:
deploynose--no_plots skips the static PNG reports and does not require Matplotlib. Omitting it generates
both the portable file and the static reports. The viewer can also be opened directly at
g1_deploy/deploynose/index.html in a current browser; it needs no Python environment, server or
robot connection. Files stay local and are not uploaded. To move the app to another computer,
copy the entire g1_deploy/deploynose/ directory.
The six views cover deployment overview, joint tracking and vibration, orientation and heading, control timing, policy signals, and events/configuration. Select a joint and an optional comparison joint. Drag across a time plot or use the mouse wheel to zoom all time plots together; double-click or press Escape to reset. Hover to inspect samples. Each chart exports PNG or the exact samples inside the selected time range as CSV. Summary metrics and spectra cover the full analysis phase indicated on screen; zooming does not recompute them.
The .deploynose file contains full-resolution numeric curve data, metadata and analysis results.
Display reduction preserves extrema so brief spikes remain visible. Raw DDS messages and full
depth-image stacks stay in recording.sqlite3; preserve that archive for deeper analysis. The
viewer currently accepts files up to 512 MiB after decompression. Its built-in demo is synthetic,
and missing signals or incomplete recordings are marked explicitly.
Use the state/target curves to distinguish a changing policy target from poor joint tracking. Use
control intervals, inference time and state age to investigate timing jitter. Velocity-change rates
and spectral peaks identify joints and times worth examining; the default spectrum band starts at
5 Hz, which is an analysis band, not a fault threshold. Spectra exclude irregular or missing-tick
windows, and motion metrics use the policy phase when its markers are available. IMU heading can
drift and is not an external heading reference. tau_est is estimated torque, not a calibrated torque
sensor. Unpopulated motor slots can remain zero; in particular, a 27-DoF robot lacks waist roll/pitch.
There is no measured base linear velocity or position in this G1 lowstate interface. Joint speed changes and yaw response are measurable here; forward-speed tracking and trajectory drift need a validated odometry/VIO/motion-capture stream. Do not integrate the accelerometer and label the result as measured walking speed. The viewer/report cannot determine the cause of a fall from a single metric.