5.1 KiB
Verify, package, and train
Run the commands from the repository root with the editable install active. See Agent setup if you are preparing a machine.
Inspect and view a supplied model
python scripts/onboard.py inspect assets/smoke/smoke_biped.xml
python scripts/deploy.py --robot viewer_smoke --model assets/smoke/smoke_biped.xml --bundle out/viewer_demo
python scripts/play.py --app out/viewer_demo/viewer_smoke.app --headless --steps 20
The output directory and archive contain the model and its dependencies. This smoke app checks model loading. Use the next gate for a controlled robot.
Verify deterministic control
Here is a small fixed-base fixture for exercising Tier 2. Use a fresh
out/arm_demo directory.
mkdir -p out/arm_demo
cat > out/arm_demo/arm.xml <<'XML'
<mujoco model="arm_demo">
<compiler angle="radian"/>
<option timestep="0.002" gravity="0 0 0" integrator="implicitfast"/>
<worldbody>
<body name="base">
<geom type="box" size="0.05 0.05 0.05"/>
<body name="arm" pos="0.08 0 0">
<joint name="elbow" axis="0 0 1" range="-1 1"/>
<geom type="capsule" fromto="0 0 0 0.20 0 0" size="0.02" mass="0.1"/>
</body>
</body>
</worldbody>
</mujoco>
XML
cat > out/arm_demo/setup.json <<'JSON'
{"kind": "joint_sliders", "joints": ["elbow"], "kp": 25, "kd": 3, "effort_limit": 10}
JSON
python scripts/onboard.py setup-tier2 --model out/arm_demo/arm.xml \
--config out/arm_demo/setup.json --output out/arm_demo/control
cat > out/arm_demo/control/probe.json <<'JSON'
{
"controller": "controller.json",
"controls": "controls.yaml",
"steps": 1000,
"probes": [{"command": {"elbow": 0.3}, "joint_positions": {"elbow": 0.3}}]
}
JSON
python scripts/onboard.py verify --model out/arm_demo/control/robot.xml \
--config out/arm_demo/control/probe.json --report out/arm_demo/verification.json
Read both report stages. The control check measures the commanded joint's actual position and compares against actuation disabled. For a real robot, choose targets and tolerances from its intended range and record probe coverage before packaging.
python scripts/deploy.py --robot arm_demo --model out/arm_demo/control/robot.xml \
--control out/arm_demo/control/controller.json --controls out/arm_demo/control/controls.yaml \
--verification out/arm_demo/verification.json --bundle out/arm_demo/app
python scripts/play.py --app out/arm_demo/app/arm_demo.app --headless --steps 50
The bundle contains the native runtime entry point. On another machine,
extract the app, install runtime/requirements.txt in a separate Python
environment, and run python runtime/controller.pyz --app . --headless --steps 50
from the extracted directory.
Calibrate and train a legged robot
Use your floating-base robot-only MJCF and a stance JSON with its named supports, seed pose, height joints, and effort limits. See Hardware for input constraints.
python scripts/onboard.py calibrate --model assets/my_robot/robot.xml \
--config stance.json --report calibration.json
python scripts/onboard.py scaffold-tier3 --config robot.json --calibration calibration.json
python scripts/train.py --list
python scripts/train.py --task my_robot --dry-run
python scripts/train.py --task my_robot --backend native --device cpu --num_envs 4 \
--max-iterations 1 --headless --no-tensorboard
Use your actual robot ID in each command. The scaffold JSON supplies that ID, family, model path, and explicit action scales. A smoke update checks the model, environment, and runner connection. Size a learning run for the selected backend and available memory. Observe tracking rewards, episode lengths, terminations, and curriculum progress.
Replay the checkpoint from the run you intend to evaluate. Choose the fixed body command from the checkpoint's trained range, in m/s, m/s, rad/s.
python scripts/play.py --task my_robot --checkpoint <model_N.pt> --headless \
--steps 500 --speed 0 --measure --command <vx> <vy> <yaw_rate> \
--evaluation-out evaluation.json
Report the checkpoint, backend, environment count, iteration count, command, observation noise setting, and simulated duration alongside measured tracking errors and resets. Compare with a clean-noise replay only when that contrast is part of the evaluation.
Export for the native simulator
python scripts/export.py --task my_robot --checkpoint <model_N.pt> \
--native-layout --out out/native_policy
The export includes the actor, layout, replay model and controller. Hybrid
leg-position and wheel-velocity targets use the native layout. Prepare a probe
JSON that names the exported controller.json, optional controls.yaml, and
expected native responses. Verify the exported model before packaging.
python scripts/onboard.py verify --model out/native_policy/robot.xml \
--config out/native_policy/probe.json --report out/native_policy/verification.json
Use the passing report and exact exported files for the native app. See Controller setup for the layout and deployment for packaging.