Implementation:Google deepmind Mujoco MJX Smooth
| Knowledge Sources | |
|---|---|
| Domains | Physics_Simulation, JAX, Rigid_Body_Dynamics |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
Core smooth dynamics functions implementing forward kinematics, composite rigid body inertia, recursive Newton-Euler dynamics, mass matrix factorization, tendon mechanics, and actuator transmission for MJX.
Description
This is the largest and most central module in MJX, implementing the smooth (continuous) dynamics pipeline. kinematics() converts generalized coordinates to maximal (Cartesian) coordinates by traversing the kinematic tree. com_pos() and com_vel() compute center-of-mass quantities. crb() performs the composite rigid body algorithm to build the joint-space inertia matrix, while factor_m() and solve_m() factorize and solve with it. rne() implements the recursive Newton-Euler algorithm for inverse dynamics. tendon() computes tendon lengths and Jacobians including spatial, fixed, and wrapping tendons. transmission() maps actuator forces to joint torques via moment arms.
Usage
Called as the backbone of mjx.step(). Functions are invoked in sequence: kinematics, com_pos, tendon, crb/factor_m, transmission, com_vel, rne, and rne_postconstraint.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: mjx/mujoco/mjx/_src/smooth.py
- Lines: 1-1473
Key Functions
def kinematics(m: Model, d: Data) -> Data
def com_pos(m: Model, d: Data) -> Data
def camlight(m: Model, d: Data) -> Data
def crb(m: Model, d: Data) -> Data
def factor_m(m: Model, d: Data) -> Data
def solve_m(m: Model, d: Data, x: jax.Array) -> jax.Array
def com_vel(m: Model, d: Data) -> Data
def subtree_vel(m: Model, d: Data) -> Data
def rne(m: Model, d: Data, flg_acc: bool = False) -> Data
def rne_postconstraint(m: Model, d: Data) -> Data
def tendon(m: Model, d: Data) -> Data
def transmission(m: Model, d: Data) -> Data
def tendon_armature(m: Model, d: Data) -> Data
def tendon_dot(m: Model, d: Data) -> jax.Array
def tendon_bias(m: Model, d: Data) -> Data
Import
from mujoco.mjx._src.smooth import kinematics
from mujoco.mjx._src.smooth import crb
from mujoco.mjx._src.smooth import rne
from mujoco.mjx._src.smooth import factor_m
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| m | mjx.Model | Yes | JAX model with body tree, joint, tendon, and actuator definitions |
| d | mjx.Data | Yes | JAX simulation data with generalized positions and velocities |
| flg_acc | bool | No | Flag to include acceleration terms in RNE (default False) |
| x | jax.Array | No | Right-hand-side vector for solve_m |
Outputs
| Name | Type | Description |
|---|---|---|
| d | mjx.Data | Updated data with Cartesian positions, velocities, inertia matrix, bias forces, tendon data, and actuator moments |