Implementation:Google deepmind Mujoco MJX Passive
| Knowledge Sources | |
|---|---|
| Domains | Physics_Simulation, JAX, Passive_Forces |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
Passive force computation for MJX, applying joint-level spring and damping forces, gravity compensation, and fluid drag to the simulation.
Description
This module computes all passive (non-actuated) forces in the simulation. _spring_damper() applies joint-level spring forces (pulling toward a reference position) and damping forces (proportional to velocity) for all joint types (free, ball, slide, hinge). _gravcomp() applies gravity compensation forces for bodies with the gravcomp flag set. _fluid() computes fluid drag forces based on the model's fluid parameters. The main entry point passive() aggregates all passive force contributions and also adds tendon-level spring and damping forces into qfrc_passive on the Data object.
Usage
Called during mjx.step() after kinematics and before the constraint solver. The resulting qfrc_passive is combined with actuator forces and applied forces to compute the total generalized force.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: mjx/mujoco/mjx/_src/passive.py
- Lines: 1-206
Key Functions
def _spring_damper(m: Model, d: Data) -> jax.Array
def _gravcomp(m: Model, d: Data) -> jax.Array
def _fluid(m: Model, d: Data) -> jax.Array
def passive(m: Model, d: Data) -> Data
def _inertia_box_fluid_model(m: Model, ...) -> Tuple
Import
from mujoco.mjx._src.passive import passive
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| m | mjx.Model | Yes | JAX model with joint stiffness, damping, gravity, and fluid parameters |
| d | mjx.Data | Yes | JAX simulation data with qpos, qvel, and body transforms |
Outputs
| Name | Type | Description |
|---|---|---|
| d | mjx.Data | Updated data with populated qfrc_passive array (nv,) |