Skip to content

Motion tracking pipeline

Marvin Bot’s motion pipeline (its README explains every step and why), run on the mini. The same 25 human motions generated with Kimodo (locomotion, sidesteps, turns, a jog, a march, a kick, squatting and picking up, a bow, a dance and arm gestures), and five of its own for the wrists and pincers (pouring, drinking, a door knob, a light bulb, handing over), are retargeted to the mini’s size, and one BeyondMimic-style tracking policy learns to follow all of them in ProtoMotions. A new skill is then a new clip, not new reward code. The clips, with the reference as a ghost, are on the skills page.

Step Tool Here
Motions Kimodo text to motion, with a root path per clip generate_kimodo.py (Marvin Bot’s, unchanged)
Keypoints ProtoMotions’ convert_soma23_npz_to_proto.py, extract_retargeting_input_keypoints_from_packaged_motionlib.py
Retarget ProtoMotions’ PyRoki retargeter retarget_mini.py
Neck the human’s head orientation add_head_motion.py
Wrists, grip the human’s hand twist; a grip schedule per clip add_hand_motion.py
Servo fit every joint inside its range and under its servo’s speed; each clip from standing fit_servos.py
Balance the centre of mass kept over the feet in still, two-footed frames fix_balance.py
Convert, package ProtoMotions’ convert_pyroki_retargeted_robot_motions_to_proto.py, motion_lib.py fix_sole_height.py, weight_motions.py (how often each clip is drawn)
Track ProtoMotions on Newton, BeyondMimic-style rewards setup_protomotions.py, check_tracking.py
Check each reference frame against the joints, the floor and the servos; the tracker in MuJoCo on the servo model check_feasibility.py, replay_mujoco.py
Clips renders with the reference as a ghost render_tracking.py, check_clips.py

Everything that is not robot-specific is Marvin Bot’s (the tracker’s rewards, its terminations, the contact penalty, the root paths, the head and sole fixes). What changes:

  • Scale. retarget_mini.py scales the human keypoints to the mini: the legs by 0.28 (its 0.24 m straight leg over the source’s 0.853 m), the shoulders 0.37 as wide (its 0.19 m shoulder span over the source’s 0.51 m) and 0.39 as high above the hips, the arms by 0.33 about each shoulder (its 0.18 m reach to the wrist), the shoulders 2.4 cm forward. Scaled down, the human’s feet end up about 5 cm apart against the mini’s 9 cm hips, so the feet move out 2 cm each and the knees 1 cm. Marvin Bot’s figures are 0.69, 0.62, 0.79 and 6.5 cm. The speeds scale with the size, so a 1.2 m/s human walk becomes about 0.34 m/s.
  • Hands. The retargeter matches the human’s wrist to the mini’s wrist (the wrist servo’s output face), and the tracking model carries a 1 g body there on the palm, which the tracker scores (its position and, as it turns with the wrist, its orientation) and the checks measure as the hand. The shoulder and elbow angles are left out of the joint-angle term, as on Marvin Bot; the wrists and pincers are scored by it.
  • Wrists and grip. No keypoint fixes a wrist’s turn or a grip, so the retargeter holds them and add_hand_motion.py sets them: each wrist from the person’s hand twist against the forearm, less its idle average; the pincer from a schedule per clip (Kimodo’s hands never open or close): open on the way to an object, closed on it while held, open to let go. Five clips were added for them (generate_kimodo.py’s wrist group): pouring, drinking, turning a door knob, screwing in a light bulb overhead and handing something over.
  • Balance. The retarget matches the keypoints within the joint ranges, not the robot’s balance. At the bottom of the squat and the pick-up, with the ankle and hip at their limits (45° and 120°), the retargeted pose had the centre of mass 5.3-5.6 cm ahead of the middle of the soles, at the toes, and the trackers stopped those clips 12 cm high. fix_balance.py moves the pelvis back and tilts it, legs re-posed with the feet held, wherever both feet are down and still and the centre of mass is more than 1.5 cm fore or aft of the soles’ middle, and keeps the stance feet at their standing height (the retarget sank them 3.4 cm into the floor at the squat’s bottom): the squat’s and pick-up’s worst frames now 1.6-1.7 cm from the soles’ middle, the feet within 0.3 cm of level. Walking is left as it is.
  • What the robot can do. check_feasibility.py checks every reference frame: the joint ranges, self-contact, the feet on the floor, whether the floor can balance it (inverse dynamics, the contact forces in a friction cone), and each joint’s torque and speed against its servo. It found the references putting the hands through the head and the chest and the feet through each other, the shoulder twist at its end in half the two-hand wave, and the neck at its look-down end in the side steps and turns. The retarget now keeps the head, trunk and legs out of the arms’ way and the legs out of each other’s, holds every joint 0.05 rad inside its range, and limits each to 70% of its servo’s no-load speed on an empty pack; fit_servos.py does the same for the neck, wrists and pincers set afterwards, and starts each clip from the standing pose (0.5 s still, 1 s moving into the clip’s first pose, the legs solved to keep the feet where the first frame has them). The two-hand wave began with both arms overhead, and the tracker dropped them on its first step.
  • Servos. ProtoMotions drives joints with its built-in PD. At small errors the servo model (sim/servo_model.py) is a PD too: stiffness kt × firmware_kp × error_gain × v / R (25 N·m/rad for an STS3250, 15 for an STS3215 at 11.1 V), damping kt² / R (0.62 N·m·s/rad), torque capped at stall, armature 0.02 kg·m², and that is what setup_protomotions.py gives it. BeyondMimic’s action scale (0.25 × effort / stiffness) would then be 0.046 rad; Marvin Bot softened its gains to raise it, but the servo’s stiffness is its firmware’s, so here the action scale is raised to 0.4 rad instead and the gains are left as they are. Each training robot gets its own servos: setup_protomotions.py adds a Newton simulator that scales each joint’s stiffness and damping by the servo model’s motor constant, winding resistance and firmware gain spread (±10% each) and the pack voltage (10.5-12.6 V), as the Isaac Lab tasks do.
  • Servo load. A penalty on each joint’s torque beyond half its servo’s rated torque (the joint PD’s torque, worked out from the target, since the simulator’s built-in PD does not report it). Without it the first tracker pressed the legs together, both hip rolls held 10° past where they stood, 4.4 N·m each standing still: near stall and 2.8 times rated, which would overheat them in minutes. Nothing in BeyondMimic’s rewards sees torque, and a stiff stance costs nothing in simulation.
  • The MuJoCo check (replay_mujoco.py) drives each joint with the full servo model (the duty cycle saturating at large errors, the back-EMF, the pack voltage, a command delay), which the PD in training only approximates.

