0
0
Drone Programmingprogramming~20 mins

What is MAVLink in Drone Programming - Practice Questions & Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
MAVLink Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is MAVLink used for in drone programming?

MAVLink is a communication protocol used in drones. What is its main purpose?

ATo enable communication between the drone and ground control stations
BTo control the drone's camera settings only
CTo provide GPS coordinates exclusively
DTo program the drone's flight path without any communication
Attempts:
2 left
💡 Hint

Think about how drones send and receive information during flight.

Predict Output
intermediate
2:00remaining
What does this MAVLink message code output?

Consider this Python snippet using pymavlink to print a heartbeat message type:

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(msg.get_type())
AHEARTBEAT
BHEARTBEAT_MESSAGE
Cheartbeat
DNone
Attempts:
2 left
💡 Hint

Check the method used to get the message type name.

🔧 Debug
advanced
2:00remaining
Why does this MAVLink connection code raise an error?

Look at this code snippet that tries to connect to a drone using MAVLink:

Drone Programming
from pymavlink import mavutil
master = mavutil.mavlink_connection('tcp:192.168.2.1:5760')
master.wait_heartbeat()
print('Heartbeat received')
ARuns without error and prints 'Heartbeat received' immediately
BRaises AttributeError because wait_heartbeat() is not a method
CRaises SyntaxError due to missing colon in connection string
DRaises ConnectionRefusedError if no drone is listening at the address
Attempts:
2 left
💡 Hint

Think about what happens if the drone is not reachable at the given IP and port.

📝 Syntax
advanced
2:00remaining
Which option correctly creates a MAVLink message to arm the drone?

Given a MAVLink connection master, which code correctly sends an arm command?

Amaster.mav.command_long_send(master.target_system, master.target_component, MAV_CMD_COMPONENT_ARM_DISARM, 0, 0, 1, 0, 0, 0, 0, 0)
Bmaster.mav.command_long_send(master.target_system, master.target_component, mavutil.mavlink.MAV_CMD_ARM_DISARM, 0, 1, 0, 0, 0, 0, 0, 0)
Cmaster.mav.command_long_send(master.target_system, master.target_component, mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 1, 0, 0, 0, 0, 0, 0)
Dmaster.mav.command_long_send(master.target_system, master.target_component, mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 0, 1, 0, 0, 0, 0, 0)
Attempts:
2 left
💡 Hint

Check the command constant name and the parameter order for arming.

🚀 Application
expert
2:00remaining
How many fields does a standard MAVLink HEARTBEAT message contain?

The MAVLink HEARTBEAT message is essential for drone status. How many bytes does its payload contain?

A5
B9
C7
D11
Attempts:
2 left
💡 Hint

Refer to the MAVLink common message set documentation for HEARTBEAT.