Robotic Systems

Robotic Systems · teaching-draft · v0.2.0

Sensors, actuators, MJX, and reproducible projects

Lecture 14 · Week 7 · 90 minutes

Learning outcomes

  • Connect a simulation pipeline to observations and actuation.
  • Explain functional batching and fair MJX timing.
  • Deliver a bounded, reproducible engine-based study.

Prerequisites: Linear algebra, ODEs, and earlier lectures in this sequence.

A model is more than its rigid bodies

A simulation experiment includes actuator dynamics, sensor definitions, controller timing, resets, and output processing. A motor torque, joint position target, and tendon command have different meanings. Likewise, an ideal state observation differs from a sensor with filtering, delay, or noise.

Inspect nu, na, and sensor dimensions. Document units and frames at every interface. If activation has memory, (q,v)(q,v) alone is not the complete dynamical state.

Functional execution with MJX

The optional JAX-based example transfers a supported MuJoCo model to MJX, constructs data, and composes a step function with JAX transformations. A data replacement produces an updated value rather than mutating an array in place.

from mujoco import mjx
import jax
mjx_model = mjx.put_model(model)
mjx_data = mjx.make_data(model)
step = jax.jit(mjx.step)
mjx_data = step(mjx_model, mjx_data)
mjx_data.qpos.block_until_ready()

The concrete optional practice specifies the backend explicitly and validates its output against CPU MuJoCo. The installed MJX and MuJoCo versions must match the tested lockfile. Consult the current feature-support list before adding contacts, actuators, or sensors MuJoCo MJX.

Batching and timing

A vectorized function advances independent data instances while sharing compatible model structure. Independence matters: batch axis entries do not represent interacting robots unless the scene itself models their interaction.

The first compiled call includes tracing and compilation. Device work may execute asynchronously, so synchronize the final result before stopping a timer. Report warm-up/compile time separately from repeated execution and identify the batch size.

Worked observation audit

A controller is trained with exact qvel but deployed using position differences at 50 Hz. Noise and delay now enter the observation. Even if masses and contact parameters match, the policy receives a different signal. Add the estimator to the simulation before claiming the training environment matches the deployment interface.

Final project

Choose a small physical question: contact compliance, a closed-chain constraint, payload effects, sensor delay, or backend agreement. State assumptions, derive a relevant limiting case, run a parameter sweep, and explain at least one failure or mismatch. Include a clean-run command, lockfile, configuration, and numerical outputs.

The final assessment is an engine-based study, not a request to build a complete physics engine. Optional post-course work introduces variational integration or differentiable simulation in greater depth.

Exit question: Which error comes from the physical model, which from discretization, and which from the implementation? A defensible answer uses separate experiments to isolate them rather than one visually convincing demonstration.

Reading and source connections

MuJoCo API functions — MuJoCo contributors. Function-level reference. The lockfile fixes the executable version; stable documentation can move.

MuJoCo XLA (MJX) — MuJoCo contributors. Batching and differentiable simulation; distinguish MJX-JAX from MJX-Warp and check backend feature support.

Robotic Manipulation — online notes — Russ Tedrake. Further reading on contact-rich manipulation and learned policies; source notation is translated explicitly.