Principle:Google deepmind Mujoco Simulation State Initialization
| Knowledge Sources | |
|---|---|
| Domains | Physics_Simulation, Memory_Management |
| Last Updated | 2026-02-15 06:00 GMT |
Overview
Mechanism for allocating and initializing the mutable simulation state data structure that holds positions, velocities, forces, and contacts during simulation.
Description
Simulation State Initialization creates the mjData structure, which is the mutable counterpart to the immutable mjModel. While mjModel contains the model description (geometries, masses, joint limits), mjData holds the dynamic simulation state: generalized positions (qpos), velocities (qvel), applied forces, contact information, and all intermediate computation results.
The initialization allocates an arena-based memory buffer sized to the model's requirements, initializes plugins, and resets the state to the model's default configuration. The arena memory manager provides O(1) allocation for temporary computation buffers used during each simulation step.
Usage
Use this principle immediately after loading a model. Every simulation requires exactly one mjData per concurrent simulation thread (the model can be shared across threads, but data cannot).
Theoretical Basis
The state vector in MuJoCo follows the generalized coordinates formulation:
Where n_q is the number of position coordinates and n_v is the number of velocity coordinates. For free joints, n_q = 7 (3 position + 4 quaternion) while n_v = 6 (3 linear + 3 angular velocity).
The data structure also reserves arena memory for:
- Contact detection results
- Constraint Jacobians
- Solver workspace
- Temporary computation buffers