0
0
Drone Programmingprogramming~30 mins

Waypoint radius and acceptance in Drone Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
Waypoint Radius and Acceptance
📖 Scenario: You are programming a drone to follow a set of waypoints during a flight mission. Each waypoint has a position, and the drone should consider the waypoint reached when it is within a certain radius of that point. This radius is called the acceptance radius.Setting the right acceptance radius helps the drone fly smoothly without needing to hit the exact point, which can be difficult due to wind or GPS accuracy.
🎯 Goal: Build a simple program that checks if the drone has reached each waypoint based on the acceptance radius. You will create a list of waypoints, set an acceptance radius, write the logic to check if the drone is close enough to each waypoint, and then print which waypoints are reached.
📋 What You'll Learn
Create a list of waypoints with exact coordinates
Set an acceptance radius variable
Write a loop to check distance from drone position to each waypoint
Print the list of waypoints that are within the acceptance radius
💡 Why This Matters
🌍 Real World
Drones use waypoint radius and acceptance to fly smoothly and safely by not needing to hit exact points, which helps in real missions with GPS errors or wind.
💼 Career
Understanding waypoint acceptance is important for drone programmers, robotics engineers, and anyone working with autonomous vehicles or navigation systems.
Progress0 / 4 steps
1
Create the list of waypoints
Create a list called waypoints with these exact tuples representing coordinates: (10, 10), (20, 20), (30, 30).
Drone Programming
Need a hint?

Use a list with tuples for each waypoint coordinate.

2
Set the acceptance radius
Create a variable called acceptance_radius and set it to 8.
Drone Programming
Need a hint?

Use a simple number variable for the radius.

3
Check which waypoints are reached
Create a list called reached_waypoints. Use a for loop with variables wp_x and wp_y to iterate over waypoints. Inside the loop, calculate the distance from the drone position (15, 15) to the waypoint using the formula distance = ((wp_x - 15)**2 + (wp_y - 15)**2)**0.5. If the distance is less than or equal to acceptance_radius, add the waypoint tuple to reached_waypoints.
Drone Programming
Need a hint?

Use the distance formula and an if statement inside the loop.

4
Print the reached waypoints
Write a print statement to display the reached_waypoints list.
Drone Programming
Need a hint?

Use print(reached_waypoints) to show the result.