Challenge - 5 Problems
Raspberry Pi Companion Computer Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of MAVLink message parsing code
What is the output of this Python code snippet running on a Raspberry Pi receiving MAVLink messages?
Drone Programming
from pymavlink import mavutil master = mavutil.mavlink_connection('udp:127.0.0.1:14550') msg = master.recv_match(type='HEARTBEAT', blocking=True) print(f"System ID: {msg.get_srcSystem()}, Component ID: {msg.get_srcComponent()}")
Attempts:
2 left
💡 Hint
The code waits for a heartbeat message and prints its source IDs.
✗ Incorrect
The code connects to a MAVLink UDP endpoint and blocks until it receives a HEARTBEAT message. The typical system and component IDs for a simulated vehicle are 1 and 1.
🧠 Conceptual
intermediate1:30remaining
Purpose of companion computer in drone systems
What is the main role of a companion computer like a Raspberry Pi in a drone system?
Attempts:
2 left
💡 Hint
Think about tasks that require more computing power than the flight controller.
✗ Incorrect
The companion computer runs complex tasks like computer vision, path planning, or data logging, while the flight controller handles low-level motor control and stabilization.
🔧 Debug
advanced2:00remaining
Identify the error in MAVLink connection code
What error will this Raspberry Pi Python code produce when trying to connect to a drone via serial port?
Drone Programming
from pymavlink import mavutil master = mavutil.mavlink_connection('/dev/ttyUSB0', baud=57600) msg = master.recv_match(type='ATTITUDE', blocking=True) print(msg)
Attempts:
2 left
💡 Hint
Check if the serial device path exists on the Raspberry Pi.
✗ Incorrect
If the serial device '/dev/ttyUSB0' is not connected or does not exist, Python raises a FileNotFoundError when trying to open it.
📝 Syntax
advanced2:30remaining
Correct syntax for sending MAVLink command
Which option correctly sends a MAV_CMD_NAV_TAKEOFF command using pymavlink on a Raspberry Pi?
Drone Programming
master = mavutil.mavlink_connection('udp:127.0.0.1:14550') # Send takeoff command here
Attempts:
2 left
💡 Hint
Check the full path and parameters for the MAV_CMD_NAV_TAKEOFF constant and command_long_send signature.
✗ Incorrect
The correct constant is mavutil.mavlink.MAV_CMD_NAV_TAKEOFF. The first parameter after command is confirmation (0 means no confirmation). The altitude is the last parameter (10 meters).
🚀 Application
expert1:30remaining
Number of GPS fix messages received in 10 seconds
A Raspberry Pi companion computer listens to GPS_RAW_INT MAVLink messages at 5 Hz. How many GPS fix messages will it receive in 10 seconds?
Attempts:
2 left
💡 Hint
Multiply the message frequency by the time interval.
✗ Incorrect
At 5 messages per second, in 10 seconds the total messages received are 5 * 10 = 50.