Skip to main content

Train and Run Official Microduck Motions

This chapter covers the shortest training and inference path: discover the available tasks, train an official task, visualize a .pt checkpoint, run the provided ONNX policies, and control the simulated robot with a keyboard.

Available Task Families​

cd ~/microduck-jetson/microduck_rl
uv run --no-sync list-envs | grep MicroDuck
MotionTask ID
WalkingMjlab-Velocity-Flat-MicroDuck
Walking and fall recoveryMjlab-VelStand-Flat-MicroDuck
Stand up from the floorMjlab-StandUp-Flat-MicroDuck
Sit and standMjlab-SitStand-Flat-MicroDuck
Ground pickMjlab-GroundPick-Flat-MicroDuck
Forward rollMjlab-Roulade-Flat-MicroDuck
Ball kickMjlab-BallKick-Flat-MicroDuck
Roller locomotionMjlab-Velocity-Flat-MicroDuck-Rollers

Train the Walking Policy​

Start with the five-iteration smoke test before every long run:

cd ~/microduck-jetson/microduck_rl
export MUJOCO_GL=egl

uv run --no-sync train Mjlab-Velocity-Flat-MicroDuck \
--env.scene.num-envs 64 \
--agent.logger tensorboard \
--agent.max_iterations 5

For a longer run:

uv run --no-sync train Mjlab-Velocity-Flat-MicroDuck \
--env.scene.num-envs 2048 \
--agent.logger tensorboard

Increase the environment count only when memory and thermals permit. A practical fallback sequence is 4096 → 2048 → 1024 → 512.

Visualize a PT Checkpoint​

Find a checkpoint:

find logs/rsl_rl -type f -name 'model_*.pt' | sort

Browser Viewer over SSH​

export MUJOCO_GL=egl

uv run --no-sync play Mjlab-Velocity-Flat-MicroDuck \
--checkpoint-file /absolute/path/to/model_XXXX.pt \
--num-envs 1 \
--viewer viser

Open http://<JETSON_IP>:8080 from a computer on the same network.

Native Viewer on the Jetson Desktop​

export DISPLAY=:0
export MUJOCO_GL=glfw

uv run --no-sync play Mjlab-Velocity-Flat-MicroDuck \
--checkpoint-file /absolute/path/to/model_XXXX.pt \
--num-envs 1 \
--viewer native

Run the Official Multi-Policy ONNX Demo​

The repository contains nine official ONNX policies in pretrained/pollen-robotics/.

cd ~/microduck-jetson/microduck_rl
export DISPLAY=:0
export MUJOCO_GL=glfw

uv run --no-sync python3 scripts/infer_policy.py \
--walking pretrained/pollen-robotics/alpha_walking.onnx \
--standing pretrained/pollen-robotics/alpha_stand.onnx \
--sitstand pretrained/pollen-robotics/alpha_sitstand.onnx \
--ground-pick pretrained/pollen-robotics/alpha_ground_pick.onnx \
--roulade pretrained/pollen-robotics/roulade.onnx \
--kick-left pretrained/pollen-robotics/ball_kick_left.onnx \
--kick-right pretrained/pollen-robotics/ball_kick_right.onnx \
--front-back-split models/exports/front_back_split/front_back_split_model_999.onnx \
--new-cmd-obs

Keyboard Controls​

KeyCommand
Arrow keysForward, backward, and lateral velocity
A / ETurn left / right
GGround-pick behavior
YSit / stand transition
RForward roll
K / LLeft / right kick
OSix-second front-back split, then return to standing or walking
SpaceClear velocity command
QQuit

Inference Results​

The following GIFs show ONNX inference results captured directly from MuJoCo on the Jetson.

Walking​

Microduck walking policy inference loop in MuJoCo

The walking policy continuously tracks keyboard velocity and turning commands.

Rolling​

Microduck rolling policy inference in MuJoCo

Press R to switch to the forward-roll policy.

Ball Kick​

Microduck keyboard-triggered ball-kick policy inference in MuJoCo

Press K or L to trigger the left-foot or right-foot kick policy in the ball scene.

Front-Back Split​

The former one-leg balance policy has been replaced by a more stable double-support motion. Press O to run the trained policy: the left foot moves forward, the right foot moves backward, both feet remain grounded, and the robot returns to the standing or walking policy after the six-second phase cycle.

The included artifacts are:

models/checkpoints/rsl_rl/front_back_split/2026-09-09_18-04-10_front_back_split_left_forward/model_999.pt
models/exports/front_back_split/front_back_split_model_999.onnx

PT and ONNX Serve Different Purposes​

  • .pt checkpoints contain actor, critic, optimizer, normalizer, and training state. Use them for resume training and play evaluation.
  • .onnx contains the deployable inference graph. The official ONNX files do not contain the PPO training state and cannot be converted back into a resumable checkpoint.
  • The PT files under models/checkpoints/ are Jetson walking-training results included with this demo; they are not official Pollen Robotics PT releases.

Export Your Own ONNX​

uv run --no-sync python3 scripts/export.py \
Mjlab-Velocity-Flat-MicroDuck \
--checkpoint-file /absolute/path/to/model_XXXX.pt \
--onnx-file walking_custom.onnx

Always use scripts/export.py. The project exporter bakes the observation normalizer into the ONNX graph, which is required for correct runtime behavior.

Next Step​

Loading Comments...