Implementation:Google deepmind Mujoco MJX Derivative
| Knowledge Sources | |
|---|---|
| Domains | Physics_Simulation, JAX, Analytical_Derivatives |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
Analytical derivative computation of smooth forces with respect to velocities, used by the implicit integrator for improved numerical stability.
Description
This module computes qDeriv, the analytical derivative of smooth (non-constraint) forces with respect to generalized velocities. It accounts for actuator velocity-dependent gains/biases (affine gain and affine bias models) and passive damping forces (joint-level and tendon-level damping). The derivative matrix is used by the implicitfast integrator in inverse.py to modify the effective mass matrix: M_eff = M - dt * qDeriv. Fluid drag derivatives are not yet implemented and will raise NotImplementedError if fluid parameters are present.
Usage
Called by inverse.discrete_acc() during the implicit fast integrator step within mjx.step(). Also used for implicit Euler integration where velocity-dependent force derivatives improve stability.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: mjx/mujoco/mjx/_src/derivative.py
- Lines: 1-73
Key Functions
def deriv_smooth_vel(m: Model, d: Data) -> Optional[jax.Array]
Import
from mujoco.mjx._src.derivative import deriv_smooth_vel
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| m | mjx.Model | Yes | JAX model with actuator parameters, dof_damping, tendon_damping |
| d | mjx.Data | Yes | JAX simulation data with ctrl, act, and actuator_moment |
Outputs
| Name | Type | Description |
|---|---|---|
| qderiv | jax.Array or None | Derivative matrix d(qfrc_smooth)/d(qvel), shape (nv, nv); None if no velocity-dependent forces |