0
0
Drone Programmingprogramming~30 mins

Testing failsafe scenarios in Drone Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
Testing failsafe scenarios
📖 Scenario: You are programming a drone that must safely handle unexpected problems during flight. To keep the drone safe, you will create a simple system to check for failsafe conditions like low battery or lost GPS signal.
🎯 Goal: Build a small program that sets up drone status data, defines safety limits, checks for failsafe conditions, and prints the safety status.
📋 What You'll Learn
Create a dictionary called drone_status with keys 'battery', 'gps_signal', and 'altitude' with exact values 15, True, and 100 respectively
Create a variable called battery_threshold and set it to 20
Write a failsafe_checks dictionary that sets keys 'low_battery' and 'gps_lost' to True or False based on drone_status and battery_threshold
Print the failsafe_checks dictionary
💡 Why This Matters
🌍 Real World
Drones must constantly check their status to avoid crashes or damage. This project shows how to program simple safety checks.
💼 Career
Understanding how to write failsafe checks is important for drone software engineers and robotics programmers to ensure safe operation.
Progress0 / 4 steps
1
Set up the drone status data
Create a dictionary called drone_status with these exact entries: 'battery': 15, 'gps_signal': True, and 'altitude': 100
Drone Programming
Need a hint?

Use curly braces {} to create the dictionary with the exact keys and values.

2
Define the battery threshold
Create a variable called battery_threshold and set it to 20
Drone Programming
Need a hint?

Just assign the number 20 to the variable battery_threshold.

3
Check for failsafe conditions
Write a dictionary called failsafe_checks that creates keys 'low_battery' and 'gps_lost'. Set 'low_battery' to True if drone_status['battery'] is less than battery_threshold, else False. Set 'gps_lost' to True if drone_status['gps_signal'] is False, else False.
Drone Programming
Need a hint?

Use a dictionary with keys and conditions for values. Use < and not operators.

4
Print the failsafe check results
Write print(failsafe_checks) to display the failsafe status dictionary
Drone Programming
Need a hint?

Use the print function to show the dictionary on screen.