0
0
Drone Programmingprogramming~30 mins

Why computer vision enables intelligent flight in Drone Programming - See It in Action

Choose your learning style9 modes available
Why computer vision enables intelligent flight
📖 Scenario: You are programming a drone to fly safely and intelligently. The drone uses computer vision to see obstacles and decide where to go. This helps the drone avoid crashes and navigate well.
🎯 Goal: Build a simple program that uses a list of detected objects from the drone's camera and decides if the drone should stop or keep flying based on the distance to obstacles.
📋 What You'll Learn
Create a list called detected_objects with obstacle names and distances
Create a variable called safe_distance to set the minimum distance to obstacles
Use a for loop with variables obj and dist to check each detected object
Create a list called danger_objects with obstacles closer than safe_distance
Print the danger_objects list to show which obstacles are too close
💡 Why This Matters
🌍 Real World
Drones use computer vision to see their surroundings and avoid obstacles automatically, making flights safer and smarter.
💼 Career
Understanding how to process vision data and make decisions is key for drone programmers and robotics engineers.
Progress0 / 4 steps
1
Create the detected objects list
Create a list called detected_objects with these exact tuples: ("tree", 5), ("building", 12), ("bird", 3), ("pole", 7)
Drone Programming
Need a hint?

Use square brackets [] to create a list and parentheses () for each tuple.

2
Set the safe distance
Create a variable called safe_distance and set it to 6
Drone Programming
Need a hint?

Just write safe_distance = 6 on a new line.

3
Find obstacles closer than safe distance
Create an empty list called danger_objects. Use a for loop with variables obj and dist to iterate over detected_objects. Inside the loop, if dist is less than safe_distance, add obj to danger_objects.
Drone Programming
Need a hint?

Remember to create an empty list first, then use a for loop to check each distance.

4
Print the danger objects
Write a print statement to display the danger_objects list.
Drone Programming
Need a hint?

Use print(danger_objects) to show the list.