0
0
Drone Programmingprogramming~20 mins

Why sensors provide situational awareness in Drone Programming - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Situational Awareness Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Sensor Data Interpretation Output
What is the output of this code that simulates sensor data readings for obstacle distance and drone speed?
Drone Programming
def sensor_readings():
    distance = 15  # meters
    speed = 5      # m/s
    if distance < 10:
        status = 'Obstacle too close'
    elif speed > 10:
        status = 'Speed too high'
    else:
        status = 'All clear'
    return status

print(sensor_readings())
AAll clear
BSpeed too high
CObstacle too close
DNone
Attempts:
2 left
💡 Hint
Check the conditions for distance and speed in the code.
🧠 Conceptual
intermediate
1:30remaining
Why Sensors Are Critical for Situational Awareness
Which of the following best explains why sensors provide situational awareness for drones?
ASensors collect real-time data about the environment, allowing the drone to react to changes.
BSensors store flight plans for the drone to follow without changes.
CSensors increase the drone's battery life by reducing power consumption.
DSensors allow the drone to communicate with other drones only.
Attempts:
2 left
💡 Hint
Think about what situational awareness means in real life.
🔧 Debug
advanced
2:00remaining
Identify the Error in Sensor Data Processing
What error does this code raise when processing sensor data?
Drone Programming
sensor_values = {'distance': 20, 'speed': 8}

if sensor_values['distance'] < 15:
    alert = 'Too close'
elif sensor_values['speed'] > 10:
    alert = 'Speeding'
else:
    alert = 'Safe'

print(alert)
ANo error, output is 'Safe'
BKeyError because 'speed' key is missing
CTypeError because comparison is invalid
DSyntaxError due to missing colon after elif condition
Attempts:
2 left
💡 Hint
Check the syntax of the if-elif statements carefully.
Predict Output
advanced
2:00remaining
Output of Sensor Fusion Algorithm
What is the output of this code that fuses two sensor readings to decide drone action?
Drone Programming
def fuse_sensors(distance, light):
    if distance < 10 and light < 50:
        return 'Hover'
    elif distance >= 10 and light >= 50:
        return 'Move Forward'
    else:
        return 'Caution'

print(fuse_sensors(8, 60))
AHover
BNone
CCaution
DMove Forward
Attempts:
2 left
💡 Hint
Check both conditions carefully for distance and light.
🚀 Application
expert
2:30remaining
Number of Sensor Alerts Generated
Given this code that processes a list of sensor distances, how many alerts will be generated for distances less than 5 meters?
Drone Programming
distances = [3, 7, 2, 10, 4, 6]
alerts = [d for d in distances if d < 5]
print(len(alerts))
A4
B3
C2
D5
Attempts:
2 left
💡 Hint
Count how many numbers in the list are less than 5.