Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Google deepmind Mujoco MjModel Header

From Leeroopedia
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

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

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment