Implementation:Google deepmind Mujoco MjModel Header
| Knowledge Sources | |
|---|---|
| Domains | C API, Physics Simulation, Data Structures, Model Definition |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
Primary C header file that defines the MuJoCo model data structure (mjModel), all associated enumeration types, and global simulation constants.
Description
mjmodel.h is the foundational header of the MuJoCo C API, defining global constants (mjPI, mjMAXVAL, mjMINMU, mjMINIMP, mjMAXIMP, mjMAXCONPAIR, mjMAXTREEDEPTH), size parameters for equation data, actuator parameters, solver references and impedance arrays, and the comprehensive set of enumeration types that control simulation behavior. Key enumerations include mjtDisableBit (19 disable flags for constraints, forces, sensors, etc.), mjtEnableBit (override, energy, fwdinv flags), and numerous type enums for joints, geoms, actuators, sensors, and solver configurations. The mjModel struct itself contains all static model data loaded from MJCF/URDF files.
Usage
This header is included by virtually all MuJoCo C/C++ code and is the primary interface for accessing the model structure. It is also the basis for Python bindings and MJX type definitions that mirror these structures in JAX/Warp.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: include/mujoco/mjmodel.h
- Lines: 1-1309
Key Functions
// Global constants
#define mjPI 3.14159265358979323846
#define mjMAXVAL 1E+10 // maximum value in qpos, qvel, qacc
#define mjMINMU 1E-5 // minimum friction coefficient
#define mjMAXCONPAIR 50 // maximum contacts per geom pair
#define mjMAXTREEDEPTH 50 // maximum BVH depth
// Size constants
#define mjNEQDATA 11 // number of eq_data fields
#define mjNDYN 10 // number of actuator dynamics parameters
#define mjNGAIN 10 // number of actuator gain parameters
#define mjNBIAS 10 // number of actuator bias parameters
#define mjNSOLVER 200 // size of one mjData.solver array
// Key enumerations
typedef enum mjtDisableBit_ { ... } mjtDisableBit; // 19 disable flags
typedef enum mjtEnableBit_ { ... } mjtEnableBit; // enable optional features
Import
#include <mujoco/mjmodel.h>
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (header definitions) | N/A | N/A | No runtime inputs; provides type definitions, constants, and struct declarations |
Outputs
| Name | Type | Description |
|---|---|---|
| mjModel | struct | Complete static model structure containing all physics parameters, kinematic tree, geom definitions, actuators, sensors, and solver settings |
| mjtDisableBit | enum | Bitflags to selectively disable simulation features (constraints, forces, sensors, etc.) |
| mjtEnableBit | enum | Bitflags to enable optional features (energy computation, forward-inverse, etc.) |
| Global constants | #define | Simulation limits and numerical constants |
Related Pages
- Google_deepmind_Mujoco_MjTnum_Header - Numeric type definitions (mjtNum) included by this header
- Google_deepmind_Mujoco_MjSpec_Header - Spec header that includes mjmodel.h for model specification types
- Google_deepmind_Mujoco_API_References_Header - Auto-generated API reference enumerations
- Google_deepmind_Mujoco_MJX_Warp_Types - MJX Python types that mirror these C structures