Mission 6-3 Lesson Plan | Python with Robots MS
Mission 6-3 Lesson Plan
Line Follower Lesson 3: Proportional Control & Calibration
Students will create a line follower program that uses all five sensors for proportional steering control.
⏰ 40-45 min
🎯 Grades 6-8
💻 CodeSpace
🤖 CodeBot
🐍 Python
📋
Overview
Mission 6-3 covers the final two objectives in the Line Follower mission. Students write a drive() function with parameters for left and right wheel speeds, then build a proportional line-following algorithm using tuples of sensor readings. In Objective 8, students add a calibration routine that reads sensor values to automatically set the detection threshold, and learn about global vs. local variables.
🎯 Mission Goal: Students will create a line follower program that uses all five sensors for proportional steering control.
🎯
Learning Targets
- I can define a function for driving at variable speeds.
- I can represent a tuple of bools with 1s and 0s.
- I can compare a variable to a tuple.
- I can use tuples to create proportional speed control.
-
I can calibrate the 'bot by setting the
threshandis_reflectivevariables. -
I can use the
globalkeyword to keep variables global.
💡
Key Concepts
- A function with parameters for left and right wheel speeds enables flexible, reusable drive control.
- A tuple of Boolean values (1s and 0s) can represent which sensors detect the line at any moment.
- Comparing sensor readings to a tuple allows for proportional steering - the 'bot adjusts speed based on how far off the line it is.
- Calibration uses real sensor readings to set a threshold value, making the program adapt to different surfaces and lighting.
-
The
globalkeyword allows a function to modify variables defined outside it.
✅
Assessment Opportunities
- Mission 6 Lesson 3 Log (digital)
- Quiz after Objective 8
- Submit completed program LineFollow (obj7 and/or obj8)
- Mission 6 Obj. 7-8 Review Kahoot!
☑️
Success Criteria
-
Define the
drive()function with two parameters - Use cases of detection for proportional speed control
- Compare a variable to a tuple
-
Use pre-coded math functions
abs()andround() -
Define the
calibrate()function -
Call the
calibrate()function when a button is pressed
📁
Digital Resources
📱
Classroom Materials
- ▸CodeBot
- ▸USB cable
- ▸4 AA batteries
- ▸A track for the 'bot to follow - white poster board with a black line made from electrical tape works well
🌍
Real-World Applications
🔌Calibration is vital to many physical devices. Calibrated items are tools and instruments that measure physical or electrical properties to ensure accuracy against a known standard. Common examples include temperature sensors, pressure gauges, weighing scales, calipers, micrometers, torque wrenches, pH meters, and electrical multimeters.
🚀
Extensions & Cross-Curricular
ExtensionAdd code for pressing BTN-1 to stop the program.
ExtensionAdd a sound when the 'bot turns left, another when it t