Each MAVLink sender maintains a per-link sequence counter (0–255, wrapping). The receiver tracks the expected next sequence number for each (sysid, compid) pair and increments a loss counter when gaps are detected.
python
# Pymavlink: reading packet loss stats
conn = mavutil.mavlink_connection("udpin:0.0.0.0:14550")
conn.wait_heartbeat()
# After some traffic...
stats = conn.mav_loss # total lost packets
total = conn.mav_count # total received
if total > 0:
loss_pct = (stats / (stats + total)) * 100
print(f"Packet loss: {loss_pct:.1f}%")Practical thresholds
< 1% loss is healthy. 1–5% is acceptable for telemetry but commands should be retried. > 5% indicates a link problem — check antenna orientation, interference, or baud-rate mismatch.