Lesson 01 · 15 minutes · Preparation

Observe, act,
and step time.

Your first win: read a simulation trace and explain what the world did, what we asked it to do, and how time moved.

You already understand simulation in general. We will use one swinging joint to make the robotics vocabulary concrete. This is a learning example, not the dinner-table robot or a learned policy.

Four pieces of one loop

Observe
measure the angle
→Choose an action
set motor torque
→Step physics
advance time
→Observe again

An observation describes the current state. In this lab it includes a hinge angle and angular velocity. An action is a requested motor torque. The action is not a guarantee of the next position: gravity, inertia, damping, and the previous state also matter.

MuJoCo separates the model (the scene and its settings) from the changing simulation data. Our code applies a motor command, advances the physics, and copies measurements into a trajectory record. Read MuJoCo's basic usage for the API behind this loop.

Which item is an observation in this lab?

Run the real example

After following setup, run this from the repository root:

.venv/bin/bimanual lab --seed 7 --seconds 4
.venv/bin/bimanual evidence list

The command prints a run ID. In that run's directory under .artifacts/runs, open replay.gif and trajectory.csv. The portal also shows the replay. It was rendered from actual MuJoCo states.

CSV fieldMeaning
simulation_secondsTime advanced inside the simulated world.
angle_radMeasured hinge angle, in radians.
velocity_rad_sHow fast that angle is changing.
action_nmTorque applied over the following control interval; the last row has no following action.

One control step is not one physics step

Our lab updates actions at 20 Hz, every 0.05 simulated seconds. Physics runs at 200 Hz, every 0.005 seconds. The same requested torque is therefore held for ten physics steps. A four-second run has 80 control intervals and 81 recorded observations, including the initial and final states.

Wall time is the time your computer spends doing the work. Rendering may make a run slower; removing rendering may make it faster. Neither changes the requested four seconds of simulated time.

One control interval contains how much physics work?

Change one thing, predict, then inspect

  1. Predict what stronger damping might do to the motion.
  2. Run the same seed with --damping 0.8.
  3. Compare the angle and velocity columns against the first run.
  4. Explain which condition stayed the same and which changed. Do not compare wall times as if they were task success.
.venv/bin/bimanual lab --seed 7 --seconds 4 --damping 0.8

The tests check identical traces under the same configuration and a changed trace when damping changes. That is evidence about this controlled numerical example, not about learned robot generalization.

What did the GPU test establish?

bimanual doctor --require-device mps runs a small PyTorch computation on Metal and compares its answer with CPU. MuJoCo rendering uses a different graphics path. Keep those results separate.

The MPS arithmetic probe passes. What follows?