KIPR · Botball Explorer
Activity Sections

Discovery · Coding Project 4

Out and Back

Off the block and onto the field. This is the first project that scores points.

Project
Coding Project 4
Strand
Coding
Phase
Make It Move
Time
One class period
What You Are Doing
Driving out of the starting box, stopping clearly , and driving back in — then making it work the same way every time.
Mission Anchor
Mission 1 — Waypoint Alpha · Mission 10 — Waypoint Bravo (base + bonus)
Before You Start
Project 3 — motors plugged in, both LEDs green, and you can write a working motor() program.
What You Need
Before you start: type your PIN in the box at the top of the page. Your teacher gave you this number. When you finish, press Submit & Download to turn in your work and save a copy.

Try It — Read the Mission First

You are about to score real points. Before you write a single line of code, find out exactly what the judge is looking for.

Watch Mission 1 video

Base Mission

1 point Live judged

A robot enters the zone adjacent to the left starting box and comes to a clear and complete stop while .

Bonus Mission

1 point Live judged

The same robot that completed the Base Mission subsequently returns a starting box and comes to a clear and complete stop.

Scores

  • Robot enters the zone and visibly stops.
  • Robot enters the zone, stops, later returns a starting box, and visibly stops.
  • Robot enters the zone, pauses, performs a servo action while remaining stationary, and then departs.

Does Not Score

  • Robot drives through the zone without stopping.
  • Robot slows significantly but never clearly stops.
  • Robot enters the zone, immediately reverses direction, and leaves without stopping.
  • One robot completes the Base Mission while a different robot completes the Bonus Mission.
Mission 10 — Waypoint Bravo is the same mission on the other side: the zone next to the right starting box. Everything you learn here works for both.

⚠ They Do Not Share a Return Trip

Mission 1 and Mission 10 must be completed independently. One drive back into a starting box cannot pay for both bonuses. Each one needs its own out-and-back run.

What scores and what does not

Walk it first

Do not program yet. Put your robot in the starting box, then push it by hand through the whole mission — out to the zone, stop, back into the box.

Now measure and write down what you just did.

MeasurementMineUnit
Distance from the starting box to the middle of the zoneinches
How far the zone reaches, front to backinches
How wide my robot isinches
How long my robot isinches

Look at the zone depth and your robot’s length. How much room for error do you actually have?

Learn It — Straight Is Harder Than It Looks

You already know how to make both wheels turn. Here is the part nobody warns you about: equal power does not mean equal speed.

Send 50 to both motors and your robot will drift. Every robot does. The reasons are physical, not programming mistakes:

  • No two motors are built exactly alike.
  • The wheels may not be mounted perfectly straight.
  • One wheel has more friction than the other.
  • Weight is not spread evenly across the robot.

The Fix Is in the Numbers

You cannot make the motors identical. You can give them different numbers so they end up going the same speed.

If your robot drifts left, the left wheel is going too slow — or the right one too fast. Speed up the left, or slow down the right.

If it drifts right, do the opposite.

Change one wheel at a time, by 2 or 3 at a time. Big jumps and you’ll struggle to align the wheels.

It Will Drift Again Later

The correction that works on a cold robot may not work after twenty runs — motors change as they warm up. The more power you use, the bigger the correction you need. Expect to re-check this on competition day.

Reverse is just a minus sign

Positive power drives forward. Put a minus in front of both numbers and the robot backs up along the same path.

// Forward
motor(0, 50);
motor(3, 50);

// Backward
motor(0, -50);
motor(3, -50);

Shape of the program

Every out-and-back run has the same five moves. Write it as before you write it as code.

Code / partWhat it means
1. Drive forwardOut of the starting box, toward the zone.
2. StopNot a slow-down. A stop.
3. WaitLong enough for the judge to see it. Base mission scored here.
4. Drive backwardBack toward the starting box.
5. Stop the box. Bonus scored here.

Why does step 3 exist? What happens to your score without it?

White space is free

Leave a blank line between each move. It costs nothing and makes the sections of your program obvious at a glance.

