Implementation:Google deepmind Mujoco MJWarp Smooth
| Knowledge Sources | |
|---|---|
| Domains | Physics_Simulation, GPU_Computing, NVIDIA_Warp |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
MJWarp Smooth implements the smooth dynamics pipeline including kinematics, composite rigid body inertia, recursive Newton-Euler, tendons, and mass matrix factorization on the GPU.
Description
This is the largest MJWarp module, providing the core smooth dynamics computations. It includes forward kinematics (kinematics), center-of-mass computation (com_pos, com_vel), composite rigid body algorithm (crb), recursive Newton-Euler equations (rne, rne_postconstraint), tendon length and Jacobian computation (tendon), tendon bias forces (tendon_bias), mass matrix Cholesky factorization (factor_m), linear system solving (solve_m), actuator/tendon transmission (transmission), camera and light positioning (camlight), flex element processing (flex), and subtree velocity computation (subtree_vel). Supports both sparse and dense mass matrix representations.
Usage
Called during the forward dynamics pipeline. kinematics runs first to compute body transforms, followed by com_pos for center of mass, crb for the mass matrix, factor_m for factorization, rne for bias forces, and tendon for tendon computations. These form the core of fwd_position and fwd_velocity.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: mjx/mujoco/mjx/third_party/mujoco_warp/_src/smooth.py
- Lines: 1-3234
Key Functions
# Kinematics and frame computation
def kinematics(m: Model, d: Data)
def flex(m: Model, d: Data)
def camlight(m: Model, d: Data)
# Center of mass
def com_pos(m: Model, d: Data)
def com_vel(m: Model, d: Data)
# Mass matrix
def crb(m: Model, d: Data) # Composite rigid body algorithm
def factor_m(m: Model, d: Data) # Cholesky factorization
def solve_m(m: Model, d: Data, x, y) # Solve M*x = y
def tendon_armature(m: Model, d: Data)
# Recursive Newton-Euler
def rne(m: Model, d: Data, flg_acc: bool = False)
def rne_postconstraint(m: Model, d: Data)
# Tendons
def tendon(m: Model, d: Data)
def tendon_bias(m: Model, d: Data, qfrc)
# Transmission
def transmission(m: Model, d: Data)
# Subtree dynamics
def subtree_vel(m: Model, d: Data)
# Linear system solving
def solve_LD(m, d, L, D, x, y)
def factor_solve_i(m, d, M, L, D, x, y)
Import
from mujoco.mjx.third_party.mujoco_warp._src.smooth import kinematics
from mujoco.mjx.third_party.mujoco_warp._src.smooth import com_pos
from mujoco.mjx.third_party.mujoco_warp._src.smooth import crb
from mujoco.mjx.third_party.mujoco_warp._src.smooth import factor_m
from mujoco.mjx.third_party.mujoco_warp._src.smooth import rne
from mujoco.mjx.third_party.mujoco_warp._src.smooth import tendon
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| m | Model | Yes | Warp model with kinematic tree, joints, tendons, and inertia parameters |
| d | Data | Yes | Warp simulation data with generalized positions and velocities |
Outputs
| Name | Type | Description |
|---|---|---|
| d.xpos | wp.array2d | Body positions in world frame |
| d.xquat | wp.array2d | Body orientations in world frame |
| d.qM | wp.array3d | Joint-space inertia matrix (sparse or dense) |
| d.qLD | wp.array3d | Cholesky factor of qM |
| d.qfrc_bias | wp.array2d | Bias forces (Coriolis, centrifugal, gravity) |
| d.subtree_com | wp.array2d | Subtree center of mass positions |
| d.ten_length | wp.array2d | Tendon lengths |
| d.actuator_moment | wp.array3d | Actuator moment arms |