A humanoid's spec sheet tells you what the maker wants to show; the simulation file tells you what the body is. In this lesson you install MuJoCo, download only the humanoids from MuJoCo Menagerie, and open the Unitree G1, reading from the file itself how many coordinates, velocities, and motors it has.
1What's in an MJCF: bodies, joints, actuators, sensors, and saved poses
2The workbench in ~/fth: venv, MuJoCo 3.16.0, and Menagerie pinned to a commit
3MjModel (the body) and MjData (the state)
4Why the G1 has nq=36, nv=35, and nu=29
Goal: install MuJoCo 3.16 and Menagerie and open the Unitree G1, reading nq, nv, and nu from the MJCF file itself.
01 · From file to simulation step
Click each block.
Click each block in the diagram to see what it does.
The maker's spec sheet and the file can differ: lesson 8 teaches you to note the difference.
02 · The three numbers you'll read on every humanoid
Click each one.
1. nq = 36
The humanoid's base is not fixed to the ground: it is a free joint with 7 numbers (x, y, z and a 4-number quaternion for orientation).
Adding the 29 articulated joints gives 36. That is the size of qpos.
2. nv = 35
The free base has 6 velocities (3 linear and 3 angular), one fewer than the 7 positions, because the quaternion has 4 numbers for 3 rotations.
6 + 29 = 35. That is the size of qvel and qacc.
3. nu = 29
One actuator per articulated joint. The base has no motor: the robot only moves by pushing against the ground with its feet.
In the version with hands (scene_with_hands.xml) the number goes up to 43. The G1 on sale has between 23 and 43 degrees of freedom depending on the version; the Menagerie ships the 29 one.
Rule of thumbHumanoid with a free base: nq = nu + 7 and nv = nu + 6, when each joint has one motor.
03 · Set up the workbench (once)
Its own venv, MuJoCo pinned to 3.16.0 and the Menagerie pinned to the tested commit. The sparse-checkout downloads only 4 humanoids (about 150 MB) instead of the whole repository.
Two lines and no errors. If your MuJoCo version is different, the numbers in the next lessons may change in the last digit: pin the version.
ERRO: não achei unitree_g1/scene.xml (nem em /tmp/sem-menagerie/mujoco_menagerie). Rode a preparação da aula 2.
saída: 1
The scripts look for the Menagerie in ~/fth/mujoco_menagerie (or wherever the FTH variable points). Did you run from another folder or clone somewhere else? Adjust FTH or move the folder.
04 · Open the G1 and the other humanoids
abrir.py only reads the model and prints its size. The excerpt from g1.xml shows where the numbers come from.
F=${FTH:-$HOME/fth}; cd $F/anatomia && . $F/.venv/bin/activate
for r in unitree_h1 robotis_op3 booster_t1; do
echo "$r: $(python3 kit/abrir.py $r/scene.xml | sed -n 2p)"
done
Excerpt from mujoco_menagerie/unitree_g1/g1.xml (commit 62ab00f)
modelo: g1_29dof_rev_1_0 scene · arquivo unitree_g1/scene.xml
nq=36 nv=35 nu=29
juntas: 30 (1 base flutuante + 29 articuladas) · corpos: 30 · sensores: 4
massa total do modelo: 33.3 kg · passo de simulação: 2 ms
poses salvas (keyframes): stand
altura da base na pose inicial: 0.79 m
saída: 0
33.3 kg in the model against about 35 kg on the Unitree spec sheet: the simulation file is an approximation of the real robot.
H1 with 19 motors, OP3 with 20 (a small 3.1 kg robot), Booster T1 with 23. All follow nq = nu + 7.
05 · What is used at scale (shown)
To train policies with thousands of robots in parallel, the same models run on NVIDIA GPUs. It is not a prerequisite for this course: course 1 of the program uses it.
Shown · mjlab, NVIDIA GPU (not run here)
# github.com/mujocolab/mjlab — Isaac Lab API on top of MuJoCo Warp
uv run train Mjlab-Velocity-Flat-Unitree-G1 --env.scene.num-envs 4096
06 · Practice
Workbench ready and first model open.
E1 · Set up the workbench
10 min
Run the "set up ~/fth" block. If python3.12 is missing, install it with your system's package manager (the course was tested with Python 3.12.3).
Done when: the output shows menagerie 62ab00f (2026-10-15) and mujoco 3.16.0.
E2 · Open the G1
3 min
Run the "open the G1" block and explain, in your own words, where each number on the second line comes from.
MjModel is constant during the simulation; MjData holds the state. Mixing up the two is the cause of a lot of bugs in robotics scripts.
Not that one
MjModel is constant during the simulation; MjData holds the state. Mixing up the two is the cause of a lot of bugs in robotics scripts.Review: From file to simulation step
Question 3 of 4
abrir.py says 33.3 kg; Unitree says about 35 kg. What should you do?
Correct
The model's mass, inertia, and friction are approximate. Measuring and noting the difference is the start of system identification (course 2 of the program).
Not that one
The model's mass, inertia, and friction are approximate. Measuring and noting the difference is the start of system identification (course 2 of the program).Review: Set up the workbench (once)
Question 4 of 4
Why pin MuJoCo to 3.16.0 and Menagerie to a commit?
Correct
MuJoCo ships almost every two weeks and Menagerie gets commits all the time. Pinning versions is what makes the "done when" reproducible.
Not that one
MuJoCo ships almost every two weeks and Menagerie gets commits all the time. Pinning versions is what makes the "done when" reproducible.Review: Set up the workbench (once)
Quiz complete
You got {a} of {n} right. Get them all right and the lesson is marked as complete.
Pick an option. The explanation shows up after you answer.
08 · In three sentences
FileThe MJCF describes the body, joints, actuators, sensors, and poses.
NumbersFree base: nq = nu + 7 and nv = nu + 6.
Workbench~/fth with MuJoCo 3.16.0 and Menagerie 62ab00f, pinned.