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 05
Dead reckoning
With no GPS, a robot guesses where it is by counting wheel rotations and adding up every little move: that’s odometry, or dead reckoning. The estimate (the hollow ghost) is what the robot believes; the solid bot is the truth. With perfect wheels they’re glued together. But real wheels slipa little, and the encoders never notice, so every turn quietly adds error the robot can’t see. It compounds: the belief peels away from reality and never comes back.
Checkpoints
- Drive slip-free with YOUR odometry tracking the ghost (waiting for Run)
- Add slip and drive: the estimate peels away (waiting for Run)
- Let the lie grow past 80px (waiting for Run)
Press Run ▸ to start checking your code.
Write the integrator, press Run, then drive a loop with slip at zero: your class must agreewith the engine’s ghost (the ghost stays the engine’s own estimate; your code is graded on matching it). Now raise slip and drive again: watch the belief peel away. Wheels alone lie over time, which is why the next module adds real sensors.
Steps
- 1
Integrate your heading
Turning comes from the wheel difference:
omega = (vr - vl) / 55, thenself.theta += omega * dt. - 2
Integrate your position
- 3
Stay glued to the ghost
▸API reference
- Odometry(x, y, theta)
- Built at the start pose when you press Run, and rebuilt on Reset. Store the pose on self: it must survive from tick to tick.
- update(v_left, v_right, dt)
- Called every tick with the commanded wheel speeds (slider units) and dt = 1/60 s. Return your (x, y, theta) estimate.
- WHEELBASE = 55 · SPEED_SCALE = 1.6
- The engine's geometry: speeds scale by 1.6 to px/s, and the turn rate is the wheel-speed difference over the 55 px wheelbase.
- how you're graded
- The hollow ghost stays the ENGINE's own dead-reckoning. Checkpoint 1 checks your class AGREES with it (within 8 px) while you drive slip-free. Then the slip slider shows why every estimate eventually lies.
space pause · r reset
Simulator
How much the wheels slip in reality: the encoders never see it.