Challenge 1
Drive at the big tree at B at a fixed speed and stop when the Ultrasonic Sensor reaches your target distance. Note how far past the target the robot ends up.

EV3 Robotics›Level 4 · WRO Prep›Lesson 11
Level 4 · Lesson 11 · EV3-L04-1160 minutes · Block 2 of 6 · Mat: WRO 2022 — My Robot My Friend, The Garden Robot
Drive up to the big tree at B and stop exactly where you meant to — every time, from any starting distance.
Your robot currently has one speed: the speed you typed. It drives at that speed until a sensor says stop, and then it stops — except it does not, quite, because it was still travelling when the decision was made. Today you replace the typed speed with a speed the robot works out for itself.
P only, today. There are two more letters in PID and you will meet both in Block 4. Adding them now would mean you could not say which one solved which problem. Get proportional control working, and leave it wanting.
Work on the HOME to B approach — the big tree sits almost straight up from the base pad, which makes it the cleanest place on the garden mat to drive at something and stop.
Set your target distance and write it down before you program anything. Every number you collect today is meaningless unless you know what the robot was aiming at.
Start with the word that makes the rest make sense. Error is how wrong you are right now: the distance you are at, minus the distance you want.
Far away, the error is large. Close in, the error is small. When you arrive, the error is zero — and if you overshoot, the error goes negative, which is the robot’s way of saying it should back up.
Bang-bang control from Block 1 ignored all of that. It asked one question — am I there yet? — and knew only two answers. Proportional control asks a better question: how wrong am I, and by how much? Then it makes the correction the same size as the mistake.
Speed becomes error multiplied by a constant. Engineers call that constant the gain. A big error gives a big number and the robot moves briskly; as the gap closes the number shrinks by itself, and the robot eases in and settles. Nobody programmed “slow down near the end” — it falls out of the maths.
You have felt this before. Walking towards a door you do not travel at one speed and stop dead — you slow as you arrive. Reaching for a glass, your hand moves fast at first and creeps at the end. Proportional control is that behaviour, written down.
Two things to watch for. If the gain is too small, the robot crawls the last stretch and may never quite arrive. If it is too big, the correction is larger than the mistake: the robot rushes in, overshoots, corrects backwards too hard, and oscillates. Both are worth seeing today.
No building today, but two checks before you program, because both will waste your afternoon if they are wrong.
Check the Ultrasonic Sensor is looking where you think. Put the robot a known distance from a flat surface, read the port view, and compare it with a ruler. A sensor mounted a few degrees off reads a longer distance than the truth and gets worse as you close in.
Check your attachment is not in the beam. Lesson 10’s arm sits at the front of the robot. If any part of it crosses in front of the sensor, the robot will think it has arrived while it is still halfway across the garden. Raise the arm to its travel position and read the sensor again.
Build it in two stages, and run the first one before you improve it.
Stage one — the fixed-speed version. Drive forward at a constant speed inside a loop, and leave the loop when the Ultrasonic reading reaches your target. Run it and note where the robot actually stops. That gap is your overshoot, and you want the number.
Stage two — the proportional version. Inside the loop, each time round: read the distance, subtract the target to get the error, multiply by your gain, and use the result as the motor power. Start with a small gain.
Two details decide whether this works. Clamp the power — far from the tree the error is large and the maths will happily ask for a power the motors cannot give, so cap it at something sensible. And set a floor: below a certain power the robot hums and does not move, so if the number falls under that, treat the approach as finished and stop.
The gain is the only number you touch today. Run the approach three times from the same start and record, each time, how far past the target the robot ended and how long it took to settle.
Six numbers, three gains. Keep the gain that arrives quickly without overshooting, and write down why you rejected the other two — the reason is worth more than the number.
Approach the big tree at B from three clearly different starting distances — close, middling and right back at HOME — without changing the program between runs.
All three should finish within the same small tolerance of the target. That is the whole claim of proportional control: one rule that copes with any starting error, instead of a number tuned for one particular start.
Today’s entry:
This model drives, so its challenges are run on a mat. Mats differ between branches — check you are looking at the one in your room.

WRO 2022 RoboMission Elementary — My Robot My Friend — The Garden Robot · official WRO game mat, 2362 × 1143 mm
The challenges name these places rather than distances, so the same challenge works on any mat:
Switch mats above and every route below is redrawn on the mat you chose.
Work through the challenges in order — each is harder than the last. The mission comes after all three, and it is meant to make you plan before you build.
Drive at the big tree at B at a fixed speed and stop when the Ultrasonic Sensor reaches your target distance. Note how far past the target the robot ends up.

Replace the fixed speed with a speed proportional to the error, so a big gap drives fast and a small gap drives slow. Watch it settle instead of slam.

Halve your proportional constant, then double it. Record what each does to the overshoot and to the time taken to settle.

Approach the big tree at B from three different starting distances and stop within the same tolerance every time, without overshooting once. Record the three settling times.
