Implementation:Google deepmind Mujoco MJWarp Inverse
| Knowledge Sources | |
|---|---|
| Domains | Physics_Simulation, GPU_Computing, NVIDIA_Warp |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
MJWarp Inverse implements inverse dynamics on the GPU, computing the forces required to produce given accelerations.
Description
This module computes inverse dynamics for MuJoCo Warp, determining the generalized forces needed to achieve a specified set of accelerations. It runs the forward position and velocity stages, optionally converts between discrete-time and continuous-time accelerations (for implicit integrators), solves for constraint forces via the inverse constraint solver, computes bias forces through recursive Newton-Euler equations, and assembles the final inverse force vector as qfrc_inverse = qfrc_bias + M*qacc - qfrc_passive - qfrc_constraint. The module supports Euler and implicit-fast integrators for discrete-to-continuous acceleration conversion.
Usage
Called via inverse(m, d) when inverse dynamics computation is needed, typically for control design or trajectory optimization. Requires that qacc be set in the Data object before calling.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: mjx/mujoco/mjx/third_party/mujoco_warp/_src/inverse.py
- Lines: 1-161
Key Functions
# Primary entry point
def inverse(m: Model, d: Data)
# Discrete-to-continuous acceleration conversion
def discrete_acc(m: Model, d: Data, qacc: wp.array2d)
# Inverse constraint solver
def inv_constraint(m: Model, d: Data)
# Internal kernels
@wp.kernel
def _qfrc_eulerdamp(opt_timestep, dof_damping, qacc_in, qfrc_out)
@wp.kernel
def _qfrc_inverse(qfrc_bias_in, qfrc_passive_in, qfrc_constraint_in,
Ma, qfrc_inverse_out)
Import
from mujoco.mjx.third_party.mujoco_warp._src.inverse import inverse
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| m | Model | Yes | Warp model with dynamics parameters and integrator settings |
| d | Data | Yes | Warp simulation data with qpos, qvel, and qacc set |
Outputs
| Name | Type | Description |
|---|---|---|
| d.qfrc_inverse | wp.array2d | Generalized forces required to achieve the given accelerations |
| d.qfrc_constraint | wp.array2d | Constraint forces computed by inverse solver |