What MuJoCo computes
MuJoCo advances a mechanical model through time. Joint positions and velocities describe its state; motor forces, gravity and contacts change that state. A control program supplies inputs before each step. Loading a humanoid mesh alone supplies neither a walking controller nor a calibrated robot. [Source ↗]
The native engine is a C/C++ library with Python bindings. This tutorial uses its CPU path. OpenGL viewing, MJX and MuJoCo Warp are separate choices. A GPU training example therefore has different requirements from the short headless experiment below. [Source ↗]
Rigid links have mass and rotational inertia. Joints constrain their relative motion. Contact geometry determines where bodies can touch, while contact and friction parameters affect the resulting forces. The solver handles those constraints numerically; its tolerances and iteration budget can affect the result. Gravity is a model option, not a force inferred from the appearance of the scene. [1]
Six pieces of a robot model
| Piece | What it specifies | What it does not establish |
|---|---|---|
| MJCF | MuJoCo scene, bodies, joints, contacts, actuators and sensors in XML | That the parameters match a particular physical unit |
| URDF | A robot link and joint description that MuJoCo can import | A complete replacement for every MJCF simulation option |
| Visual mesh | The visible shape and material | Accurate inertia or a suitable contact surface |
| Physical model | Mass, inertia, joint limits and collision geometry | Motor response under temperature or battery changes |
| Actuator model | How a control input produces joint effort | That every ctrl value is a torque command |
| Sensor definition | Which simulated measurements enter sensordata | A physical sensor’s calibration, dropouts or communications delay |
The integrator advances time after forces have been computed. A smaller timestep can help resolve fast motion but also costs more steps. Contact settings and joint gains must be considered together. Reproducing a result requires retaining these settings alongside the controller, rather than saving only a final pose. [2]
The G1 used here
The inspected Menagerie directory contains scene.xml, g1.xml and assets/. The scene includes the robot and a ground plane. Separate files provide a model with hands and an MJX-oriented model. This exercise uses scene.xml and its unmodified g1.xml. The directory README describes a simplified model and warns that the added position actuators need tuning. [Source ↗]
The compiled model has 29 actuators and one free base. Its 30 joints comprise 29 hinges plus that free joint. There are 36 position coordinates and 35 velocity coordinates because base orientation uses a four-component quaternion while angular velocity has three components. These are model counts, not a revised product specification for the base G1 sold by Unitree. [Source ↗]
For the commercial configuration, Read the base G1 hardware profile. The simulator model and the purchased variant must be matched before any transfer work.
Four configured sensors provide torso and pelvis angular velocity and acceleration, producing 12 scalar sensor values. The stand keyframe initializes the floating base, joints and control targets. The default position actuator gain is 500 with damping-ratio configuration; joint force limits are separate. These settings describe this XML revision, not recommended physical motor gains. [Source ↗]
Install and fetch the pinned files
The execution used Python 3.12.14, MuJoCo 3.15.0 and NumPy 2.5.3 on Linux. Pinning these package versions and the model commit makes later differences inspectable. The small example needs no camera renderer, CUDA or policy checkpoint. The interactive viewer has its own graphics requirements. [Source ↗] [Source ↗]
Version update, 10 November 2026: MuJoCo 4.0.0 was released on 6 November. The example below remains pinned to the tested 3.15.0 environment. Version 4 changes the Python package layout and some simulation behavior, so an upgrade requires a fresh run of the checks and comparison of the recorded state. The published CSV and JSON results belong to 3.15.0 alone. [Source ↗] [Source ↗]
python -m venv robot-labrobot-lab/bin/python -m pip install mujoco==3.15.0 numpy==2.5.3robot-lab\Scripts\python.exe -m pip install mujoco==3.15.0 numpy==2.5.3Save the next three linked files together. The fetch helper reads its JSON manifest, downloads 39 required model and licence files from the pinned commit, and checks each SHA-256 digest. It retains the model’s BSD-3-Clause licence. The meshes are downloaded from their source rather than silently substituted.
Download the model fetch helper
Download the required file manifest
Download the complete G1 experiment
robot-lab/bin/python get_g1_model.py
robot-lab/bin/python mujoco_g1.py menagerie/unitree_g1/scene.xml --output g1-resultsOn Windows, replace robot-lab/bin/python in those two commands with robot-lab\Scripts\python.exe. Run from the folder containing the downloaded files. The fetch needs internet access; the experiment then uses local files.
Command one joint and read the state
The complete downloadable program records every step to CSV and writes a JSON execution report. This smaller excerpt shows the same control operation. It asks the left elbow position actuator for a target 0.1 rad above the stand pose and takes 250 steps. No hardware connection is present.
from pathlib import Path
import mujoco
scene = Path("menagerie/unitree_g1/scene.xml")
model = mujoco.MjModel.from_xml_path(str(scene.resolve()))
state = mujoco.MjData(model)
mujoco.mj_resetDataKeyframe(model, state, model.key("stand").id)
actuator = model.actuator("left_elbow_joint").id
state.ctrl[actuator] += 0.1
for step in range(250):
mujoco.mj_step(model, state)
mujoco.mj_forward(model, state)
print(float(state.time))
print(state.joint("left_elbow_joint").qpos.copy())
print(state.sensor("imu-torso-angular-velocity").data.copy())Use names to find the actuator and sensor rather than assuming their array order. Copy a NumPy view when retaining a sample, since stepping updates the underlying state. The full program calls mj_forward after a step so derived readings correspond to the newly integrated state. Its contact count is the simulator’s active contact record, not a physical foot-switch measurement. [Source ↗]
| Recorded item | Actual execution |
|---|---|
| Timestep and duration | 0.002 s per step; 250 steps; 0.5 s simulated time |
| Elbow angle before the command | 1.280000 rad |
| Elbow target | 1.380000 rad |
| Final elbow angle | 1.379729 rad |
| Final floating-base height | 0.791613 m |
| MuJoCo warning counters | All seven counters were zero in this run |
Read the actual execution report
Download all 250 recorded samples
Plot time_s against elbow_angle_rad and elbow_target_rad to inspect the response. base_z_m and the gyro columns show that moving a joint occurs within a floating-body simulation. A native viewer can provide a separate visual inspection; no viewer or screenshot was used for this execution.
Targets, effort and feedback
A position actuator interprets its input as a target position and supplies a feedback force. A velocity actuator targets a speed. A motor actuator produces effort according to its transmission and gain settings. Never substitute a torque value into a position target slot merely because both are floating-point arrays. [1] [3]
In a joint-space PD controller, torque can be written as kp × (target angle − measured angle) + kd × (target velocity − measured velocity). Model-based control can add predicted gravity or dynamics terms. A learned policy may instead output offsets that a PD controller follows. The command interface must be explicit in every case. [1]
To isolate this feedback mechanism, Start with the single-joint exercise. The humanoid example adds coupled motion and ground contact.
A walking policy needs observations, rewards, resets and evaluation beyond this command test. Continue to the walking training pipeline
What the model leaves unresolved
The G1 mesh does not identify gearbox backlash, structural flex, thermal derating or communication delays. Its collision approximations may be sufficient for one locomotion experiment and unsuitable for another contact task. Holding a joint target for 0.5 s cannot settle those questions. Compare recorded physical response with the simulation before describing a calibrated model. [Source ↗]
Read how physical logs refine a model
For USD scenes and rendered sensor pipelines, Compare the Isaac Sim workflow
A position target that the joint never reaches
MuJoCo developers have asked why a position actuator's command does not match the measured qpos. First compare the actuator's transmission, gear, force limits, ctrlrange and target with the actual joint range. Check gravity load and external contacts before changing proportional gain. The target is a command, not a guarantee that the actuator can create enough force. [Source ↗] [Source ↗] [2]
The compiler's angle conversion and actuator ctrlrange are not interchangeable units. For a joint modeled in radians, verify the joint-angle convention, then confirm how that particular actuator interprets ctrl values. A developer reported that setting ctrlrange as if it were automatically angle-converted produced unexpected motion. [Source ↗] [3]
When a humanoid slips, penetrates the floor or explodes numerically
Contact complaints on humanoid and quadruped models can come from intersecting geoms at the initial pose, collision geometry unlike the rendered mesh, unrealistic inertias, unit mismatches, very stiff targets or a timestep too large for the contact. MuJoCo's official modeling guide recommends checking those items before tuning friction coefficients or solver options. [Source ↗] [2]
Inspect contact points and force arrows in the viewer. Run a single supported standing model with gravity and no gait policy, log contact counts and joint forces, and then introduce one change at a time. Reducing timestep or changing solver settings may help a correctly modeled scene but cannot repair an incorrect mass scale or initial interpenetration. [2] [Source ↗]
How to install the software mentioned on this page
Choose only the tools required for your project. The commands below describe development and simulation setup, not proof of compatibility with a specific physical robot. Match the versions in the original project and test offline before connecting hardware.
Python Windows, macOS, Linux
Install the Python release required by your robot or library. On Windows use the official installer; on Ubuntu use the distribution package. Create a separate virtual environment for each project.
Installation / setup commands
python -m venv .venv
# Windows PowerShell:
.\.venv\Scripts\Activate.ps1
# Linux or macOS:
source .venv/bin/activateVerify the installation
python --version
python -m pip --version
Official instructions: https://www.python.org/downloads/
MuJoCo Windows, macOS, Linux
Create a Python virtual environment and install the official Python package. On macOS use mjpython for the interactive viewer when required.
Installation / setup commands
python -m pip install mujocoVerify the installation
python -c "import mujoco; print(mujoco.__version__)"
Official instructions: https://mujoco.readthedocs.io/en/stable/python.html
NVIDIA Isaac Sim Supported Windows/Linux workstation with compatible NVIDIA GPU
Check NVIDIA's GPU, driver, OS and Python compatibility matrix. This is a documented example for Isaac Sim 5.1.0 in a Python 3.11 virtual environment; use the release required by your project and accept the applicable license when prompted. Do not mix incompatible releases.
Installation / setup commands
python -m pip install --upgrade pip
python -m pip install "isaacsim[all,extscache]==5.1.0" --extra-index-url https://pypi.nvidia.comVerify the installation
python -m pip show isaacsim
isaacsim
Official instructions: https://docs.isaacsim.omniverse.nvidia.com/5.1.0/installation/install_python.html
NVIDIA Isaac Lab Supported Linux or Windows configuration
The following is a version-pinned example for Isaac Lab 2.3.1 with Python 3.11. Check the matching Isaac Sim release, supported GPU and operating system. Install the compatible PyTorch build for your computer using the same version's documentation. For other releases, follow their own installation guide.
Installation / setup commands
python -m pip install --upgrade pip
python -m pip install "isaaclab[isaacsim,all]==2.3.1" --extra-index-url https://pypi.nvidia.comVerify the installation
isaacsim
Official instructions: https://isaac-sim.github.io/IsaacLab/v2.3.1/source/setup/installation/isaaclab_pip_installation.html
NVIDIA CUDA Toolkit Supported NVIDIA GPU and OS
Choose a CUDA Toolkit release matching the project, compatible driver and PyTorch build. Use NVIDIA's platform installer steps. A system-wide CUDA installation is not always needed for prebuilt PyTorch wheels.
Verify the installation
nvidia-smi
nvcc --version
Official instructions: https://developer.nvidia.com/cuda-downloads
NumPy Python environment on a supported OS
Use the Python version supported by the project.
Installation / setup commands
python -m pip install numpyVerify the installation
python -c "import numpy; print('Import OK')"
Official instructions: https://numpy.org/install/
MuJoCo MJX Supported Python environment
Install the matching MuJoCo package and backend for your project; use the documented Warp extra only for that backend.
Installation / setup commands
python -m pip install mujoco-mjxVerify the installation
python -c "import mujoco.mjx; print('Import OK')"
Official instructions: https://mujoco.readthedocs.io/en/stable/mjx.html
C++ toolchain Windows, macOS, Linux
On Ubuntu install the compiler and build tools; on Windows install the C++ workload for Visual Studio Build Tools or the toolchain required by the SDK. On macOS use the required Xcode Command Line Tools.
Installation / setup commands
sudo apt update
sudo apt install build-essentialVerify the installation
g++ --version
Official instructions: https://gcc.gnu.org/
Sources and verification
- MuJoCo dynamics, actuation and contactGoogle DeepMind · Read 8 October 2026
- MuJoCo model construction and solver settingsGoogle DeepMind · Read 8 October 2026
- MJCF reference for joints, actuators and sensorsGoogle DeepMind · Read 8 October 2026
Article history
Added a sourced engineering guide with version-specific references, practical resources and explicit evidence limits.
Acknowledged the 6 November MuJoCo 4.0 release and preserved the measured 3.15.0 tutorial and its output as a dated experiment.
Added source-checked technical answers to concrete questions discussed in robotics forums and project issue trackers; separated proposed diagnostics from published measurements.