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.
Four pieces of one loop
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.
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 field | Meaning |
|---|---|
| simulation_seconds | Time advanced inside the simulated world. |
| angle_rad | Measured hinge angle, in radians. |
| velocity_rad_s | How fast that angle is changing. |
| action_nm | Torque 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.
Change one thing, predict, then inspect
- Predict what stronger damping might do to the motion.
- Run the same seed with
--damping 0.8. - Compare the angle and velocity columns against the first run.
- 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.