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 Sensor

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

Overview

JAX-based sensor computation functions that evaluate position-dependent, velocity-dependent, and acceleration-dependent sensor values within the MJX pipeline.

Description

This module implements the three stages of sensor evaluation: sensor_pos() for position/orientation sensors (framepos, framexaxis, rangefinder, etc.), sensor_vel() for velocity-based sensors (velocimeter, gyro, jointvel, etc.), and sensor_acc() for acceleration-based sensors (accelerometer, force, torque, etc.). Sensor values are computed by looking up object-type-specific data (body, geom, site, camera positions and orientations) and applying the appropriate transformations. Cutoff clipping is applied via _apply_cutoff() based on sensor data type (real vs. positive).

Usage

Called at the end of the mjx.step() pipeline after forward dynamics are computed. sensor_pos runs after kinematics, sensor_vel after velocity computation, and sensor_acc after solving for accelerations.

Code Reference

Source Location

Key Functions

def _apply_cutoff(sensor: jax.Array, cutoff: jax.Array, data_type: int) -> jax.Array
def sensor_pos(m: Model, d: Data) -> Data
def sensor_vel(m: Model, d: Data) -> Data
def sensor_acc(m: Model, d: Data) -> Data

Import

from mujoco.mjx._src.sensor import sensor_pos
from mujoco.mjx._src.sensor import sensor_vel
from mujoco.mjx._src.sensor import sensor_acc

I/O Contract

Inputs

Name Type Required Description
m mjx.Model Yes JAX model with sensor definitions (type, object references, cutoffs)
d mjx.Data Yes JAX simulation data with current state (positions, velocities, accelerations)

Outputs

Name Type Description
d mjx.Data Updated data with populated sensordata array

Related Pages

Page Connections

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