0
0
Drone Programmingprogramming~30 mins

ArUco marker landing in Drone Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
ArUco Marker Landing
📖 Scenario: You are programming a drone to land precisely on a special ArUco marker placed on the ground. The drone's camera detects markers and provides their IDs and positions. Your task is to write code that helps the drone identify the correct marker and calculate the landing position.
🎯 Goal: Build a program that stores detected ArUco markers with their positions, selects the landing marker by its ID, and outputs the exact coordinates where the drone should land.
📋 What You'll Learn
Create a dictionary with ArUco marker IDs as keys and their (x, y) positions as values.
Add a variable to store the target landing marker ID.
Use a dictionary comprehension to find the position of the target marker.
Print the landing coordinates for the drone.
💡 Why This Matters
🌍 Real World
Drones use ArUco markers to find exact landing spots in delivery, inspection, and rescue missions.
💼 Career
Understanding how to process marker data and control drone landing is important for robotics and drone programming jobs.
Progress0 / 4 steps
1
Create the ArUco markers dictionary
Create a dictionary called markers with these exact entries: 101: (5.0, 3.2), 102: (2.5, 7.8), 103: (9.1, 1.4), 104: (4.0, 4.0)
Drone Programming
Need a hint?

Use curly braces {} to create a dictionary with keys as marker IDs and values as tuples for positions.

2
Set the target landing marker ID
Create a variable called target_id and set it to 103 to represent the marker where the drone should land.
Drone Programming
Need a hint?

Just assign the number 103 to the variable target_id.

3
Find the landing position using dictionary comprehension
Use a dictionary comprehension to create a dictionary called landing_position that contains only the entry from markers where the key equals target_id.
Drone Programming
Need a hint?

Use {k: v for k, v in markers.items() if k == target_id} to filter the dictionary.

4
Print the landing coordinates
Print the landing coordinates by accessing the position tuple from landing_position using target_id. Use print(f"Landing coordinates: {landing_position[target_id]}").
Drone Programming
Need a hint?

Use an f-string to print the coordinates in the format shown.