Today’s mission 5 min
Take your robot apart to loose parts, rebuild it against the clock, and re-measure every number before you trust it.
At WRO you bring your programs, but not your robot. It is built on the day from loose parts. Your code is the same; your robot is new. Today you practise turning one into the other quickly.
Check this season’s General Rules for what you may bring, how long the build-and-program time is, and the size the robot must fit at the start.
The idea — a new robot needs new numbers 10 min
Your program depends on numbers you measured on the old robot. A rebuilt robot is never quite the same. A wheel sits one hole further out. A sensor sits a little higher. So these numbers must be measured again:
- wheel_diameter — sets how far
straight()goes. - axle_track — sets how far
turn()turns. - Colour thresholds — set where the line follower and the square-up see black and white.
- Attachment positions — check that homing still finds the same stop.
Two things make a rebuild fast:
- A build photo sheet. Photos from the front, back, both sides, top and bottom, plus close-ups of anything tricky: the drive gears, the sensor mounts, the attachment joints. Label the ports on the photo.
- A calibration program. One program that measures every number for you and prints it, so re-tuning takes minutes, not guesses.
Measure in this order. Wheel diameter first, because axle track depends on it. Then axle track. Then colours.
Blocks vs Python 10 min
In SPIKE you set one number: how far one motor rotation moves the robot. In Pybricks you set two: wheel diameter and axle track. Both are corrected the same way: ask for a distance, measure what you got.
SPIKE word blocks
when program starts :: events hat set movement motors to (A+B v) :: movement set 1 motor rotation to (17.5) [cm v] moved :: movement move [↑ v] for (100) [cm v] :: movement
Pybricks Python
from pybricks.hubs import PrimeHub from pybricks.pupdevices import Motor from pybricks.parameters import Port, Direction from pybricks.robotics import DriveBase WHEEL = 56 # mm, the value you are testing AXLE = 112 # mm hub = PrimeHub() left = Motor(Port.A, Direction.COUNTERCLOCKWISE) right = Motor(Port.B) robot = DriveBase(left, right, WHEEL, AXLE) robot.straight(1000) print("Measure with a ruler. New WHEEL =", WHEEL, "x measured / 1000")
| Block | Python | Watch out |
|---|---|---|
| set 1 motor rotation to 17.5 cm | DriveBase(left, right, WHEEL, AXLE) | SPIKE wants cm per rotation. Pybricks wants the wheel diameter in mm. |
| move ↑ for 100 cm | robot.straight(1000) | 1000 mm. Use a long distance: small errors are easier to see. |
| (nothing) | new WHEEL = WHEEL × measured ÷ 1000 | Went too far? The new value comes out bigger. That is correct. |
SPIKE word blocks
Pybricks Python
from pybricks.tools import wait robot.use_gyro(False) while not hub.imu.ready(): wait(10) hub.imu.reset_heading(0) robot.turn(360) wait(500) actual = hub.imu.heading() print("asked 360, turned", actual) print("new AXLE =", AXLE * 360 / actual)
| Block | Python | Watch out |
|---|---|---|
| (nothing) | robot.use_gyro(False) | Switch the gyro OFF for this test, or it corrects the very error you are measuring. |
| (nothing) | hub.imu.reset_heading(0) | Only allowed while the drive base is not using the gyro. |
| (nothing) | AXLE * 360 / actual | Turned too far? The new axle track comes out smaller. |
Write it from scratch 10 min
Write one program called calibrate, on your current robot, before anything is taken apart. It runs three tests in order and prints a new value for each:
- Distance. Drives 1000 mm. You measure with a ruler and type the result into the formula.
- Turning. Turns 360° with the gyro switched off, and prints the new axle track.
- Colours. Waits for a button, prints both sensors on white; waits again, prints both on black; prints the halfway threshold for each.
The colour step
def read_both(label): print(label, "left", left_eye.reflection(), "right", right_eye.reflection()) # robot on white, press LEFT, then robot on black, press LEFT white_l = left_eye.reflection() # ... read black_l the same way ... print("LEFT threshold", (white_l + black_l) // 2)
Before you strip it 10 min
Check you have everything a rebuild needs. Tick each one:
- Photo sheet: six sides and the close-ups, with the ports labelled. Could a stranger rebuild it from these?
- Program backup: every mission program, your
baselibrary andcalibrate, exported from Pybricks Code and saved somewhere other than this laptop. - Current numbers: wheel, axle and both thresholds, written in your journal. These are the “before” values.
- A test route: one short leg you will run after the rebuild to prove the robot is right.
Break it, fix it 5 min
Three calibration programs, one mistake each.
Bug 1
robot.use_gyro(True)
hub.imu.reset_heading(0)
robot.turn(360)
print("turned", hub.imu.heading())Bug 2
robot.straight(1000)
measured = 1032
print("new WHEEL =", WHEEL * 1000 / measured)Bug 3
left = Motor(Port.A) right = Motor(Port.B) robot = DriveBase(left, right, WHEEL, AXLE) robot.straight(1000)
Bug 3 gives no error. Run it and watch which way the robot goes. Then check the port list at the top of every Level 5 lesson.
Solo challenge — strip, rebuild, re-tune 35 min
No coach, no help. At WRO your coach may not touch the robot or the code. Close this page. You may use your own photo sheet, your own programs and the Pybricks documentation, nothing else.
- Strip. Take the robot apart to loose parts. No sub-assemblies: every beam, axle and pin separate. The hub and motors may stay whole.
- Rebuild (clock on). Rebuild from your photo sheet. Your coach records the time when you say “built”.
- Re-tune. Run
calibrate. Put the new numbers intobase. - Prove it. Run your test route. Your coach records the time when it runs correctly.
Done means: the test route runs correctly, all four new numbers are in your journal beside the old ones, and you know your rebuild time.
Engineering journal 5 min
Today’s entry:
- rebuild time, and re-tune time
- old and new wheel, axle and both thresholds, side by side
- the one photo you wished you had taken
- any part you built wrongly, and how the test route showed it
- one change to the robot that would make the next rebuild faster