As for Marvin Bot: one parent folder outside this repo with the ProtoMotions, PyRoki and Kimodo checkouts, three Python environments and a work folder; Kimodo’s text encoder is gated (Meta Llama 3 8B Instruct). The pipeline was run on ProtoMotions f69fdcaabff31846b4d2247207417b57dc788828, PyRoki 388e43e1fc0d0ee382968d3dd72970fd62a0450c and Kimodo e1c219c99b4b94ba48be1fb6a1cbc64ecee4c954; the setup commands are in Marvin Bot’s README. setup_protomotions.py edits the ProtoMotions checkout (it adds six generated files and registers marvin_bot_mini in robot_configs/factory.py), so rerun it after updating ProtoMotions or the description.

From the ProtoMotions checkout (P=../venvs/proto/bin/python; R=../venvs/pyroki/bin/python; $M is this repo, $W the work folder):

Terminal window
../venvs/kimodo/bin/python $M/sim/motion/generate_kimodo.py $W/npz locomotion skills wrist
$P $M/sim/motion/setup_protomotions.py .
$P data/scripts/convert_soma23_npz_to_proto.py --input-dir $W/npz --output-dir $W/soma \
--input-fps 30 --output-fps 30 --ignore-motion-filter
$P protomotions/components/motion_lib.py --motion-path $W/soma --output-file $W/soma.pt
$P data/scripts/extract_retargeting_input_keypoints_from_packaged_motionlib.py $W/soma.pt \
--output-path $W/keypoints --skeleton-format soma --start-idx 0 --skip-freq 1
for f in $W/keypoints/*.npy; do # six at a time: each takes several GB
while [ "$(jobs -r | wc -l)" -ge 6 ]; do wait -n; done
d=$W/keypoints_split/$(basename $f .npy); mkdir -p $d; cp $f $d/
( $R $M/sim/motion/retarget_mini.py --protomotions . --keypoints-folder-path $d \
--output-dir $W/retargeted --source-type soma --no-visualize &&
$R $M/sim/motion/retarget_mini.py --protomotions . --keypoints-folder-path $d \
--output-dir $W/retargeted --source-type soma --no-visualize \
--save-contacts-only --contacts-dir $W/contacts ) &
done; wait
$P $M/sim/motion/add_head_motion.py $W/npz $W/retargeted \
protomotions/data/assets/urdf/for_retargeting/marvin_bot_mini.urdf
$P $M/sim/motion/add_hand_motion.py $W/npz $W/retargeted \
protomotions/data/assets/urdf/for_retargeting/marvin_bot_mini.urdf
$P $M/sim/motion/fit_servos.py . $W/retargeted $W/contacts # edits in place: run once
$P $M/sim/motion/setup_protomotions.py . --covers # the mass with the shells, to balance and train on
$P $M/sim/motion/fix_balance.py . $W/retargeted
$P data/scripts/convert_pyroki_retargeted_robot_motions_to_proto.py \
--retargeted-motion-dir $W/retargeted --output-dir $W/proto --robot-type marvin_bot_mini \
--contact-labels-dir $W/contacts --apply-motion-filter --force-remake
$P $M/sim/motion/fix_sole_height.py . $W/proto
$P protomotions/components/motion_lib.py --motion-path $W/proto --output-file $W/mini_motions.pt
$P $M/sim/motion/weight_motions.py $W/mini_motions.pt squat=4 pick_up=4 wave_both=3
$P $M/sim/motion/check_feasibility.py $W/mini_motions.pt # per clip; --clip <name> for frames
$P protomotions/train_agent.py --robot-name marvin_bot_mini --simulator newton \
--experiment-path examples/experiments/mimic/mlp_bm_marvin_bot_mini.py \
--experiment-name mini_track --motion-file $W/mini_motions.pt \
--num-envs 16384 --batch-size 65536 --headless
$P $M/sim/motion/check_tracking.py \
results/mini_track/results/predicted_motion_lib_epoch_<N>.pt $W/mini_motions.pt

Then the MuJoCo check and the clips (pip install onnx onnxruntime in the ProtoMotions environment first):

Terminal window
$P deployment/export_bm_tracker_onnx.py --checkpoint results/mini_track/last.ckpt --output $W/onnx
$P $M/sim/motion/replay_mujoco.py $W/onnx/unified_pipeline.onnx $W/mini_motions.pt $W/mujoco.pt --covers
$P $M/sim/motion/check_tracking.py $W/mujoco.pt $W/mini_motions.pt
$P $M/sim/motion/render_tracking.py export $W/mujoco.pt $W/mini_motions.pt $W/v.npz # the clips show the MuJoCo replay
MUJOCO_GL=egl python sim/motion/render_tracking.py render $W/v.npz docs/media/skills # this repo's env

The human clips were checked before Marvin Bot was trained on them (check_clips.py human; all 25 pass); check_clips.py robot reruns the skill checks on the mini’s references.

One tracker plays all 30 clips (the skills page has each one). The current one was trained on the 30 clips retargeted again after the description’s changes, on the model with the shells (3.90 kg; setup_protomotions.py --covers): 3,000 epochs from scratch with the servo-load penalty at a weight of 0.5, then 1,000 more warm-started from it (--checkpoint, --training-max-iterations 1000; a warm start counts its epochs from zero, so that is the number still to run), 16,384 robots on one GPU, about 7 hours in all with other training sharing the GPU. It was then warm-started twice more with the tracking tolerances scaled to the mini (the fall threshold, the anchor and body-position terms and their reward widths roughly halved, sized for a 1.5 m robot until then) and a 0-20 ms delay on the commands (ProtoMotions’ LatencyDomainRandomizationConfig): about 620 epochs on the clips as they were (a 1,500-epoch run stopped early), then 1,000 on the clips with the squat and pick-up rebalanced (fix_balance.py), about 5 hours more; and once more, 1,500 epochs, with the stance feet kept level in the squat’s and pick-up’s references, those two clips drawn four times as often and the two-hand wave three times (weight_motions.py), and the servo gains spread per robot, about 5.5 hours. Last, 3,000 epochs on the clips fitted to the robot (check_feasibility.py, fit_servos.py), with the policy’s inputs clamped at 20 rather than 5 and a clip counted as failed in evaluation, and so drawn more often, when any body strays over 20 cm from its reference, not only the pelvis, about 10 hours. Every clip stays upright in Newton, and in the MuJoCo check on the servo model, on the model with the shells, the carry handle and the e-stop (4.06 kg), all 30 do:

25 clips, weight 0.1 then 0.5 30 clips, 3.59 kg 30 clips, 3.90 kg with the shells the same, scaled tolerances and delay, balanced clips level feet, weighted clips, servo spread (checked at 4.06 kg) clips fitted to the robot, body-error evaluation
Hardest-working joint, worst clip (RMS / rated) 79% 86% (arms raise) 83% (arms raise) 71% (screw bulb) 61% (jog) 58% (jog)
Joint error, walk 8.7° 16.2° 7.3° 6.8° 7.4° 9.3°
Hands, feet, walk 3.6, 3.7 cm 4.0, 3.5 cm 3.0, 3.6 cm 2.9, 3.1 cm 3.0, 3.0 cm 3.3, 2.4 cm
Hands, wrist clips 3.0-8.6 cm 2.3-7.7 cm 1.6-5.2 cm 1.1-4.0 cm 2.5-3.7 cm
Hands, arms raise and clap 12 cm 4.4, 5.1 cm 4.5, 4.0 cm 2.6, 2.7 cm
Distance, sidesteps and walking back 54-63% 90-95% 92-103% 89-102%
Pelvis lowest, squat (reference 0.15 m) 0.27 m 0.26 m 0.23 m 0.24 m

The earlier, 25-clip tracker’s development showed what the load penalty does: without it the tracker held both hip rolls at 4.4 N·m standing still (280% of rated), and with it the legs stopped pressing against each other and the joints followed their targets more closely. What is still off:

  • The two-hand wave now holds in MuJoCo, the hands 8.8 cm from the reference’s on average (41 cm, and a fall, before), but the policy raises the shoulders to about 90° where the reference goes to about 145°, putting the hands nearly where they belong with the rest of the arm. The other clips track 1-3° worse in joint angle than before the clips were fitted, the hands and feet about the same.
  • Squat and pick-up stop with the pelvis at 0.24 and 0.25 m against the reference’s 0.15 m (0.23 and 0.24 m before the clips were fitted). The retargeted references had the centre of mass 5.3-5.6 cm ahead of the soles’ middle at the bottom, at the toes, which no policy can hold; fix_balance.py brings it within 2.9 cm, but the tracker trained on the balanced clips went only 1 cm deeper, and levelling the feet and drawing the clips four times as often 3 cm more. The servos are not the limit (the hardest-working joint runs at 40-43% of rated in these clips, and the torque check takes the robot down to a deep squat, knee 120°, within the torque rule). replay_mujoco.py counts a pelvis 0.10 m below the reference as a fall; it used to count 0.10 m either way and so flagged these two, though the robot stayed up.

generate_kimodo.py getup makes two get-up clips, from the back and face down, and the pipeline takes them as it does the others (retarget_mini.py scales their trunk along the body’s axes, fix_sole_height.py puts the lowest body on the floor in every frame, fix_balance.py skips them); slow_getup.py plays their rise slower, after add_hand_motion.py. Trackers trained with them did not get up, at full or half speed: the retargeted clips hold the robot up on its palms with its knees in the air, and stand it with the centre of mass behind its feet (decisions 2026-11-30). They are not in the tracker’s set.

As for Marvin Bot: motion data is not committed. Kimodo’s models are under the NVIDIA Open Model License (NVIDIA claims no rights in the motions they generate) and were trained on Bones Studio’s motion capture; its text encoder is Meta’s Llama 3 8B Instruct under the Meta Llama 3 Community License and the LLM2Vec adapters (MIT). Each user accepts those licences when downloading the models; nothing from them is redistributed here. ProtoMotions’ own sample motions (the BONES-SEED dataset) are not used. ProtoMotions’ and PyRoki’s code is Apache-2.0 and MIT.


This page is generated from sim/motion/README.md in the repository.