Skip to main content

Offline Sim2Sim

Run BVH motion capture files through the RL policy in MuJoCo simulation.

Basic Playback

python scripts/run/run_sim.py \
controller.policy_path=track.onnx \
input.bvh_file=data/sample_bvh/aiming1_subject1.bvh

Using hc_mocap Format

python scripts/run/run_sim.py \
controller.policy_path=track.onnx \
input.bvh_file=data/hc_mocap/walk.bvh \
input.bvh_format=hc_mocap

Keyboard Playback

Enable interactive control for offline BVH playback:

python scripts/run/run_sim.py \
controller.policy_path=track.onnx \
input.bvh_file=data/sample_bvh/aiming1_subject1.bvh \
playback.keyboard.enabled=true
KeyAction
Space / PPause / Resume
RReplay from start
QStop

Additional options:

# Pause at end of motion
playback.pause_on_end=true

# Limit number of steps (0 = infinite)
num_steps=300

# Wall-clock rate limiting (even without viewer)
realtime=true

Viewer Modes

Viewers run in separate subprocesses. Use shell quotes for list overrides.

viewers=sim2sim          # Default
viewers=all # mocap + retarget + sim2sim
viewers=none # Headless
'viewers=[retarget,sim2sim]' # Specific combination
note

When all active viewer windows are closed, the simulation ends automatically.

Recording

Record simulation data to HDF5:

python scripts/run/run_sim.py \
controller.policy_path=track.onnx \
input.bvh_file=data/sample_bvh/aiming1_subject1.bvh \
+record=true \
recording.output_path=outputs/session.h5

Recorded fields: joint_pos, joint_vel, mimic_obs, action, target_dof_pos, torque, timestamp.

Offline Rendering

Render simulation to video (headless):

MUJOCO_GL=egl python scripts/render/render_sim.py \
--bvh data/sample_bvh/aiming1_subject1.bvh \
--policy track.onnx

For hc_mocap format:

MUJOCO_GL=egl python scripts/render/render_sim.py \
--bvh data/hc_mocap/wander.bvh \
--format hc_mocap \
--policy track.onnx

The render pipeline outputs three views (mocap input, retarget, sim2sim), all using MuJoCo rendering.