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 e1
The drift that never stops
Checkpoints · 0 of 2 (waiting for Run)
- Repair the drift: keep the belief on the truth (waiting for Run)
- Hold it: still locked at the end of the run (waiting for Run)
The slip returns, and position fixes lose
Remember lesson 5? The wheels slipped, the encoders never noticed, and your dead reckoning peeled away from the truth. Back then you could only watch it happen. In lesson 13 you learned the counter-move: pull your belief toward a landmark fix. Case closed?
Not quite. The slip is back, for good this time, and your kidnapped robot trick has a blind spot. Slip does not shift where you are so much as it bends which way you face: the right wheel quietly underdelivers, the heading drifts, and the encoders swear everything is fine. Press Run with the starter and watch the error grow even though the position correction from lesson 13 is already in there, running every tick.
The trap is subtle and worth seeing clearly: to work out where the fix implies you are, you walk the range and bearing backward using your own heading. If the heading is wrong, the implied spot is wrong by the same twist, so the pull drags you toward a lie. A position nudge cannot repair a heading.
- 1
Keep the position pull running
The starter already computes the implied spot and pulls
x/ytoward it: your lesson 13 move, intact. Watch it lose anyway.
Correct the heading against tower B
Hold the lock while the wheels keep lying
▸API reference
- Estimator(x, y, theta, gain=0.15, ...)
- Built on Run with your TRUE start pose (nobody kidnapped you this time). The gains are defaults in the signature: edit them in the code and press Run to retune.
- update(v_left, v_right, range_a, bear_a, range_b, bear_b, dt)
- Called every tick with the commanded wheel speeds and BOTH towers' fixes: range in px, bearing in radians relative to your heading (+ = tower to your left). Return your (x, y, theta) belief.
- two towers
- Tower A (the diamond by the loop) anchors your position. Tower B (top right) is your compass: one landmark can never expose a heading lie, because a twisted belief rotated around that same landmark explains its readings perfectly. A second point of reference breaks the symmetry.
- the fixed scenario
- A scripted loop drives the robot. The wheels grip for the first 2 seconds, then the L5 slip starts on the right wheel and never stops. The encoders never see it; only the towers can tell you the truth.
- how you're graded
- Your belief is compared against the hidden true pose. Position-only correction inherits the drifted heading, so its error keeps growing and fails both checkpoints. Correct the heading too and the belief holds.
space pause · r reset · ctrl/cmd+enter run