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 Inverse

From Leeroopedia
Revision as of 12:46, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Google_deepmind_Mujoco_MJWarp_Inverse.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

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

Related Pages

Page Connections

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