MAVLINKGPS

Serial vs. UDP

The Transport Layer

MAVLink GPS supports two methods of connecting to the Flight Controller: USB Serial and UDP Network.

1. USB Serial (Direct)

This is the "Hardwired" approach. You connect the Android phone's USB-C port to the Flight Controller's USB-C (or Micro-USB) port using an OTG cable.

  • Latency: Extremely low (< 5ms). This is critical for the "tightness" of the position hold loop.
  • Jitter: Near zero. The data stream is isochronous.
  • Power: The Flight Controller can charge the phone (or vice-versa, depending on cabling).
  • Verdict: REQUIRED FOR FLIGHT. You should never trust a critical navigation sensor to a wireless link that can be jammed or dropped.

2. UDP (WiFi Bridge)

This approach routes the data through an ESP8266 or similar WiFi bridge running MAVLink.

  • Mechanism: Android -> WiFi -> ESP8266 -> UART -> Flight Controller.
  • Latency: High (20-100ms+). WiFi is a shared medium with collisions.
  • Packet Loss: UDP makes no guarantee of delivery. Missing GPS_INPUT packets causes the EKF "Data Age" to spike, leading to rough flight performance.
  • Verdict: TESTING ONLY. Useful for bench testing or developing the app without cables, but dangerous for actual flight navigation.

Why USB is King

The EKF3 assumes the GPS data arrives with consistent timing.

  • Serial: Consistent 10Hz heartbeat.
  • UDP: Bursty. You might get 5 packets in 10ms, then silence for 200ms. This "Cluster/Gap" pattern confuses the velocity estimator.