Programming Physical AI
One simulated differential-drive rover, commanded at three rising depths — visual blocks, Python scripting, and bare-metal MCU — re-solving the same tasks at each depth until you can choose the right level of abstraction for a physical-AI task and prove it.
▶ Start the course ← All coursesOne Loop, Visible — Visual Control
Make the rover sense, decide, and act with drag-and-drop blocks, and see the Python each block runs.
- L0The Embodied LoopWire a sense->decide->act loop that drives the rover forward and halts it within 0.25 m of the goal with no overshoot.→
- L1React and AvoidBuild a reactive rule-based behavior using conditionals so the rover avoids an obstacle and still reaches the goal with zero collisions.→
- L2Blocks Are PythonRead the Python generated by a block program and correctly predict the effect of editing a single generated line before running it.→
Into the Code — Classical Control
Re-implement and surpass block behaviors in real Python: read sensors into a state estimate, close a PID loop, plan with a state machine.
- L2Reading the WorldWrite control(obs) that reads the rover's goal_bearing each step and steers toward the goal pad, turning the differential-drive wheels so the rover reaches the goal within tolerance instead of driving blind.→
- L2The PID LoopWrite a proportional heading controller in Python control(obs) that eases the rover onto a goal pad within a tight 0.12 m tolerance, with no overshoot or weave.→
- L2Plan With a State MachineDesign a finite-state controller in Python control(obs) that switches modes (SEEK far away, ARRIVE up close, AVOID near a wall) to drive the real MuJoCo rover onto the goal pad and settle within tolerance.→
Make It Learn — Policies in Sim
Replace hand-tuned control with learned behavior: classify, train an RL policy, and clone a demonstration in-sim.
- L3Learn From DataTrain a simple classifier mapping sensor readings to a discrete action and run it on the rover, meeting held-out accuracy >= 0.85 and goal completion with zero collisions.→
- L3Reinforcement LearningDefine a reward function and train an RL policy in-sim to convergence (smoothed reward >= 6.0) with a greedy rollout that reaches the goal safely and efficiently.→
- L3Imitation and Sim-to-RealClone a demonstrated trajectory with behavioral cloning to RMSE <= 0.12 m and correctly explain why a sim-perfect policy can fail on real hardware.→
Down to the Metal — Embedded Rust
Drop below Python: write real no_std embedded Rust firmware against the rover's peripheral HAL, compiled to WASM and run as the actual control loop.
- L4GPIO, Peripherals & the Control LoopWrite your first no_std Rust firmware: own the rover's peripherals, blink a GPIO LED, and drive the motors from the control loop to reach the goal.→
- L4Timers, PWM & Proportional DriveUse PWM motor channels and the millisecond clock to replace bang-bang control with a smooth proportional controller that settles in the pad without overshoot.→
- L4Async Tasks & the Real-Time LoopStructure firmware the Embassy way — concurrent concerns on one real-time loop — by running a navigator AND a fixed-rate LED heartbeat off the millisecond clock, without blocking.→
Capstone — Autonomy, Then Optimized
Build full rover autonomy in Python, then move the critical control loop to the metal and prove the timing win.
- L3Full Autonomy in PythonCombine perception and control into one robust control(obs) that reliably drives the differential-drive rover to the goal pad within tolerance on real MuJoCo physics, fixing a partial starter controller.→
- L4Optimize the Critical Loop to the MetalRe-implement the full autonomy control loop as no_std embedded Rust firmware against the rover HAL — proportional steer-and-ease plus a non-blocking heartbeat — and prove it lands the rover inside a tight 0.12 m tolerance running directly on the metal.→