📖 Scenario: You are programming a drone to fly a set path automatically. The drone needs to visit specific points in the sky called waypoints. Each waypoint has coordinates that tell the drone where to go. This helps the drone complete missions without a pilot controlling it all the time.
🎯 Goal: Build a simple program that stores waypoints, sets a speed limit, moves the drone through each waypoint automatically, and then prints the path it took.
📋 What You'll Learn
Create a list of waypoints with exact coordinates
Set a speed limit variable
Use a for loop to simulate moving through each waypoint
Print the list of visited waypoints
💡 Why This Matters
🌍 Real World
Waypoint navigation lets drones fly missions automatically, like delivering packages or inspecting buildings without a pilot controlling every move.
💼 Career
Understanding waypoint navigation is key for drone programmers, robotics engineers, and anyone working on autonomous vehicle software.
Progress0 / 4 steps
1
Create the list of waypoints
Create a list called waypoints with these exact tuples representing coordinates: (10, 20), (15, 25), (20, 30).
Drone Programming
Hint
Use square brackets to make a list and put each coordinate pair inside parentheses.
2
Set the speed limit
Create a variable called speed_limit and set it to 5 to represent the drone's speed in meters per second.
Drone Programming
Hint
Just assign the number 5 to the variable named speed_limit.
3
Move through each waypoint
Use a for loop with the variable point to go through each item in waypoints. Inside the loop, add each point to a new list called visited.
Drone Programming
Hint
Start with an empty list called visited. Then add each point from waypoints inside the loop.
4
Print the visited waypoints
Write a print statement to display the visited list.
Drone Programming
Hint
Use print(visited) to show the list of points the drone visited.
Practice
(1/5)
1. Why does waypoint navigation enable drones to perform autonomous missions?
easy
A. Because it disables GPS to save battery
B. Because it requires constant manual input from the operator
C. Because it allows drones to follow a set of predefined points without manual control
D. Because it only works indoors without GPS
Solution
Step 1: Understand waypoint navigation
Waypoint navigation means the drone follows a list of points automatically.
Step 2: Connect to autonomous missions
Following points automatically means no manual control is needed during the mission.
Final Answer:
Because it allows drones to follow a set of predefined points without manual control -> Option C
Quick Check:
Waypoint navigation = automatic point following [OK]
Hint: Waypoints mean following points automatically, no manual control needed [OK]
Common Mistakes:
Thinking manual input is required
Confusing GPS usage
Assuming it only works indoors
2. Which of the following is the correct way to define a waypoint list in Python for a drone mission?
easy
A. waypoints = 10, 20, 15, 25, 20, 30
B. waypoints = [(10, 20), (15, 25), (20, 30)]
C. waypoints = {10, 20, 15, 25, 20, 30}
D. waypoints = '10, 20, 15, 25, 20, 30'
Solution
Step 1: Identify correct data structure for waypoints
Waypoints are pairs of coordinates, so a list of tuples is appropriate.
Step 2: Check each option
waypoints = [(10, 20), (15, 25), (20, 30)] uses a list of tuples, which is correct. Others use sets, plain tuples, or strings which are not suitable.
Hint: enumerate index starts at 0, add 1 for human count [OK]
Common Mistakes:
Forgetting to add 1 to index
Confusing tuple print format
Assuming enumerate is undefined
4. The following code is intended to print all waypoints, but it causes an error. What is the problem?
waypoints = [(1,2), (3,4), (5,6)]
for point in waypoints:
print(point[3])
medium
A. Index 3 is out of range for each point tuple
B. The variable 'point' is not defined
C. The waypoints list is empty
D. Syntax error in the for loop
Solution
Step 1: Check tuple length
Each point is a tuple with 2 elements, indexes 0 and 1 only.
Step 2: Identify index error
Accessing point[3] tries to get fourth element, which does not exist, causing IndexError.
Final Answer:
Index 3 is out of range for each point tuple -> Option A
Quick Check:
Tuple length = 2, index 3 invalid [OK]
Hint: Tuple indexes start at 0; max index here is 1 [OK]
Common Mistakes:
Assuming point has more than 2 elements
Thinking variable is undefined
Believing syntax is wrong
5. You want a drone to inspect three locations automatically using waypoint navigation. Which approach best ensures the mission is repeatable and safe?
hard
A. Program the drone with a fixed list of GPS waypoints and verify each point before flight
B. Manually control the drone to each location every time
C. Use random GPS points for each mission to avoid predictability
D. Disable waypoint navigation and fly manually to save battery
Solution
Step 1: Understand repeatability and safety needs
Repeatability means doing the same mission reliably; safety means avoiding errors.
Step 2: Evaluate options
Programming fixed waypoints and verifying them ensures the drone follows the same safe path every time.
Final Answer:
Program the drone with a fixed list of GPS waypoints and verify each point before flight -> Option A
Quick Check:
Fixed waypoints + verification = repeatable and safe [OK]
Hint: Fixed waypoints plus verification = safe, repeatable missions [OK]