Implementation:Google deepmind Mujoco MJX Sensor
| 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
- Repository: Google_deepmind_Mujoco
- File: mjx/mujoco/mjx/_src/sensor.py
- Lines: 1-787
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 |