The HEARTBEAT message (ID 0) is the foundation of MAVLink connectivity. Every component must emit a heartbeat at 1 Hz. It carries the vehicle type, autopilot type, base mode flags, and system status.
A GCS considers a system connected when it receives heartbeats. If no heartbeat arrives for a configurable timeout (typically 3–5 seconds), the link is declared lost. This drives failsafe actions like RTL (return to launch).
python
# Pymavlink: wait for a heartbeat
from pymavlink import mavutil
conn = mavutil.mavlink_connection("udpin:0.0.0.0:14550")
conn.wait_heartbeat()
print(f"Heartbeat from system {conn.target_system}, "
f"component {conn.target_component}")Version negotiation
On first contact, both sides send MAVLink 1 heartbeats. Once a v2 heartbeat is received, the sender may switch to v2. This allows transparent fallback when one side only supports v1.