Base Mission
9 points Final judgedAt least one cube originating from the Spilled Cube area is the Large Green Cube.
Discovery · Coding Project 15
The sensor stops being a stop sign and becomes a steering wheel.
Student PIN:
Put your robot on the field with the sensor over a black line. Open the Sensor List, then push the robot sideways by hand, slowly, across the line and off the other side. Watch the number the whole way.
| Sensor sitting… | Reading |
|---|---|
| Well off the line, on white | |
| Right at the edge, half on and half off | |
| Dead center of the line | |
| Right at the other edge | |
| Well off the other side, on white |
Your robot drifts off the line. Just from the number, can it work out which way it drifted?
⚠ One Sensor Cannot Stay on the Middle
Sitting on the center of the line, everything looks the same in both directions. Drift left, the reading goes up. Drift right, the reading goes up. The robot has no idea which happened, so it cannot know how to correct.
Following the middle of a line with one sensor is impossible. So you do not.
Put the sensor on one edge of the line and everything becomes answerable. Now dark and light mean two different directions, which you can write using two conditions.
The Robot Won't Straight
It zigzags. Too dark, arc one way. Too light, arc back. Over and over, several times a second.
From a distance it looks like the robot is following the line. Up close it is constantly overcorrecting — and that is exactly what makes it work.
This is a while loop with an if inside it. You have had both since Projects 10 and 13 — this is the first time they work together.
// Keep going until someone stops me
while (a_button() == 0)
{
// I see black: I drifted onto the line
if (analog(line) > threshold)
{
// Arc away from it
motor(left, 20);
motor(right, 60);
}
// I see white: I drifted off the line
else
{
// Arc back toward it
motor(left, 60);
motor(right, 20);
}
}
motor(0, 0);
motor(3, 0);
msleep(30);| Code / part | What it means |
|---|---|
while (...) | Keeps the whole thing repeating. Without it the robot checks once and gives up. |
if / else | Picks one of two steering actions, every single time through. |
no ao() inside | Never stop the motors inside a line-follow loop. The robot should steer continuously, not stutter. |
⚠ Never One Motor Forward and One Backward
It is tempting to make the turns sharper by reversing a wheel. Do not. In a loop that switches direction several times a second, reversing a motor over and over will burn it out.
Use two different positive speeds. A big gap between them gives a sharp turn; a small gap gives a gentle one.
That is the same rule you found in Project 5 — the further apart the two power numbers, the sharper the curve. It has been true this whole time.
| Problem | Try this |
|---|---|
| Wanders off the line and never comes back | Bigger gap between the two speeds — turn harder |
| Zigzags so wildly it barely moves forward | Smaller gap — turn more gently |
| Loses the line on sharp corners only | Slow the whole thing down, or sharpen just the inside turn |
| Follows for a while then drives off | Check your threshold — it may be right for one part of the field and wrong for another |
Line following on its own goes forever. To be useful it has to stop for a reason — a count, a bump, or a second line crossing the first.
cmpc(left);
// Follow for this far, then move on
while (gmpc(left) < 5000)
{
if (analog(line) > threshold)
{
// Arc away
}
else
{
// Arc back
}
}
motor(0, 0);
motor(3, 0);
msleep(30);Now the line keeps you straight and the counter tells you when you have arrived. Two sensors doing two different jobs in one loop.
Create a new project called Line Follow. Start with the two-choice loop. Put the sensor on the left edge of a line and let it run until you press a button.
| Try | Slow motor | Fast motor | What it did |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| 4 |
Move the robot to the other edge of the same line and run the identical program.
What happened, and why?
Straight lines are easy. Find a line on the field that bends and follow that.
Wrap the follower in a tick count so it travels a set distance and then hands over to whatever comes next. This is the pattern every mission below uses.
Turn it into a while you are at it — follow_line(int ticks).
Mission 16 At least one cube originating from the Spilled Cube area is the Large Green Cube. Two or more cubes originating from the Spilled Cube area are the Large Green Cube.Freight Shelving
Watch Mission 16 video
Base Mission
9 points
Final judgedBonus Mission
11 points
Final judgedScores
Does Not Score
⚠ The Large Green Cube, Not a Small One
The target is the large palletized Green Cube field element — not the small green cubes you have been stacking since Project 8. Make sure your team is aiming at the right thing.
Robot support is permitted, but this is final position scored — so the cube has to still be up there at the end, which means letting go cleanly.
Mission 17 At least one cube originating from the Unstraight Cube area is the Large Brown Cube. Two or more cubes originating from the Unstraight Cube area are the Large Brown Cube.Freight Racking
Watch Mission 17 video
Base Mission
9 points
Final judgedBonus Mission
11 points
Final judgedScores
Does Not Score
Same Job, Different Address
This is Mission 16 with two words changed. If you wrote Mission 16 as a function with , this one costs you almost nothing — which is the reward for the work you did in Project 12.
⚠ Watch Your Cube Budget
The Unstraight Cubes are the same three you stacked for Mission 13 back in Project 10. A cube can only be in one place at the end of the match. Decide now which missions you are actually going for.
Mission 7 One Blue Pom and one Orange Pom are the same PVC enclosure. A second PVC enclosure contains at least one Blue Pom and at least one Orange Pom, each the enclosure. The Base and Bonus must use different enclosures.Hazard Containment
Watch Mission 7 video
Base Mission
11 points
Final judgedBonus Mission
9 points
Final judgedScores
Does Not Score
Mission 6 Place all four Green and Yellow Cubes onto a single pallet. A cube is on the pallet if touching the upper surface or another cube that is on the pallet. The pallet is a starting box and is not touching any black line.Pallet Builder
Watch Mission 6 video
Base Mission
15 points
Live judgedBonus Mission
7 points
Final judgedScores
Does Not Score
The Arrangement Does Not Matter
Four cubes flat on the , a four-high tower, or anything in between — all of it scores, as long as every cube is part of one palletized load. Pick whatever your claw finds easiest.
Better still: the cubes are not required to stay on the pallet after the base is scored. It is live judged, so once the judge has seen four cubes on the pallet, you can go on and move the pallet without worrying about a cube rolling off.
⚠ Not Any Black Line
The bonus is stricter than it looks. The pallet must be the starting box and not any black line. Push it in too far or not far enough and you get nothing.
These are the same four green and yellow cubes you used for Mission 3 in Projects 8 and 13. What is your plan — Mission 3’s stacks or Mission 6’s pallet?
| Run | M16 | M17 | M7 | M6 base | M6 bonus | Points |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | ||||||
| 3 | ||||||
| 4 | ||||||
| 5 |
| Mission part | Scored? | Points |
|---|---|---|
| Mission 16 — Base (spilled cube on the Large Green Cube) | 9 | |
| Mission 17 — Base (unstraight cube on the Large Brown Cube) | 9 | |
| Mission 7 — Base (blue + orange in one enclosure) | 11 | |
| Mission 6 — Base (four cubes on one pallet) | 15 | |
| Mission 6 — Bonus (pallet in a starting box) | 7 | |
| My total | 51 |
| Setting | Value |
|---|---|
| Threshold I use for following | |
| Slow motor power | |
| Fast motor power | |
| Which edge I follow (left or right) |
Your line follower checks and steers several times a second and never drives perfectly straight. Would a person following a line with their eyes shut, feeling for the edge with a foot, do anything different?
A second sensor, mounted a few inches away from the first, would let the robot see both edges at once. What could it do then that it cannot do now?
Missions 16 and 17 want two or more cubes for the bonus, and Mission 7 wants a second enclosure. Look at how you wrote these runs. What would it take to do each one a second time?
You have written every skill this game needs. What you have not done is tidy up — your functions live in one long file, and half your missions have a bonus that just means “now do that again.”
In Project 16 — Building Your Toolbox, your functions move into a you can carry between projects.
KIPR · Botball Explorer — Discovery Projects · © KISS Institute for Practical Robotics 1997–2026
When you are finished, press the button to turn in your work and save a copy.
KIPR · Botball Explorer · Discovery