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 MJX Inverse

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

Overview

Inverse dynamics functions for MJX, converting discrete-time accelerations to continuous-time and computing inverse constraint forces.

Description

This module provides two main functions. discrete_acc() converts discrete-time qacc to continuous-time qacc by accounting for integrator-specific modifications to the effective mass matrix. For Euler integration with damping, it adds the term h * diag(B) * qacc. For the implicit fast integrator, it subtracts dt * qDeriv from the mass matrix using analytical velocity derivatives from derivative.py. inv_constraint() computes the inverse constraint solution by creating a solver Context without gradient computation and extracting the resulting constraint forces and accelerations.

Usage

Called during the inverse dynamics pipeline, typically after forward kinematics and before sensor evaluation. discrete_acc is used when converting between discrete and continuous time representations for the chosen integrator. inv_constraint computes constraint forces for inverse dynamics analysis.

Code Reference

Source Location

Key Functions

def discrete_acc(m: Model, d: Data) -> Data
def inv_constraint(m: Model, d: Data) -> Data

Import

from mujoco.mjx._src.inverse import discrete_acc
from mujoco.mjx._src.inverse import inv_constraint

I/O Contract

Inputs

Name Type Required Description
m mjx.Model Yes JAX model with integrator options, dof_damping, and solver configuration
d mjx.Data Yes JAX simulation data with qacc, qvel, and constraint matrices

Outputs

Name Type Description
d mjx.Data Updated data with corrected qacc (from discrete_acc) or qfrc_constraint and efc_force (from inv_constraint)

Related Pages

Page Connections

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