Teaching at home? The family edition is the same lesson, written for a parent and one to three kids.

Slides for the board (PowerPoint, 12 slides) Lesson PDF Google Slides: upload the PowerPoint file to Google Drive and open it with Google Slides.

Robot Soccer Lab: Get Behind the Ball, Why Driving Straight at It Fails

Grades 6-8 · 45 minutes · Computer science

Level 1 of Robot Soccer Lab starts with a program that sounds right: turn until the ball is straight ahead, then drive at it. The robot does exactly that, from the ball's wrong side, and pushes it into its own goal. Students find out why, then put in card one: when the ball is not in front, move round it, aiming 60 degrees past it. The robot comes up behind the ball and scores in the blue goal. They test other offsets and see which ones work. Level 2 asks for three touches without turning, which omni wheels allow, and Level 3 asks for a goal while facing the goal, which needs the compass and a buffer so the robot does not twitch.

At a glance

Essential question

Why does driving straight at the ball fail, and what plan works instead?

Objectives

Students will be able to:

  • explain why driving straight at the ball can score an own goal
  • read a sensor as a clock position and turn it into an angle
  • change a program that uses if, else if and else, and predict what it will do
  • test one number at several values and record each result
  • split a robot's job into parts: find the ball, get behind it, face the goal

Vocabulary

Sensor, Ball clock, Omni wheels, Offset, Compass heading, Buffer

Standards

2-AP-12, 2-AP-13, 2-AP-17

Time and materials

45 minutes, grades 6-8.

  • One computer or Chromebook per student
  • A projector
  • The worksheet and exit ticket, one copy each per student
  • The rubric, one copy per student if you grade the work

Prep

Make copies of the worksheet and exit ticket. Before class, open mytekdev.com/try/robotsoccerlab?lesson=get-behind-the-ball-why-driving-straight-fails&ref=tpt-robotsoccerlab-1 once on a student computer, which checks that your school's filter allows the app, and follow the short guide yourself: about ten minutes.

Assessment

  • Formative: the questions under What to look for, asked while students work, and the exit ticket (answer key included).
  • Summative: the worksheet, scored with the rubric.

Technology and privacy

Runs in any browser, Chromebooks included, with nothing to install. Students need no account and no email: the link works signed out, and nothing they do is stored on our server unless they choose to save.

Lesson sequence

