Teacher Resources - Fly with Python Mission 11
Reconnaissance
Students plan a navigation route for CodeAIR and use the onboard camera to document the path, combining the state estimator, waypoints, and photography into an autonomous reconnaissance run.
Overview
Mission 11 introduces CodeAIR's onboard camera and its state estimator, then brings the two together for a full reconnaissance run. Students start by snapping and displaying bitmap images with the camera, then send those photos to the flight recorder for later review. From there they bring in the state estimator to track the drone's (X, Y, Z) position, define waypoints, and use fly.start_linear_motion() to navigate to them with precision.
By the end of the mission, students combine both skill sets: fly to a series of waypoints, snap a photo at each one, and return the drone safely to its starting position.
🎯 Mission Goal: Students will plan a navigation route for CodeAIR and use the onboard camera to document the path.
Learning Targets
- I can understand and utilize the state estimator to track CodeAIR's (x, y, z) position relative to its starting point.
- I can define specific target locations called waypoints.
- I can use the fly.start_linear_motion() function for precise control over movement in all three dimensions.
- I can program flight paths to navigate directly to waypoints.
- I can combine navigation and camera skills to automate reconnaissance runs, capturing photos at designated waypoints and returning to base.
Key Concepts
- The image from the onboard camera can be displayed on the console using the pipe object, just like other data collected by the drone. It can also be sent to the flight recorder and viewed after flight.
- The drone's state estimator establishes a "home base," or starting position, the moment it initializes. All position tracking after that references this home base (X, Y, Z). During Objective 6, the drone will fly this route:
Assessment Opportunities
- Quiz after Objective 3
- Quiz after Objective 5
- Complete the programs FrameGrab, SelfieCam, Recon, PositionTracking, and Waypoints
- Mission 11 Assignment
- Mission 11 Review Questions
Success Criteria
- Snap a photo using the onboard camera
- Display a photo in the data panel
- Use a countdown timer
- Send a photo to the flight recorder
- Create a chart that tracks the (X, Y, Z) position of the drone
- Navigate the drone to a specific waypoint
- Navigate the drone through a series of waypoints and return to the starting position
Digital Resources
- ▸CodeAIR Mission 11 Assignment
- ▸CodeAIR Mission 11 Assignment Answers
- ▸CodeAIR Mission 11 Review Questions
- ▸Mission 11 Obj 1 Code Solution (FrameGrab)
- ▸Mission 11 Obj 2 Code Solution (SelfieCam)
- ▸Mission 11 Obj 3 Code Solution (Recon)
- ▸Mission 11 Obj 4 Code Solution (PositionTracking)
- ▸Mission 11 Obj 5 Code Solution (Waypoints)
- ▸Mission 11 Obj 6 Code Solution (Waypoints)
Classroom Materials
- ▸Laptop/computer with Chrome browser
- ▸CodeAIR drone and USB cable
- ▸Meter stick for measuring distance from the starting point
- ▸Cards or small images for the drone to take a picture of at a waypoint. You can use the images in the Aerial Images file. Tape down the images!
Real-World Applications
Extensions & Cross-Curricular
🔤
Vocabulary
▾
🐍
New Python Code
▾
velocity_y_m = (y_diff/dist)*MAX_VELShrink the triangle down to a unit vector, a single step in the right direction.
📐
Standards
▾
CSTA Standards - Middle School
CSTA Standards - High School
CSTA Standards - Physical Computing
- Reserve space with good lighting for the camera and reconnaissance activities - low light makes photos harder to see clearly.
- Charge all CodeAIR drones fully and have spare batteries ready.
- Print or prepare the images from the Aerial Images file and plan where you'll tape them down before class - you'll need at least two locations for the waypoint objectives.
- Have a meter stick ready so students can measure distance from the drone's starting point.
- Be familiar with the five programs (FrameGrab, SelfieCam, Recon, PositionTracking, Waypoints) and the assignment and review questions before class.
- The onboard camera isn't high resolution, but it takes fairly clear images. Students can download an image from the console and copy/paste it into the assignment document.
- Objective 1: for best results, use good lighting with high contrast between the background and the object being photographed. For more on bitmaps, click the tool link in Objective 1. Clear the console data panel with "Clear Data" as needed.
- Objective 3: place the drone on a picture (like the "H" image in the Aerial Images document) so it photographs something other than the floor.
- Objective 3: the beep is very difficult to hear. Increasing altitude to 0.2 gives a little more height, but the beep is still hard to hear.
- Objective 4: if students don't clear the data, the chart displays beneath the images. The assignment asks students to paste a snippet of their graph in the document - review how to take a screenshot if needed.
- Objective 5: the code starts the same as Recon - students can use File > Save As instead of copying and pasting the starting code.
- Objective 5: use the first image in the Aerial Images document as the drone's starting position, then measure half a meter forward and to the left. Tape the second image from the document at that spot. Students can try different altitudes and snap several images to get a picture of the taped image.
- Objective 6: refer to the diagram in the Key Concepts section for positioning the navigation waypoints.
- Extensions and cross-curricular projects are included to enhance the concepts in the mission. You can use the extensions to extend students' programming experience. A remix is planned after Mission 14.
Lesson Outline
Students access prior knowledge by answering questions in the pre-mission section of the assignment doc.
- Ask: "If you wanted to give someone directions using only distances and directions from a starting point, what information would you need?"
- Ask: "How is taking a photo with your phone similar to what CodeAIR's onboard camera does?"
Front-load the key new programming concepts before students start coding.
- Introduce
camera.take()andpipe.image()- snapping and displaying a bitmap image on the console. - Introduce the state estimator and the "home base" concept - explain that all (X, Y, Z) position tracking is relative to where the drone starts.
- Introduce waypoints and
fly.start_linear_motion()for controlled movement toward a target. - Preview the math in Objective 6 - using the Pythagorean Theorem to find distance, then shrinking that direction down to a unit vector to set a steady velocity.
- Set expectations: five programs across six objectives, with quizzes after Objective 3 and Objective 5.
Students build five programs that progress from camera basics to full waypoint navigation. As they work through the objectives, they should take notes and answer questions in their assignment doc.
-
FrameGrab - snap a photo with
camera.take(), display it withpipe.image(), and use a countdown timer before the photo. - SelfieCam - send the photo to the flight recorder so it can be reviewed after the flight.
- Recon (quiz after Objective 3) - combine the camera with a beep alert into a simple reconnaissance routine.
-
PositionTracking - use
get_data(STATE_EST_POS)to chart the drone's live (X, Y, Z) position. -
Waypoints (quiz after Objective 5) - define a waypoint and use
fly.start_linear_motion()to navigate directly to it. - Waypoints, continued - extend the program to fly through a series of waypoints, snap a photo at each one, and return to home base.
Bring the class together to connect the camera and navigation skills from this mission.
- Ask: "What does the state estimator's 'home base' actually track, and why does it matter for navigation?"
- Ask: "Why do we need to shrink our direction down to a unit vector before setting the drone's velocity toward a waypoint?"
- Ask: "What real-world jobs need both navigation and photography skills, like this mission combines?"
Students answer the reflection question in the assignment doc and then submit.
Use the Mission 11 Review Questions through a preferred method - class discussion, Kahoot!, or LMS quiz.