// Out
motor(0, 50);
motor(3, 50);
msleep(2000);

// Stop and hold
ao();
msleep(30);
msleep(3000);

// Back
motor(0, -50);
motor(3, -50);
msleep(2000);

// Stop in the box
ao();
msleep(30);

Do It — Drive the Mission

Step 1 — Mark your starting position

Your robot must start in the same spot every single run, or nothing you measure means anything. Put it in the starting box and decide exactly how you will place it — against a wall, on a mark, lined up with a corner.

Describe how you place your robot so it starts identically every time:

Step 2 — Get out to the zone

Create a new project called Waypoint. Put at the top. Drive forward and stop — that is all for now.

Start with power 50 and guess a time. Run it. If you stopped short, add time. If you overshot, take time away.

Trymsleep valueWhere the robot ended up
1
2
3
4

Step 3 — Fix the drift

Watch which way your robot pulls as it drives out. Then adjust one wheel’s power — small changes only.

TryLeft powerRight powerWhich way did it drift?
1
2
3
4
Left wheel powerRight wheel power

Step 4 — Make the stop obvious

Add ao(); then msleep() so the robot sits still in the zone. The mission says stop — the judge needs to see it.

How long did you make the robot wait, and how did you decide?

Test it on a person. Have a teammate watch a run and ask them, without warning, whether the robot stopped. If they hesitate, it is not long enough.

Step 5 — Come home

Now add the return trip. Same powers, both negative. Same drift correction — do not swap which wheel gets the smaller number.

The robot must end the starting box. Not the line. Not hanging over the edge. Every part inside.

Did you have to make the backward time different from the forward time? Why might that happen?

Step 6 — Run it five times

One good run is luck. Five good runs is a program. Run the whole mission five times without changing anything and record what happens.

RunStopped in the zone?Returned fully within?Points
1
2
3
4
5

Did all five runs come out the same? If not, what changed between them?

Step 7 — Do the other side

Mission 10

Waypoint Bravo

Watch Mission 10 video

Base Mission

1 point Live judged

A robot enters the zone adjacent to the right starting box (Starting Box B / Bravo) and comes to a clear and complete stop while .

Bonus Mission

1 point Live judged

The same robot that completed the Base Mission subsequently returns a starting box and comes to a clear and complete stop.

Scores

  • Robot enters the zone and visibly stops.
  • Robot enters the zone, stops, later returns a starting box, and visibly stops.
  • Robot enters the zone, pauses, performs a servo action while remaining stationary, and then departs.

Does Not Score

  • Robot drives through the zone without stopping.
  • Robot slows significantly but never clearly stops.
  • Robot enters the zone, immediately reverses direction, and leaves without stopping.
  • One robot completes the Base Mission while a different robot completes the Bonus Mission.

Copy your program into a new project called Waypoint Bravo and run Mission 10 from the right starting box.

Remember the rule: each mission needs its own out-and-back. You cannot score both bonuses with one trip home.

Did the same numbers work on the other side, or did you have to change them? Why do you think that is?

Score It — Checkpoint

My score

Mission partScored?Points
Mission 1 — Base (stop )1
Mission 1 — Bonus (return )1
Mission 10 — Base (stop )1
Mission 10 — Bonus (return )1
My total4

My numbers

Keep these. Project 5 starts from your straight-driving powers.

SettingValue
Left wheel power for driving straight
Right wheel power for driving straight
Time to reach the zone (ms)
Time to get back to the box (ms)
How long the robot holds still (ms)

Can you do it again?

Think about it

Your robot scored, but nothing in your program knows where the robot actually is. It only knows how long to push. What could go wrong on competition day that would make your timing wrong?

A teammate’s robot stops just past the zone line every time. Name two different things they could change, and say which one you would try first.

Which was harder — getting the robot to the right place, or getting it to do the same thing five times? What does that tell you?

Next

In Project 5 — Learning to Turn, the robot stops going in straight lines. You will use your straight-driving numbers as the starting point and learn the two ways to make a turn — and the three shapes a turn can have.

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