Challenge - 5 Problems
Terrain Following Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
Output of range finder distance calculation
What is the output of this code that calculates the distance from the drone to the ground using a range finder reading and drone altitude?
Drone Programming
altitude = 120.5 # meters range_finder_reading = 15.3 # meters distance_to_ground = altitude - range_finder_reading print(f"Distance to ground: {distance_to_ground} meters")
Attempts:
2 left
💡 Hint
Subtract the range finder reading from the drone's altitude to get the distance to the ground.
✗ Incorrect
The drone altitude is 120.5 meters. The range finder measures 15.3 meters from the drone to the ground. So, distance_to_ground = 120.5 - 15.3 = 105.2 meters.
🧠 Conceptual
intermediate1:00remaining
Understanding range finder data for terrain following
Which statement best describes how a range finder helps a drone follow terrain?
Attempts:
2 left
💡 Hint
Think about what the range finder measures directly below the drone.
✗ Incorrect
Range finders measure the distance from the drone to the ground below. This helps the drone adjust its altitude to keep a consistent height above terrain.
🔧 Debug
advanced2:00remaining
Identify the error in terrain following altitude adjustment code
What error will this code cause when trying to adjust drone altitude based on range finder data?
Drone Programming
desired_height = 50 range_finder_distance = 45 # Adjust altitude to maintain desired height above ground new_altitude = desired_height + range_finder_distance print(f"New altitude: {new_altitude}")
Attempts:
2 left
💡 Hint
Think about how altitude relates to desired height and range finder distance.
✗ Incorrect
To maintain a desired height above ground, the drone altitude should be set to the ground altitude plus desired height. Here, range_finder_distance is the distance to ground, so adding desired_height to it sets altitude too high.
📝 Syntax
advanced1:30remaining
Identify the syntax error in range finder data processing
Which option contains the syntax error when trying to create a dictionary of sensor readings?
Drone Programming
sensor_data = {"range_finder": 12.5, "altitude": 100.0, "speed": 5.2}Attempts:
2 left
💡 Hint
Check the punctuation between keys and values in the dictionary.
✗ Incorrect
Option B is missing colons between keys and values, causing a syntax error. Dictionaries require colons to separate keys and values.
🚀 Application
expert2:30remaining
Calculate drone altitude for terrain following with variable terrain
Given a drone flying over terrain where the range finder reading changes as follows: [10, 12, 8, 15, 9] meters, and the drone wants to maintain a constant height of 20 meters above ground, what is the list of altitudes the drone should set to maintain this height?
Drone Programming
range_readings = [10, 12, 8, 15, 9] desired_height = 20 # Calculate altitudes altitudes = [reading + desired_height for reading in range_readings] print(altitudes)
Attempts:
2 left
💡 Hint
Add the desired height to each range finder reading to get the altitude.
✗ Incorrect
The drone altitude is the ground distance plus the desired height. Adding 20 to each reading gives the correct altitudes: [30, 32, 28, 35, 29].