Rust for Physical AI
A language, not a syntax tour. You learn Rust by writing the firmware that drives a 3D rover: every lesson compiles real no_std Rust to WebAssembly and runs it as the live control loop. When the borrow checker rejects a bug, you watch it reject the bug before the robot could ever make it. Ownership and memory safety without a garbage collector, the type system as a modelling tool, zero-cost abstraction, and the one-binary seam from browser sim to bare metal — the substrate (Ferric) that makes the boundary the robot's own, on-device, no cloud: the reasons Physical AI is being written in Rust.
▶ Start the course ← All coursesOwnership: Safety Without a Garbage Collector
Learn ownership, moves, and borrowing as the mechanism that makes a control loop memory-safe at zero runtime cost, and watch the compiler reject an unsafe program before it can run on hardware.
- L4Ownership: the Compiler Catches It FirstUnderstand ownership and moves by reading a real borrow-checker error and fixing it, so firmware that misuses a peripheral fails to build instead of misbehaving on the robot.→
- L4Borrowing: Share Without Giving AwayUse shared and mutable references to pass the peripherals into helper functions without moving them, the everyday tool for structuring firmware into readable pieces.→
Types That Model the Machine
Use Option and enums with exhaustive matching to make illegal robot states unrepresentable, turning 'what if the sensor has no reading?' and 'what if a state is unhandled?' into questions the compiler answers.
- L4Option: No Null, No Silent BugModel a sensor's 'no reading' sentinel as Option<f32> and handle it with match, so a missing measurement can never be used as if it were a real distance.→
- L4Enums: States You Cannot Get WrongModel the controller as an enum state machine and let exhaustive matching force every state to be handled, so an unhandled mode is a build error rather than undefined behaviour on the robot.→
Abstraction at Zero Cost
Build a reusable controller with a struct, a trait, and a generic function, and understand why Rust's abstractions compile down to the same tight code as hand-written math, the property that lets one policy run on a microcontroller.
One Binary, Sim to Edge
Understand why the same Rust source compiles unchanged to both this browser (WebAssembly) and a real microcontroller, and where the real boundary between portable logic and hardware sits.
Fast and Deterministic
Make the loop not just correct but correct on time: no garbage collector means a bounded, repeatable control period. Then compose the whole course into one portable, deterministic firmware.
- L4Correct, and On TimeBuild an eased proportional loop and understand why no garbage collector means a constant-time tick, the property behind reproducible control that the Institute's determinism work depends on.→
- L4Capstone: The Portable, Deterministic ControllerCompose the whole course into one firmware, a Controller trait, a Phase state machine, and a non-blocking heartbeat, and land the rover inside a tight 0.12 m pad with the status LED beating, all in no_std Rust.→
Anatomy demonstrations
The machines behind this course, taken apart three ways — the body, the one rule, and the small learned brain. Guess before you look; an open core proves every number on the page.
From the interactive textbook
The ideas under this course as live explorables — each runs the real Rust library and re-derives its own result.