GMR/H2O Based Motion Retargeting
Train a motion-tracking policy using ASAP framework and integrate GMR-based motion retargeting into the pipeline
Robotics
Overview
ASAP (Aligning Simulation and Real-World Physics for Learning Agile Humanoid Whole-Body Skills, CMU/LeCAR Lab, RSS 2025) retargets human motion capture data onto a humanoid, trains a motion-tracking policy on it in simulation, corrects the sim-to-real gap with a learned Delta Action Model, and deploys the result to a real robot. I forked ASAP and built the bridge that lets a different, better retargeting tool — GMR (General Motion Retargeting) — feed that pipeline instead of ASAP's original H2O-based retargeting step.

1 — Motion Retargeting?
Motion retargeting is the first stage of the pipeline: converting a human motion clip (SMPL/AMASS format) into a joint-angle trajectory for the target robot. Every later stage — motion-tracking policy training, delta-action fine-tuning, sim-to-real deployment — consumes the retargeted output directly. If the output format is even slightly off, nothing downstream runs, which makes this bridge small in code but load-bearing for the entire pipeline.
2 — Original H2O retargeting vs. GMR
ASAP ships with an H2O-style retargeting script that fits SMPL motion to the robot by iterative IK: for every frame, it optimizes joint angles and root rotation (Adadelta + Adam, up to 1,000 iterations) to minimize the distance between the robot's forward-kinematic joint positions and the target SMPL joint positions, with Gaussian smoothing and joint-limit clamping along the way.
GMR takes a different approach entirely — key-body matching, rest-pose alignment, non-uniform local scaling, and a two-stage IK solve — and produces a pkl with a different schema (root_pos, root_rot, dof_pos, fps). The GMR algorithm itself runs as a separate external tool; it is not part of this repository. What I built is the one piece that lets its output drive ASAP: gmr_to_asap.py, a bridge script that performs only a format conversion — no retargeting logic — turning GMR's output into exactly the schema ASAP's motion-tracking loader expects.
| H2O (original) | GMR bridge (this project) | |
|---|---|---|
pose_aa source | the IK optimization variable itself | reconstructed post hoc fromdof_pos |
3 — build_pose_aa(): GMR to H2O
The one output GMR doesn't produce is pose_aa (per-joint axis-angle) — format ASAP's motion-tracking loader requires. I wrote build_pose_aa() to reconstruct it directly from dof_pos (the joint-angle scalars GMR does output), multiplying each joint's scalar angle by its rotation axis (humanoid_fk.dof_axis, parsed from the robot's MJCF by ASAP's own forward-kinematics model) — a closed-form geometric transform, not an optimization. Getting this right required understanding how ASAP's FK model derives per-joint rotation axes from the MJCF in the first place, then mirroring the same axis-angle construction the original H2O script uses internally, applied after the fact instead of inside an optimization loop.
I also added a one-time verification step that prints the FK model's body order at startup, checked by eye against the expected target robot's joint ordering — a manual but deliberate guard against a class of bug that would otherwise fail silently: if GMR's joint order doesn't match what the FK model expects, the retargeted motion is wrong but nothing throws an error.
def build_pose_aa(humanoid_fk, num_extend, root_rot_xyzw, dof):
N = dof.shape[0]
root_aa = torch.from_numpy(
sRot.from_quat(root_rot_xyzw).as_rotvec()
).float() # (N,3)
dof_t = torch.from_numpy(dof).float()[None, :, :, None] # (1,N,31,1)
pose_aa = torch.cat(
[
root_aa[None, :, None], # (1,N,1,3) root rotation
humanoid_fk.dof_axis * dof_t, # (1,N,31,3) joint axis × joint angle
torch.zeros((1, N, num_extend, 3)) # extend: left_hand, right_hand, head
],
axis=2,
)
return pose_aa.squeeze(0).numpy() # (N, 35, 3)4 — Result
I verified the pipeline end to end — retargeting → motion-tracking training → inference — training a motion-tracking policy on both ASAP's original motion file and the GMR-retargeted motion. The first two clips below show the GMR-retargeted motion and the resulting training run; the last shows inference from the trained policy using ASAP's original motion file.
ASAP
I used the motion data natively provided by the ASAP framework and the H2O Retargeting method.
The first video shows the retargeting result of a dynamic motion of jumping while running,
The second video shows the inference result of the policy that learned the in-place jumping motion.
GMR
A human motion clip retargeted onto target robot's joint space by GMR, converted into ASAP's motion format by gmr_to_asap.py, and played back through the FK model — the direct output of the bridge script above. I stepped through the motion frame-by-frame by hand to inspect it, so some sections in the clip look like the motion cuts or stutters — that's an artifact of the motion's own discontinuity and manual scrubbing, not a problem with the retargeted motion itself.
5 — Troubleshooting
- Stopped at sim-to-sim, not sim-to-real. The plan was to also train the Delta Action Model to push sim-to-real transfer performance further, but a motion capture system for collecting real-robot rollout data wasn't set up yet, so this project was only verified through sim-to-sim.