X1 sim2sim
Use this sub-skill to validate an exported X1 DH stand policy against the
bundled MuJoCo model, or to prepare the guarded native sim2sim.py handoff.
The supported task is x1_dh_stand. Start with
workflows, then use
model-and-asset-validation for
shape/XML checks and troubleshooting for
fail-closed diagnosis.
Hard backend and safety boundary
The full native script is currently BLOCKED_REQUIRED_BACKEND until NVIDIA
Isaac Gym Preview 4 is installed and verified. Although it uses MuJoCo, it
imports humanoid.envs before parsing arguments; that import chain requires
Isaac Gym. A working modern MuJoCo install alone does not make the native
workflow runnable. The native path also requires the repository's documented
Python 3.8 / PyTorch 1.13.1 + CUDA 11.7 stack, mujoco==2.3.6,
mujoco-python-viewer, pygame, an X1 checkout with its meshes, and a valid
exported policy.
Until that gate is cleared, perform only isolated XML, URDF, filesystem, JIT
container, and metadata checks. Run the bundled
scripts/sim2sim_preflight.py; it never imports humanoid or Isaac Gym, opens
a viewer, initializes pygame, loads TorchScript, or steps a simulator. Do not
launch a viewer by default and do not treat a preflight pass as a sim2sim
behavior result. The helper's --compile-mujoco option compiles XML in a child
process only; it does not render or step.
Operating invariants
- Native invocation is
python humanoid/scripts/sim2sim.py --task=x1_dh_stand --load_model=<timestamp-directory>. --task is required. In the source,
--load_model is a child name under logs/<task>/exported_policies/, not a
free-form absolute model file; if omitted, the source selects the last
lexicographically sorted directory. Inside that directory it takes the last
os.listdir entry, so pin a directory containing exactly one artifact.
- The exported artifact is a TorchScript file normally named
policy_dh.jit,
written by the DH exporter under a timestamp directory. It accepts a float32
tensor shaped [batch, 3102] and returns [batch, 12]. The 3102 values are
66 history frames × 47 features. The export wrapper takes the final 235
values (5 × 47) for the state estimator, reshapes the full input as
[-1, 66, 47] for the long-history encoder, concatenates estimator and
compressed history with the short history, and emits 12 action means.
- Each 47-value frame is: 5 command/gait values (
sin phase, cos phase,
scaled vx, scaled vy, scaled yaw), 12 DOF-position offsets, 12 DOF
velocities, 12 previous actions, 3 body angular-velocity values, and 3
Euler-angle values. The X1 config has num_actions=12, num_single_obs=47,
frame_stack=66, short_frame_stack=5, and num_observations=3102.
- The 12 action order is left hip pitch/roll/yaw, left knee pitch, left ankle
pitch/roll, then the corresponding six right-leg joints. The MuJoCo actuator
and URDF revolute order must agree with that order. Actions are clipped by
the configured action limit, scaled by
0.5, offset by the 12 default joint
angles, and passed through position PD; do not pass a runner checkpoint or
an ONNX file to sim2sim.
- The sim loop uses a MuJoCo timestep of
0.001 seconds and decimation 10:
physics advances at 1 kHz and the policy/observation update occurs every 10
low-level steps (100 Hz). The source sets model.opt.timestep from this
value, runs for 100 seconds by default, applies PD torques at every physics
step, and renders every step. Native rendering is interactive and must be
explicitly authorized after all gates pass.
Controller and native handoff
The README documents a Logitech F710 button-4 gate, but the current native
thread does not implement that gate. It continuously reads axes every 100 ms:
x_vel_cmd = -axis(1), y_vel_cmd = -axis(0), and yaw_vel_cmd = -axis(3).
The README's intended semantic mapping is button 4 + stick 1− forward, 1+
backward, 0− left, 0+ right, 3− counterclockwise, and 3+ clockwise. Treat
button gating as an operator procedure, not an implemented safety interlock;
center the controller and begin with one small command.
After a successful training run, hand off checkpoints to training
only for provenance or repair. Hand a runner checkpoint to export
to produce policy_dh.jit; only then return here. Hand a JIT path to this
sub-skill, and hand any interactive Isaac Gym checkpoint playback to
playback. Do not make this route train, export, or
replace a missing backend with a fake simulator.
Bundled runtime files
- workflows.md: guarded execution, artifact
selection, timing, and sibling handoffs.
- model-and-asset-validation.md:
distilled JIT, observation/action, MJCF, mesh, URDF, and timing contracts.
- troubleshooting.md: backend, policy, XML,
observation, controller, and viewer failure recovery.
- scripts/sim2sim_preflight.py: safe static
preflight and optional no-viewer XML compilation.
1---2name: sim2sim3description: "Route safe, source-backed MuJoCo sim2sim validation for the AgiBot4 X1 DH stand policy, including JIT/model contracts, XML assets, timing,5 controller mapping, and backend-gated interactive execution."6disable-model-invocation: true7metadata:8 source: https://skillmd.com/skills/vectorspacelab/sim2sim9 disco-role: operating10license: NO_LICENSE11---1213# X1 sim2sim1415Use this sub-skill to validate an exported X1 DH stand policy against the16bundled MuJoCo model, or to prepare the guarded native `sim2sim.py` handoff.17The supported task is **`x1_dh_stand`**. Start with18[workflows](references/workflows.md), then use19[model-and-asset-validation](references/model-and-asset-validation.md) for20shape/XML checks and [troubleshooting](references/troubleshooting.md) for21fail-closed diagnosis.2223## Hard backend and safety boundary2425The full native script is currently **`BLOCKED_REQUIRED_BACKEND`** until NVIDIA26Isaac Gym Preview 4 is installed and verified. Although it uses MuJoCo, it27imports `humanoid.envs` before parsing arguments; that import chain requires28Isaac Gym. A working modern MuJoCo install alone does not make the native29workflow runnable. The native path also requires the repository's documented30Python 3.8 / PyTorch 1.13.1 + CUDA 11.7 stack, `mujoco==2.3.6`,31`mujoco-python-viewer`, `pygame`, an X1 checkout with its meshes, and a valid32exported policy.3334Until that gate is cleared, perform only isolated XML, URDF, filesystem, JIT35container, and metadata checks. Run the bundled36`scripts/sim2sim_preflight.py`; it never imports `humanoid` or Isaac Gym, opens37a viewer, initializes pygame, loads TorchScript, or steps a simulator. Do not38launch a viewer by default and do not treat a preflight pass as a sim2sim39behavior result. The helper's `--compile-mujoco` option compiles XML in a child40process only; it does not render or step.4142## Operating invariants4344- Native invocation is `python humanoid/scripts/sim2sim.py --task=x1_dh_stand45 --load_model=<timestamp-directory>`. `--task` is required. In the source,46 `--load_model` is a child name under `logs/<task>/exported_policies/`, not a47 free-form absolute model file; if omitted, the source selects the last48 lexicographically sorted directory. Inside that directory it takes the last49 `os.listdir` entry, so pin a directory containing exactly one artifact.50- The exported artifact is a TorchScript file normally named `policy_dh.jit`,51 written by the DH exporter under a timestamp directory. It accepts a float3252 tensor shaped `[batch, 3102]` and returns `[batch, 12]`. The 3102 values are53 66 history frames × 47 features. The export wrapper takes the final 23554 values (5 × 47) for the state estimator, reshapes the full input as55 `[-1, 66, 47]` for the long-history encoder, concatenates estimator and56 compressed history with the short history, and emits 12 action means.57- Each 47-value frame is: 5 command/gait values (`sin phase`, `cos phase`,58 scaled `vx`, scaled `vy`, scaled `yaw`), 12 DOF-position offsets, 12 DOF59 velocities, 12 previous actions, 3 body angular-velocity values, and 360 Euler-angle values. The X1 config has `num_actions=12`, `num_single_obs=47`,61 `frame_stack=66`, `short_frame_stack=5`, and `num_observations=3102`.62- The 12 action order is left hip pitch/roll/yaw, left knee pitch, left ankle63 pitch/roll, then the corresponding six right-leg joints. The MuJoCo actuator64 and URDF revolute order must agree with that order. Actions are clipped by65 the configured action limit, scaled by `0.5`, offset by the 12 default joint66 angles, and passed through position PD; do not pass a runner checkpoint or67 an ONNX file to sim2sim.68- The sim loop uses a MuJoCo timestep of `0.001` seconds and decimation `10`:69 physics advances at 1 kHz and the policy/observation update occurs every 1070 low-level steps (100 Hz). The source sets `model.opt.timestep` from this71 value, runs for 100 seconds by default, applies PD torques at every physics72 step, and renders every step. Native rendering is interactive and must be73 explicitly authorized after all gates pass.7475## Controller and native handoff7677The README documents a Logitech F710 button-4 gate, but the current native78thread does not implement that gate. It continuously reads axes every 100 ms:79`x_vel_cmd = -axis(1)`, `y_vel_cmd = -axis(0)`, and `yaw_vel_cmd = -axis(3)`.80The README's intended semantic mapping is button 4 + stick 1− forward, 1+81backward, 0− left, 0+ right, 3− counterclockwise, and 3+ clockwise. Treat82button gating as an operator procedure, not an implemented safety interlock;83center the controller and begin with one small command.8485After a successful training run, hand off checkpoints to [training](../training/SKILL.md)86only for provenance or repair. Hand a runner checkpoint to [export](../export/SKILL.md)87to produce `policy_dh.jit`; only then return here. Hand a JIT path to this88sub-skill, and hand any interactive Isaac Gym checkpoint playback to89[playback](../playback/SKILL.md). Do not make this route train, export, or90replace a missing backend with a fake simulator.9192## Bundled runtime files9394- [workflows.md](references/workflows.md): guarded execution, artifact95 selection, timing, and sibling handoffs.96- [model-and-asset-validation.md](references/model-and-asset-validation.md):97 distilled JIT, observation/action, MJCF, mesh, URDF, and timing contracts.98- [troubleshooting.md](references/troubleshooting.md): backend, policy, XML,99 observation, controller, and viewer failure recovery.100- [scripts/sim2sim_preflight.py](scripts/sim2sim_preflight.py): safe static101 preflight and optional no-viewer XML compilation.