Recommended setup: MuJoCo 3.8.1+, Python 3.10+. Drift can clone Menagerie for you on the first run if it isn’t on disk yet.
The prompt
- Asks where
mujoco_menagerielives, or clones it to a path you confirm - Composes
h1_scene.xmlthat<include>s the Menagerie H1 and adds a 10×10m floor - Spawns the H1 at the default keyframe’s qpos so the feet rest cleanly on the ground
- Writes a
run_sim.pythat:- Loads the H1 keyframe pose as the joint-target reference
- Applies a per-joint PD controller — an initial gain set with stiffer hips and ankles, lighter arms (the common starting point for hold-pose stability; expect to retune)
- Steps at 1 ms timestep with
implicitfastintegrator - Logs sensors at 200 Hz
- Runs headless, prints the final base height and orientation drift, and notes any contact issues
Static stability of a 19-DOF biped on PD is sensitive to gains. If the H1 collapses on the first run, that’s normal — see the gotchas at the bottom for the usual fixes.
What ends up on disk
What the viewer shows
Iterating from here
This is where the real work starts:Honest scope
Things this guide does:- Compose the scene around the Menagerie H1 model
- Write a full-body PD hold-pose controller (stiff hips/ankles, lighter arms)
- Wire IMU + base pose + 19-joint sensors and log them
- Open the viewer / run headless
- Bipedal walking — even “in place” walking is non-trivial; you need a controller (MPC, learned policy, or a reference trajectory tracker), not Drift
- Push recovery beyond what hold-pose PD naturally absorbs
- Whole-body control with operational-space inverse dynamics — Drift can scaffold the controller skeleton but the math is yours
- Sim-to-real — H1 sim parameters are good but not identical to hardware
Common gotchas
H1 collapses immediately on first step
H1 collapses immediately on first step
Almost always one of:
- Keyframe wasn’t loaded —
mj_resetDataKeyframecall missing in the run script. - PD gains too low for hip flexion / knees. The Menagerie default ranges can vary by revision; ask Drift
"the H1 is collapsing — tune the hip and knee gains for static stability". - Floor friction is too low (humanoids slip more than quadrupeds).
condim=3on the floor, friction ≥ 1.0.
Pose drifts by a few degrees over 5s but doesn't fall
Pose drifts by a few degrees over 5s but doesn't fall
Expected with pure PD on a model with no integral term. Either:
- Accept the drift (often fine for testing)
- Switch to PID by adding small
Kiintegral terms — ask Drift to do this - Use the Mujoco-MPC reference controller if you have it
Joint torque limits exceeded warnings
Joint torque limits exceeded warnings
Stiff PD on a 19-DOF humanoid will saturate some joints in the first few timesteps as the controller “catches” the system. If the warnings stop after ~0.1s, the system is fine. If they persist, lower your
kp or check the keyframe is actually loaded as the target (not zero).The H1 is facing the wrong way / spawned wrong
The H1 is facing the wrong way / spawned wrong
The default Menagerie spawn is at and Drift will compute the right quaternion.
qpos[3:7] = (1, 0, 0, 0) (identity quaternion, facing +X). If you want it facing a different direction, ask:Next steps
Quadruped Go2
Quadruped showcase — easier locomotion baseline
Dual-arm Aloha
Manipulation showcase
Building a MuJoCo Scene
The base MuJoCo guide
Custom Skills
Capture your humanoid stack’s conventions (gain rules, contact tuning) as a skill so every prompt uses them