MAVLINKGPS

Setting GPS_TYPE = 14

To tell ArduPilot to "listen" for GPS data coming from a MAVLink message rather than a physical UART wire, you must configure the GPS driver backend.

1. The Primary Parameter

  • Parameter: GPS_TYPE (or GPS1_TYPE on newer firmware).
  • Value: 14 (MAVLink).
  • Effect: This loads the AP_GPS_MAV backend driver. This driver subscribes to the internal message bus, waiting specifically for MAVLINK_MSG_ID_GPS_INPUT (#232).

2. The Transport Layer

Unlike a U-Blox module where you set SERIAL1_PROTOCOL = 5 (GPS), for Virtual GPS you set the port to MAVLink.

  • Parameter: SERIAL0_PROTOCOL (USB) or SERIAL1_PROTOCOL (Telem 1).
  • Value: 2 (MAVLink 2).
  • Why: The GPS_INPUT message is just a standard MAVLink packet. It travels over the same link as your telemetry, heartbeat, and RC overrides.

3. EKF Configuration

Ensure the Extended Kalman Filter is active and ready to fuse GPS data.

EKF3 Source Selection (Copter 4.1+)

To specifically prioritize the Phone's GPS data for horizontal position but use LiDAR for altitude (highly recommended):

Verification

Once connected:

  1. Open Mission Planner > Flight Data.
  2. Look at the GPS Status label.
  3. No Fix: The driver is loaded (GPS_TYPE=14), but no data is arriving from the phone.
  4. 3D Fix: The driver is receiving valid GPS_INPUT packets from the phone.

Multiple GPS Setup

You can use the phone as a secondary GPS.

  • GPS1_TYPE = 1 (Auto) -> Physical U-Blox on the roof.
  • GPS2_TYPE = 14 (MAVLink) -> Virtual GPS via USB.
  • Result: ArduPilot will blend or switch between them based on GPS_AUTO_SWITCH logic.