Python Level-1 with Virtual Robotics - Mission 11: Airfield Ops

Mission 11 Lesson Plan

Airfield Ops

Students use line sensor data and math operators like integer division, modulo, and exponents to guide CodeBot through airfield runway operations.

⏰ 2-4 hours 🎯 Grades 9-12+ πŸ’» CodeSpace πŸ€– Virtual CodeBot 🐍 Python
View Lesson Outline
πŸ“‹

Overview

In this mission, CodeBot works the airfield: it follows a dashed white line down the runway, counting each dash along the way. Students use the running dash count with math operators, integer division (//), modulo (%), and power (**), to drive real behavior: lighting up LEDs as a position indicator, triggering a scary sound every 8th dash, and flashing proximity LEDs at red markers. It's a line-follower mission at its core, but the focus is on gathering data and using math to turn that data into action.

🎯 Mission Goal: Students will learn math operations that help with airfield runway operations.

🎯

Learning Targets

  • I can use line sensor data to detect a white line.
  • I can use line sensor data to count dashed lines.
  • I can use the number of dashed lines with math operations //, %, and **.
  • I can gather data and use the data to accomplish tasks.
πŸ’‘

Key Concepts

  • CodeBot can gather data, like line sensor readings, and use it to accomplish tasks.
  • Besides addition, subtraction, multiplication, and division, other math operators are useful in programming: // integer division, % modulo (remainder), and ** power (exponent).
βœ…

Assessment Opportunities

  • Quiz after Objective 6
  • Code Tracing Chart as a debugging tool
  • Use the Debugger to track variables for each math operation (Obj 4, 5, and 6)
  • Give students code snippets from an objective and have them explain what it does
  • Give extra practice with the math operations
  • Submit final runway clearing program
  • Mission 11 Review Kahoot!
β˜‘οΈ

Success Criteria

  • CodeBot follows a dotted white line.
  • CodeBot stops at the end of the white line.
  • CodeBot uses LEDs as a position indicator.
  • CodeBot makes a scary sound every 8 dashes.
  • CodeBot's proximity LEDs light up for each red marker.
🧰

Classroom Materials

  • β–ΈComputer or Chromebook with internet access
🌍

Real-World Applications

πŸ”’Modulo and integer division are very useful math operations, used in packaging, keeping track of player turns, finding place values, and more.
πŸ’‘In this program, integer division and modulo were used to turn on LEDs and detect every 8th dashed line.
🎯What applications can you think of that use integer division and/or modulo? What devices and tasks could benefit from them?
πŸš€

Extensions & Cross-Curricular

ExtensionUse button input. Button 0 to start the automation, and button 1 as an emergency stop button.
ExtensionUse a dictionary of commands, like start, stop, or scary sound. Use console input to control the 'bot.
ExtensionThink of additional tasks for the 'bot to perform on the airfield.
Lang ArtsHave students write a description of integer division and modulo, or create a worksheet with instructions that other students could use.
MathThe mission is all about math! Discuss integer division and modulo, when you might want to use them instead of regular division, and have students complete practice problems.
πŸ”€

Vocabulary

β–Ύ
Increment:Adding 1 to a variable (like counting).
Decrement:Subtracting 1 from a variable (like counting down).
Augmented assignment:A shorter way to write common expressions.
// operator:Integer division, or quotient; divides a number and then truncates the answer to an integer.
% operator:Modulo - gives the integer remainder of a division problem.
** operator:Gives the power of the base number by the exponent.
🐍

New Python Code

β–Ύ
count = count + 1 count += 1 Increment a counter, then the same thing written as an augmented assignment.
num = dividend // divisor leds = (count*LEDS)//TOTAL Integer division. Returns the quotient, or truncated answer, as an integer.
progress = [True]*leds_on Use multiplication on a Boolean list with an integer.
remainder = count % 8 Modulo; returns the remainder of a division problem. In this example, all possible answers are 0, 1, 2, 3, 4, 5, 6, or 7.
marker_dash = 2**next_marker Power (or exponent) operator. In this example, 2 will be raised to the next_marker power.
πŸ“

Standards

β–Ύ

CSTA Standards - Grades 9-10

3A-CS-03 3A-DA-09 3A-DA-11 3A-DA-12 3A-AP-13 3A-AP-14 3A-AP-15 3A-AP-16 3A-AP-17 3A-AP-18 3A-AP-21 3A-AP-23 3A-AP-26

CSTA Standards - Grades 11-12

3B-CS-02 3B-DA-05 3B-DA-06 3B-DA-07 3B-AP-10 3B-AP-14 3B-AP-15 3B-AP-16 3B-AP-17 3B-AP-22 3B-AP-23

Certiport IT Specialist: Python Standards

1.1 1.2 1.3 1.4 2.1 2.2 3.2 4.1 4.2

PCEP: Certified Entry-Level Python Programmer

1.1 1.2 1.3 1.4 1.5 2.1 2.2 3.2 4.1
πŸ“
Preparing for the Lesson
  • This mission is another line-follower program, with new applications. The CodeTrek shows code for a new program.
  • You have a choice: if you want students to practice the line-follower algorithm again, and have it be simpler than Mission 9, they can follow CodeTrek and start new code. They can also use their former code (from Mission 9 or Mission 10) and add to it to meet the goals for Mission 11.
  • If students reuse a previous program, they just need to change the line sensor condition from a black line to a white line: change ls.check(threshold, is_reflective) to ls.check(threshold, True) for a white line.
  • For the other objectives, the code modifications and functions can be added just as easily to a previous program, or to a new one.

πŸ§‘β€πŸ«
Teacher Notes
  • The value of TOTAL_LINES may need to be adjusted to meet the goal, depending on the 'bot and track setup - expect some trial and error.
πŸ—ΊοΈ

Lesson Outline

πŸ—£οΈWarm-up / Hook

Ask students what dashed lines on a runway or road might be used for, and how a pilot or driver (or a robot) could count them to know where they are. Connect this to the mission: CodeBot is working the airfield, following a dashed white line and using the dash count with math operators to figure out what to do next.

1️⃣Objectives 1-3: Detecting and Counting the Dashed White Line
  • Switch the line sensor condition to detect a white line instead of a black line, and follow the dashed line down the runway.
  • Count each dashed line as CodeBot passes it, building toward Objective 3.
  • Use Mission 11 Obj 3 as a reference, and administer extra practice or a code-explanation activity as needed.
Teaching tip:Use the Code Tracing Chart here, or give students printed code from an objective and have them explain what it does.
2️⃣Objectives 4-6: Math Operations on the Dash Count
  • Objective 4: use integer division (//) on the dash count to light up LEDs as a position indicator.
  • Objective 5: use modulo (%) so CodeBot makes a scary sound every 8th dash. Reference Mission 11 Obj 5.
  • Objective 6: use the power operator (**) so CodeBot's proximity LEDs light up for each red marker.
  • Administer the Quiz after Objective 6.
Teaching tip:Use the Debugger to track variables for each math operation (Objectives 4, 5, and 6), and give extra practice with the math operations before moving on.
3️⃣Objective 7: Full Runway Clearing Task
  • Bring detecting, counting, and all three math operations together so CodeBot completes a full runway clearing run: following the line, stopping at the end, indicating position with LEDs, sounding off every 8 dashes, and flagging red markers.
  • Reference Mission 11 Obj 7 and the Final Code Solution as needed.
  • Have students submit their final runway clearing program.
Teaching tip:Give students code snippets from this objective and have them explain what each part does before they submit.
πŸŽ‰Wrap-up / Review

Close with the Level-1 Mission 11 Review Kahoot! to reinforce integer division, modulo, and the power operator before moving on to the Unit 4 Remix & Assessment.