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 MJWarp Passive

From Leeroopedia
Knowledge Sources
Domains Physics_Simulation, GPU_Computing, NVIDIA_Warp
Last Updated 2026-02-15 04:00 GMT

Overview

MJWarp Passive computes passive forces including spring-damper, gravity, fluid drag, and flex elasticity on the GPU.

Description

This module computes all passive forces in the simulation: joint spring-damper forces, tendon spring-damper forces, gravitational forces, fluid interaction forces (viscosity, density, lift, drag), and flex element elasticity and bending forces. It combines these into the qfrc_passive generalized force vector. The fluid model supports both inertia-based and ellipsoid-based drag computation depending on geometry type.

Usage

Called during the forward dynamics pipeline via passive(m, d) to compute passive forces that are independent of actuator inputs. These forces are subtracted from the equations of motion.

Code Reference

Source Location

Key Functions

# Primary entry point
def passive(m: Model, d: Data)

# Spring-damper forces
def _spring_damper_dof_passive(...)   # Joint spring-damper
def _spring_damper_tendon_passive(...)  # Tendon spring-damper

# External forces
def _gravity_force(...)
def _fluid_force(...)
def _fluid(m: Model, d: Data)

# Flex forces
def _flex_elasticity(...)
def _flex_bending(...)

# Passive force assembly
def _qfrc_passive(...)

# Utility
def _geom_semiaxes(size, geom_type) -> wp.vec3
def _ellipsoid_max_moment(size, dir) -> float

Import

from mujoco.mjx.third_party.mujoco_warp._src.passive import passive

I/O Contract

Inputs

Name Type Required Description
m Model Yes Warp model with spring, damping, gravity, and fluid parameters
d Data Yes Warp simulation data with current positions and velocities

Outputs

Name Type Description
d.qfrc_passive wp.array2d Generalized passive forces (spring, damper, gravity, fluid, flex)

Related Pages

Page Connections

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