MinutesStageWhat you doWhat students do
0 to 5Warm-up
Hook
Show the title, essential question and Today I can slides (about 1 minute). Then the warm-up: the ball is between you and your own goal.Answer the warm-up on the worksheet.
5 to 13Direct instruction (I do)
Model it
Project Level 1. The field is in the middle: green carpet, white lines, the yellow goal (the robot's own) and the blue goal it attacks. The red robot is round, with an arrow on top for its front, and the orange ball glows so the robot can find it. The box on the field says the level's goal and, after each run, what happened and why. The readings beside it show the ball clock, the heading, the speed and how far away the ball is. Read the starter blocks aloud: if the ball clock is 12, move ahead; if it is 0, stop; if it is 6 or less, turn right; else turn left. Ask where the ball will go, then press play. Own goal, in about 3 seconds. Show the card one slide: the clock times 30 is the ball's angle.

It's working when: Turn on Show the receivers' rays under the readings: each red line is one receiver, longest toward the ball. The ball clock is the strongest direction.

Predict, watch, and fill in the vocabulary on the worksheet.
13 to 22Guided practice (We do)
An own goal, then a goal
Students open the link or scan the QR code. A short guide walks them through the own goal, card one's blocks and the goal in blue, then on to Level 2. Back on Level 1 (Levels, in the menu), they change both 60s in card one to 0, 30 and 90 and play each.

Watch for: Students who change only one 60. The ball can be on either side, so both moves need the same offset.

Follow the guide. Fill in the offset table: what happened at 0, 30, 60 and 90.
22 to 37Independent practice (You do)
Levels 2 and 3
Students play card one on Level 2 first, then put in card two; then Level 3 with card two, then card three. Ask them to write why each earlier card fails on the next level. Each level starts in real time. Speed up and Slower, under the field, change the speed; the round play button starts the level again from the beginning, with the program as it is now. Walk the room with the What to look for questions.

If they ask: "In card three, change 20 to 0 and 340 to 360. What does the heading do now?" The buffer

Watch for: Students who expect card one to pass Level 2. It goes wholly into its own penalty area and is called out.

Record what each card does on Levels 2 and 3, and answer the questions.
37 to 45Closure
Why not drive straight at it? And exit ticket
Show the closure slide and take answers. Then name the parts of the job the class programmed: find the ball (the clock), get behind it (the offset), face the goal (the compass). Hand out the exit ticket.Discuss, then answer the exit ticket.

Before you teach: a ten-minute walkthrough

Open mytekdev.com/try/robotsoccerlab?lesson=get-behind-the-ball-why-driving-straight-fails&ref=tpt-robotsoccerlab-1. A short guide opens over Level 1, Find the ball. The field is in the middle: green carpet, white lines, the yellow goal (the robot's own) and the blue goal it attacks. The red robot is round, with an arrow on top for its front, and the orange ball glows so the robot can find it. The box on the field says the level's goal and, after each run, what happened and why. The readings beside it show the ball clock, the heading, the speed and how far away the ball is.

  1. The starter. In Blocks: forever, if the ball clock is 12, move at angle 0 speed 80; else if it is 0, stop; else if it is 6 or less, turn at 40; else turn at -40. The robot turns to face the ball, which sits behind it, then drives at it.
  2. Card one. Show me the blocks in the box, then Put them in. The two turn blocks become move at angle: for clock 1 to 6, ball clock x 30 + 60; for 7 to 11, ball clock x 30 - 60; speed 70. The robot moves round the ball without turning until the ball is at 12, then pushes it ahead.
  3. The other levels. Levels, in the menu bar, opens any level; the program stays as it is. Levels 2 and 3 each have their own card in the box.
  4. Speed. Each level starts in real time. Speed up and Slower, under the field, change the speed; the round play button starts the level again from the beginning, with the program as it is now. Each press of play takes the next seed for the receivers' small noise, so times can differ by a few hundredths of a second between runs.
  5. Numbers to expect. Level 1: the starter scores in its own goal at about 2.9 s; card one scores in blue at 3.77 s. Card one with both 60s changed to 0: own goal, 2.1 s; 30: out of bounds at the wall, about 2.2 s; 90: a goal in about 5.5 to 5.8 s on most runs, and on some it goes out. Level 2: the starter turns and fails at once; card one goes wholly into its own penalty area at about 2.6 s and is called out; card two passes in about 4.2 s. Level 3: card two scores facing its own goal (heading 180), which the level refuses; card one scores an own goal at about 3.4 s; card three scores at about 2.4 s, facing 350 to 356.
In card three, changing 20 to 0 and 340 to 360 removes the buffer. The robot still scores, but watch the heading: after the first second it swings back and forth between about 333 and 18 instead of holding still at 356. That twitch is the reason for the buffer, and a good question to ask.

Background for the teacher

In student robot soccer the ball gives off infrared light, and the robot senses it with a ring of receivers. The strongest receiver says roughly where the ball is; the app gives it as a clock position, and the clock times 30 is the ball's angle from the robot's front, clockwise. The field and rules are modeled on the RoboCupJunior Soccer rules; the app is not affiliated with or endorsed by the RoboCup Federation.

Driving straight at the ball is the first idea every team has, and it only works from behind the ball. Real teams move round it first, aiming past it by an angle, then push it ahead. Omni wheels make this easy: they let the robot move in any direction while it keeps facing the same way. A compass keeps it pointed at the goal it attacks, and a buffer stops it correcting all the time.

Robot soccer has led to real companies: Raffaello D'Andrea, who coached Cornell's robot soccer team, went on to co-found Kiva Systems, whose warehouse robots Amazon bought in 2012. Robotics, mechanical, electrical and software engineers all work on robots like these.

What to look for

Ask these while students work. A student who has understood the lesson can answer them without help:

The second question is the one that matters. A student who says "4 times 30 is 120, plus 60 is 180, so it moves straight back, behind the ball" can read the program. A student who says "it goes round" has the result but not the idea.

Cross-curricular extensions

Vocabulary

SensorA part that measures something for the robot. This robot's ring of infrared receivers senses the glowing ball.
Ball clockWhere the ball is, as a clock: 12 straight ahead, 3 to the right, 6 behind, 0 when the robot cannot see it.
Omni wheelsWheels with small rollers round the rim, so the robot can move in any direction without turning.
OffsetAn extra angle added on purpose: card one aims 60 degrees past the ball to go round it.
Compass headingWhich way the robot faces, in degrees: 0 faces the blue goal, 180 its own goal.
BufferA range where the program does nothing, so it does not keep correcting: here, headings from 340 to 20.

Differentiation

English learners

  • Keep the vocabulary slide up, and point at the robot, the ball or the box on the field as you say each word: the picture carries the meaning.
  • Give a sentence frame on a card: The ball is at ____ o'clock, so its angle is ____ degrees.
  • Act it out: one student is the robot, a ball sits between it and a goal taped on the wall, and the class tells the robot where to move.

Students with IEPs or 504 plans

  • Pair students, one at the keyboard and one recording results.
  • Give the four offsets on a card: 0, 30, 60, 90.
  • Where the IEP allows a modified assignment, score the first two rubric rows only.

Students who need more support

  • Do the offset table together on the projector, one run for each number.
  • Draw a clock face round a robot on the board, with 30, 60, 90 degrees marked.
  • The box on the field says what went wrong after every run, and each of Levels 1 to 3 has a card.

Students ready for more

  • Open Level 4, Get behind it: card one is not enough there. Read the hint in the box and make the offset grow with the ball's angle.
  • Open the Python tab after putting in card one. Find the line for each block.
  • Card one goes at speed 70. Try 50 and 90 on Level 1 and time each goal.

Adapting for other grades

Younger students: In grades 4 and 5, run Level 1 together on the board, then let pairs try the four offsets. Stop after Level 2. Score the first two rubric rows, total 8, and 6 meets the objectives.

Older students: In high school, work in the Python tab from the start: card one is an if, two elifs and an else. Students write card three's compass part themselves, then go on to Level 4, where the offset grows with the ball's angle.

Robot Soccer Lab: Get Behind the Ball, Why Driving Straight at It Fails

Student worksheet

Name: ______________________________ Date: ______________

Open the app: scan the QR code, or go to mytekdev.com/try/robotsoccerlab?lesson=get-behind-the-ball-why-driving-straight-fails

Essential question: Why does driving straight at the ball fail, and what plan works instead?

Warm-up: The ball is between you and your own goal. What do you do before you kick it? ________________________

  1. Vocabulary. Sensor, ball clock, omni wheels, offset, compass heading, buffer: write each in your own words.
  2. The starter. The ball went into the ________ goal after about ____ seconds.
  3. My offset table. Both 60s changed to: 0: ________. 30: ________. 60: ________. 90: ________.
  4. Levels 2 and 3. Card one on Level 2: ________. Card two on Level 3: ________. Card three on Level 3: ________.

1. Why does driving straight at the ball fail from its wrong side?

2. What does the buffer in card three stop?

Robot Soccer Lab: Get Behind the Ball, Why Driving Straight at It Fails

Exit ticket

Name: ______________________________

1. The ball is at 3 o'clock. Its angle from the robot's front is: (A) 3 degrees (B) 90 degrees (C) 180 degrees

2. Card one moves at the ball's angle plus 60 because: (A) it is faster (B) it goes round the ball to get behind it (C) the sensor is wrong

3. A friend's robot keeps scoring in its own goal. Use what you learned today to say what to change, and why.

Answer key: exit ticket

QuestionAnswerWhy
1B3 times 30 is 90: straight to the right.
2BAiming past the ball takes the robot round it until the ball is in front, between the robot and the far goal.
3Open answerMove round the ball first, with an offset such as 60, so the robot pushes it from behind toward the right goal.

Worksheet: what students should find

BlankWhat the app shows
The starterThe yellow goal, its own, after about 2.9 seconds.
My offset table0: own goal. 30: out of bounds at the wall. 60: a goal in blue, 3.8 s. 90: usually a goal, slower (about 5.5 to 5.8 s), sometimes out.
Levels 2 and 3Card one on Level 2: called out, wholly inside its own penalty area. Card two on Level 3: scores facing its own goal, refused. Card three on Level 3: a goal, facing the blue goal.
Question 1From the wrong side, the ball is between the robot and its own goal, so pushing it sends it there.
Question 2It stops the robot correcting all the time: without it the heading swings back and forth past 0.
Each run uses the next seed for the sensors' small noise, so times can differ by a few hundredths of a second; the results in the table are the same on any computer. A student whose result differs changed something else too.

Rubric

Score each row from 1 to 4.

Name: ______________________________

Criteria4 Exceeds3 Meets2 Approaching1 Beginning
Explaining the own goalExplains the own goal with the robot's side of the ball, and how card one avoids it, using the clock and the angle.Explains that the robot drove at the ball from the wrong side.Says the robot went the wrong way, with no reason.No explanation.
Testing the offsetTests four offsets, records each result, and says why too small and too big fail.Tests four offsets and records each.Tests one or two.Does not test.
Levels 2 and 3Passes both, and says why the earlier card failed on each.Passes both with the cards.Passes one.Passes neither.

Total: ____ / 12. A score of 9 or more meets the objectives.

Standards

The lesson is built for CSTA 2-AP-17: students test one number in the program at four values, record each result and keep the one that works. Changing card one's if, else if and else is 2-AP-12, and naming the robot's job in parts (find the ball, get behind it, face the goal) is 2-AP-13.

FrameworkCodeGradesStandardHow the lesson meets it
CSTA 20172-AP-126-8Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.Students read and change a forever loop holding an if, else if and else chain, and card three's compound conditions (heading over 20 and up to 180).
CSTA 20172-AP-136-8Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.Students name the robot's job in parts, find the ball, get behind it, face the goal, and see which part each card adds.
CSTA 20172-AP-176-8Systematically test and refine programs using a range of test cases.Students test card one's offset at 0, 30, 60 and 90, record each result, and keep the value that scores.

Checked November 2026 against: CSTA K-12 Computer Science Standards, Revised 2017.

Optional: save student work in a free class

The whole lesson runs at the link on the worksheet, with no accounts and no sign-up.

To keep students' work, and see it all in one place, make a free class. It takes about ten minutes, once, and covers every lesson in this series: mytekdev.com/tools/class-setup

Students in a class open mytekdev.com/tools/robot-soccer-lab/lessons/get-behind-the-ball-why-driving-straight-fails/start instead of the worksheet link. Each one gets their own copy of the starter, and the same link reopens it next time.