Click & Whirr needs a wider screen
Open it on a laptop or desktop (1280px or wider recommended). The Learn · Code · Watch workspace needs the room to breathe.
Lesson 10
The gauntlet
Checkpoints · 0 of 4 (waiting for Run)
- Swerve past the first crate (waiting for Run)
- Reach the finish pad (waiting for Run)
- Finish without a single crash (waiting for Run)
- Clean run under 14 seconds (waiting for Run)
One controller, all of it
Everything your robot has learned, at once, against the clock. This is the robot you built, and for the first time it runs on the library you built.
Here is the route you planned, and somebody left crates on it. One controller has to do it all: follow the route with the PurePursuit you wrote in lesson 8, imported straight from mybot; see the crates with the three distance rays from lesson 6; and switch between those behaviors the way lesson 9 taught you, with a mode latched on self.state from tick to tick.
Neither behavior survives out there alone. A follower that never looks up plows straight into the first crate, and a dodger that never looks back loses the route. And this time you are scored: the clock starts at reset, a crash sends you back to the start, and the clock does not care.
Read the skeleton in the editor. The import line pulls three pieces from your library; if one is missing, the banner above the editor offers the vetted reference, so nothing blocks you. The glue builds your PurePursuit in __init__ and starts in follow mode. The only thing it cannot do yet is change its mind.
Switch to dodge when a crate looms
Reach the finish pad
Finish without a crash
Clean run under 14 seconds
▸API reference
- from mybot import …
- Your own library: the pieces you earned by passing lessons 06, 08, and 09. Missing one? The banner above the editor offers the vetted reference.
- Capstone(lookahead=75, base=70)
- Built once when you press Run, from the defaults in your __init__ signature. It hands lookahead and base straight to your PurePursuit.
- step(front, left, right, aim_at)
- Called every tick: the three distance rays (px, bigger = more open) plus the route aim function aim_at(L). Return a (left, right) tuple.
- self.state (str)
- Your current mode, shown live on the scoreboard's MODE readout.
- lookahead / base defaults (tuned in code)
- Your tuning surface lives in the signature. Edit the base default, press Run, and a fresh controller (and the PurePursuit inside it) drives with the new value. Reset also rebuilds from your source.
space pause · r reset
Simulator
This lesson imports PurePursuit, RobotStateMachine, avoid from your library. You haven’t built them yet.