[MicroDuck RL 09] Deployment: From Simulation to the Physical Robot

MicroDuck RL: From Simulation to the Real Robot — Part 09 of 14

How do you move a trained policy onto the physical robot? This part covers the complete deployment path.

Training checkpoint (.pt) ── scripts/export.py ──> ONNX
                                         (observation normalizer embedded)
                                                    ──> Robot runtime

1. Export to ONNX

uv run scripts/export.py Mjlab-Velocity-Flat-MicroDuck --wandb-run-path ...

Use this script. It embeds the observation normalizer directly in the network graph. If you convert a checkpoint manually, the policy may receive unnormalized observations on the physical robot and fail immediately. This is one of the most common causes of Sim2Real deployment failures.

2. Run a Dress Rehearsal in Simulation

This step runs on a CPU:

uv run scripts/infer_policy.py --walking output.onnx

The script runs the policy in CPU-based MuJoCo and lets you control it from the keyboard. Use velocity commands to walk, G to pick up an object, Y to sit or stand, R for a forward roll, and K / L to kick. Use --record to capture video and --save-csv to export data for Sim2Real comparisons.

Always run this dress rehearsal before deploying to the physical robot. It uses the same observation and command conventions as the robot runtime. If the policy fails here, it will fail on the real hardware too.

3. Deploy to the Physical Robot

The runtime in pollen-robotics/microduck executes the ONNX policy at 50 Hz. Multiple policies share the same 61-dimensional observation contract described in Part 05, enabling hot switching between walking, recovery, and trick policies.

Deployment Notes

  • The trained policy has no action filter. Do not add one on the physical robot, because filtering changes the timing assumptions the policy learned during training.
  • Preserve the command semantics exactly. For example, a pose flag is encoded in the vx slot of the twist command, while an all-zero command means “stand still.”

At this point, the complete training-to-hardware loop is in place. Part 10 returns to an everyday skill: reading training logs and deciding whether a policy is actually improving.