MAVLINKGPS

The "Human Sensor" Analogy

Drone Proprioception

To understand why "Virtual GPS" is difficult, we must understand how a drone perceives the world.

A drone's internal IMU (Inertial Measurement Unit) is like the human proprioceptive system (muscle memory and nerves).

  • Accelerometer: Senses gravity and linear acceleration. It knows down.
  • Gyroscope: Senses rotation. It knows spin.
  • Update Rate: 400Hz - 1000Hz (Fast).

The drone knows exactly how its body is moving instant-to-instant. But without eyes (GPS/Optical Flow), it has no idea where it is in the room. It is like a blindfolded gymnast—perfect balance, but eventually, they will drift into a wall.

The Phone as the Vestibular System

Injecting Android location data is like giving that blindfolded gymnast a spotter who shouts coordinates every few milliseconds.

The Android phone acts as the Vestibular System (Inner Ear) + Vision.

  • Network Fusion: Provides the "Absolute Position" (X, Y, Z coordinates).
  • Update Rate: 1Hz - 10Hz (Slow).

The Latency Challenge: " The Dizzy Bat"

The core engineering challenge in MAVLink GPS is Latency.

  1. The IMU (Drone) feels a movement at T=0ms.
  2. The Phone (Android) detects the position change at T=100ms (due to filtering delay).
  3. The USB Link transmits the data at T=120ms.
  4. The Flight Controller receives it at T=130ms.

If the EKF (Extended Kalman Filter) simply applied the position update now (T=130ms), it would correct for a movement that happened 130ms ago. This is like trying to balance on one foot while your inner ear is delayed by half a second. The result is Oscillation (the "Toilet Bowl Effect").

The Solution: Time Travel

This is why the time_usec field in the MAVLink GPS_INPUT message is critical.

  • We timestamp the location when Android measured it (T=100ms).
  • We send it to the drone.
  • The EKF3 receives it at T=130ms.
  • The Magic: The EKF3 keeps a "history buffer" of its state. It looks at the timestamp (T=100ms), "rewinds" its internal math to that moment, applies the correction, and then "fast forwards" back to the present (T=130ms).

This allows the slow, delayed phone data to perfectly fuse with the fast, instant IMU data, stabilizing the drone without oscillation.