Complete the code to import the MAVLink library on the Raspberry Pi.
import [1]
The pymavlink library is used to communicate with the drone via MAVLink protocol on the Raspberry Pi.
Complete the code to open a serial connection to the drone on the Raspberry Pi.
connection = serial.Serial('[1]', 57600)
/dev/ttyUSB0 which may not be connected to the flight controller.The Raspberry Pi commonly uses /dev/ttyAMA0 for serial communication with the flight controller.
Fix the error in the code to send a heartbeat message to the drone.
msg = mavutil.mavlink.MAVLink_heartbeat_message([1], 0, 0, 0, 0)
The system type for a companion computer is usually set to 3 when sending heartbeat messages.
Fill both blanks to create a dictionary comprehension that maps sensor names to their readings only if the reading is above 10.
sensor_data = {name: [1] for name, [2] in sensors.items() if value > 10}The dictionary comprehension uses value as the variable for sensor readings in both places.
Fill all three blanks to filter telemetry data where altitude is above 100 and map the drone ID to altitude.
filtered = [1] for drone_id, [2] in telemetry.items() if [3] > 100
The code creates a dictionary comprehension mapping drone_id to altitude when altitude is above 100.