Challenge - 5 Problems
Waypoint Navigation Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of waypoint navigation sequence
Consider a drone programmed to follow waypoints in sequence. What will be the output of the following code simulating the drone's position updates?
Drone Programming
waypoints = [(0,0), (10,0), (10,10), (0,10)] position = (0,0) for wp in waypoints: position = wp print(f"Drone reached waypoint at {position}")
Attempts:
2 left
💡 Hint
Think about how the loop updates the position variable and prints it each time.
✗ Incorrect
The loop updates the drone's position to each waypoint in order and prints the current position. So the output shows the drone reaching each waypoint in sequence.
🧠 Conceptual
intermediate1:30remaining
Why waypoint navigation enables autonomy
Why does using waypoint navigation allow a drone to perform autonomous missions?
Attempts:
2 left
💡 Hint
Think about what autonomy means for a drone mission.
✗ Incorrect
Waypoint navigation lets the drone follow a set path by itself, so it can complete missions without a pilot controlling it all the time.
🔧 Debug
advanced2:00remaining
Identify the error in waypoint navigation code
This code is intended to move a drone through waypoints, but it raises an error. What is the error?
Drone Programming
waypoints = [(0,0), (5,5), (10,10)] for i in range(len(waypoints)): print(f"Moving to waypoint {i+1}: {waypoints[i]}") drone.move_to(waypoints[i]) drone.wait_until_arrived() # drone object is not defined
Attempts:
2 left
💡 Hint
Check if all variables and objects are defined before use.
✗ Incorrect
The code tries to call methods on 'drone' but no drone object is created or imported, causing a NameError.
📝 Syntax
advanced1:30remaining
Correct syntax for waypoint list comprehension
Which option correctly creates a list of waypoints with x and y coordinates from 0 to 4?
Attempts:
2 left
💡 Hint
Remember the syntax for nested loops in list comprehensions.
✗ Incorrect
Option D uses the correct syntax for nested loops in a list comprehension to generate all (x,y) pairs.
🚀 Application
expert3:00remaining
Calculate total distance for waypoint mission
Given the waypoints [(0,0), (3,4), (6,8)], what is the total distance the drone will travel following them in order? Use Euclidean distance between points.
Attempts:
2 left
💡 Hint
Calculate distance between each pair: sqrt((x2-x1)^2 + (y2-y1)^2) and sum them.
✗ Incorrect
Distance from (0,0) to (3,4) is sqrt(9+16)=5, from (3,4) to (6,8) is sqrt(9+16)=5, total 10.0.