Physics Simulation for Robot Learning
Training a robot policy directly on physical hardware is slow and nerve-wracking — a single bad exploration step can snap a 3D-printed finger or trip a breaker. Fast physics simulators let us trade wall-clock waiting for parallel compute, running thousands of robots at once before touching a single real screw.
Core ideas covered in this module
- Vectorized parallel rollouts
- Observation space design
- Action space selection (joint vs. EEF deltas)
Vectorized contact simulation on GPUs
If you've ever watched one robot fail a grasp fifty times in a row, you know how painful single-threaded data collection feels. Modern simulators like MuJoCo MJX and Isaac Lab solve this by vectorizing physics: instead of stepping one robot on one CPU core, they pack 4,096 copies of the environment into GPU arrays and step all of them in lockstep.
At 50,000+ simulated frames per second, an afternoon of real-world practice turns into years of robotic trial and error before your coffee gets cold. The catch is that simulation only helps if you design clean observations and pick the right action space.
Designing observations and picking an action space
A clean observation vector gives the policy everything it needs to act without tempting it to memorize irrelevant quirks. For manipulation or locomotion, that usually means joint positions, joint velocities, the previous action (so the policy knows what it just asked for), and goal offsets expressed in a local frame.
Choosing the action space is just as important, and it ties directly back to Course 1 coordinate frames and Course 4 PD controllers. You're usually picking between three options:
- Joint Space deltas: output Δq for each hinge, fed to a joint PD controller. Fast and simple, but tied to one robot geometry and sensitive to workspace shifts.
- Base-Frame EEF deltas: output [Δx, Δy, Δz] in the robot's base frame and let IK convert to joint angles. Cleaner paths, though world-anchored shifts still require re-aiming.
- Wrist-Frame deltas: express motion relative to the gripper or wrist camera ('move 2 cm toward what I see ahead'). Shifts in table position barely faze it because local geometry stays invariant.
Interactive lab
Action Space Comparison Arena
Canvas / SVG· LiveDots show each policy decision step (20 ms holds). Dashed gray line shows the straight-line reference to the shifted mug.
Rollout Diagnostics
Why frequency and frames show up together
Notice in the arena what happens when you drop Policy frequency from 50 Hz down to 10 Hz. Each policy command gets held constant for 100 milliseconds while the underlying PD loop keeps stepping, producing visible corner-cutting and choppy accelerations. Running the exact same policy at 50 Hz smooths out those kinks immediately.
At the same time, look at the Table shift slider: Joint Space blindly replays old joint targets and misses the shifted mug by nearly the full table offset, whereas Wrist Frame Δ stays locked onto the local target relative to the gripper. Picking the right frame gives you generalization for free before you even collect extra training data.
Action space as a low-level PD target
q_target = q + Δq (Joint) | q_target = IK(T_base←eef · ΔT_wrist) (Wrist Δ)
Even when policies act in Cartesian or wrist coordinates, a Course 4 joint PD controller (τ = Kp(q_target − q) − Kd q̇) ultimately drives the motors.
You train a tabletop wiping policy using only a wrist-mounted camera, and then someone rolls the table 25 cm to the left. Which action representation breaks the least without retraining?
In production VLA and teleoperation stacks, policies almost never output raw torques; they output either delta joint positions or delta end-effector poses at 20–50 Hz into a damped IK/PD controller.
Hands-On Python Notebook
02 · Vectorized Rollouts & Action Space Selection
Step hundreds of parallel reaching environments in NumPy and compare Joint Space, Base EEF Delta, and Wrist-Frame action spaces.
Try this on your own inside the notebook
- Benchmark vectorized NumPy rollouts across 512 parallel environments
- Shift the goal table by 25 cm and compare wrist-relative vs. base-frame error
In Google Colab, use File → Save a copy in Drive to keep your own edits and notes. Or download the files directly:
uvx marimo edit --sandbox notebooks/course-6/02_physics_sim_action_spaces.pyWrap up this module
Saved automatically in your browser profile so you can pick up right where you left off.