MAVLINKHUD

Overview

The GPS parameter group configures the Global Positioning System (and other GNSS constellations like GLONASS, Galileo, BeiDou). GPS is the primary source for horizontal position, ground velocity, and UTC time for the autopilot.

ArduPilot supports up to 2 simultaneous GPS units (GPS and GPS2), with advanced logic for blending and redundancy.

Key Concepts

1. Driver Type (GPS_TYPE)

Tells ArduPilot which communication protocol to use.

  • 1 (Auto): Autodetects standard u-Blox, MTK, or NMEA.
  • 2 (u-Blox): Forces u-Blox binary protocol (recommended for most).
  • 9 (DroneCAN): For CAN-based GPS units (e.g., Here3, CubePilot).
  • 17 (Moving Baseline): For high-precision RTK Yaw.

2. Multi-GPS Redundancy (GPS_AUTO_SWITCH)

  • 0 (Disabled): Use only the primary GPS.
  • 1 (Use Best): Automatically switches to the GPS with the best satellite count and HDOP.
  • 2 (Blend): Merges both GPS solutions into one for smoother navigation.

3. Moving Baseline Yaw (GPS_MB_...)

Advanced RTK setup where two GPS units on the same vehicle calculate a relative vector between each other to determine the vehicle's heading (Yaw). This allows for accurate heading even in areas with high magnetic interference where compasses fail.

4. Configuration (GPS_SAVE_CFG)

ArduPilot can automatically send configuration commands to u-Blox receivers at boot to set the correct update rate and constellations.

Parameter Breakdown

  • GPS_TYPE: Primary driver.
  • GPS_PRIMARY: Which GPS is instance 1 (0 or 1).
  • GPS_GNSS_MODE: Bitmask to select constellations (GPS, SBAS, Galileo, etc.).
  • GPS_MIN_ELEV: Minimum satellite elevation (degrees) to ignore satellites near the horizon (noisy).
  • GPS_POS_X/Y/Z: The physical offset of the GPS antenna from the vehicle center of gravity.

Integration Guide

Standard Setup

  1. Hardware: Connect GPS to the GPS (Serial 3 or 4) port.
  2. Config: Set GPS_TYPE = 1 (Auto).
  3. Wait: Power up outdoors. Check GCS for "3D Fix."

Setting up Dual GPS Blending

  1. Connect two GPS units.
  2. Set GPS_TYPE = 1 and GPS_TYPE2 = 1.
  3. Set GPS_AUTO_SWITCH = 2 (Blend).
  4. Set GPS_POS_... and GPS2_POS_... offsets accurately.

Developer Notes

  • Library: libraries/AP_GPS.
  • Precision: Use RTK-capable receivers (u-Blox F9P) and an injection source (MavESP8266 or GCS) for centimeter-level accuracy.

GPS1_CAN_NODEID

Default 0
Range 0 127

Detected CAN Node ID for GPS (GPS1_CAN_NODEID)

Description

GPS1_CAN_NODEID displays the DroneCAN (UAVCAN) Node ID that the autopilot has assigned to or detected from the primary GPS unit. This is a Read-Only parameter used for diagnostics.

  • Role: Identifies the specific hardware device on the CAN bus.
  • Usage: If you need to force the autopilot to use a specific GPS node, set GPS1_CAN_OVRIDE instead.

The Engineer's View

  • Storage: AP_GPS::Params::node_id (Integer).
  • Update Logic: Updated by the AP_GPS_DroneCAN driver when a matching device is found and successfully configured.
  • Persistence: The value is saved to storage but overwritten on the next boot if detection changes.

Tuning & Behavior

  • Default: 0 (No device detected yet).
  • Normal Range: 0-125 (Standard DroneCAN Node IDs).
  • Dependency: Requires GPS1_TYPE = 9 (DroneCAN).

GPS1_CAN_OVRIDE

Default 0
Range 0 127

GPS DroneCAN Node ID Override (GPS1_CAN_OVRIDE)

Description

GPS1_CAN_OVRIDE allows you to force ArduPilot to use a specific GPS unit as the "Primary" when you have multiple GPS units connected via DroneCAN (UAVCAN).

  • 0 (Default): First-come, first-served. The autopilot uses the first DroneCAN GPS it detects on the bus.
  • 1-125: Locks the primary GPS slot to the hardware with this specific Node ID.

Tuning & Behavior

  • Default: 0.
  • Usage: Only set this if you have two identical DroneCAN GPS units and you want to ensure a specific physical one (e.g., the one with the best view of the sky) is always used as Instance 1.
  • Reboot Required: Yes.

GPS1_COM_PORT

Default 0
Range 0 10

GPS Device physical COM port (GPS1_COM_PORT)

Description

GPS1_COM_PORT identifies which physical connector on the GPS hardware itself is being used to talk to the flight controller.

This is only required for high-end professional GNSS receivers (like Septentrio or Trimble) that have multiple internal UART ports. Most consumer GPS modules (U-Blox) do not need this setting.

Tuning & Behavior

  • Default: 0.
  • Usage: If you are using a Septentrio (SBF) or Trimble (GSOF) receiver and the flight controller is plugged into the receiver's second port, set this to 1 or 2 to match the receiver's internal port numbering.

GPS1_DELAY_MS

ms
Default 0
Range 0 250

GPS Processing Delay (GPS1_DELAY_MS)

Description

GPS1_DELAY_MS tells the autopilot how "Old" the GPS data is when it arrives at the flight controller.

GPS modules take time to calculate position. By the time the autopilot receives the signal, the drone has already moved slightly. For accurate navigation, the EKF (Extended Kalman Filter) needs to know this delay so it can correctly align the GPS data with the high-speed inertial data (IMU).

  • 0 (Default): Use the driver's hard-coded default for the detected GPS type (e.g. 200ms for u-blox M8N).
  • 1-250: Manual override in milliseconds.

Tuning & Behavior

  • Default: 0.
  • Recommendation: Leave at 0 for most users. Only adjust this if you are using an exotic or custom GPS module and you see "Horizontal Position Drift" during aggressive maneuvering.

GPS1_GNSS_MODE

Default 0
Range null

GNSS system configuration

Note: This parameter functions identically to GPS_GNSS_MODE.

GPS1_RATE_MS

ms
Default 100
Range 20 2000

NMEA Output rate

Note: This parameter functions identically to GPS_RATE_MS.

GPS1_TYPE

Default 0
Range null

GPS type

Note: This parameter functions identically to GPS_TYPE.

GPS2_CAN_NODEID

Default 0
Range null

Detected CAN Node ID for GPS

Note: This parameter functions identically to GPS1_CAN_NODEID.

GPS2_CAN_OVRIDE

Default 0
Range null

DroneCAN GPS NODE ID

Note: This parameter functions identically to GPS1_CAN_OVRIDE.

GPS2_COM_PORT

Default HAL_GPS_COM_PORT_DEFAULT
Range 0 10

GPS physical COM port

Note: This parameter functions identically to GPS1_COM_PORT.

GPS2_DELAY_MS

ms
Default 0
Range 0 250

GPS delay in milliseconds

Note: This parameter functions identically to GPS1_DELAY_MS.

GPS2_GNSS_MODE

Default 0
Range null

GNSS system configuration

Note: This parameter functions identically to GPS_GNSS_MODE.

GPS2_RATE_MS

ms
Default 200
Range 50 200

GPS update rate in milliseconds

Note: This parameter functions identically to GPS_RATE_MS.

GPS2_TYPE

Default 0
Range null

GPS type

Note: This parameter functions identically to GPS_TYPE.

GPS_ACC

m
Default 0

GPS Accuracy (GPS_ACC)

Description

This parameter is not found as a standard GPS_ACC in the main codebase.

GPS_ALT_OFS

m
Default 0

GPS Altitude Offset (GPS_ALT_OFS)

Description

This parameter is not found as a standard GPS_ALT_OFS in the main codebase.

GPS_AUTO_CONFIG

Default 1
Range 0 2

Automatic GPS configuration (GPS_AUTO_CONFIG)

Description

Allows ArduPilot to automatically send the required initialization commands and baudrate settings to the GPS module.

Tuning & Behavior

  • Default Value: 1 (Serial only)
  • Values: 0:Disabled, 1:Enable for Serial GPS, 2:Enable for DroneCAN as well

GPS_AUTO_SWITCH

Default 1
Range 0 4

Automatic Switchover Setting (GPS_AUTO_SWITCH)

Description

Defines the logic for selecting which GPS receiver's data is sent to the EKF when two or more modules are active.

Tuning & Behavior

  • Default Value: 1 (UseBest)
  • Values:
    • 0: Use Primary (Strictly use GPS_PRIMARY)
    • 1: UseBest (Select based on highest fix status and sat count)
    • 2: Blend (Mathematically combine data from all receivers)
    • 4: Use primary if 3D fix or better

GPS_BLEND_MASK

Default 5
Range 0 7

Multi GPS Blending Mask (GPS_BLEND_MASK)

Description

GPS_BLEND_MASK controls the "Recipe" for merging two GPS signals into one.

When GPS_AUTO_SWITCH = 2 (Blend), ArduPilot doesn't just pick one GPS; it merges both into a single "Blended" solution. This parameter decides which metrics are used to determine how much to trust each GPS.

  • Bit 0 (1): Horizontal Position Accuracy. Use the reported horizontal error (hAcc) to weigh the blend.
  • Bit 1 (2): Vertical Position Accuracy. Use the reported vertical error (vAcc).
  • Bit 2 (4): Speed Accuracy. Use the velocity error (sAcc).

Tuning & Behavior

  • Default Value: 5 (Horizontal + Speed).
  • Recommendation: Leave at 5. Trusting reported vertical accuracy (Bit 1) can sometimes lead to altitude jumps if one GPS has a sudden change in its altitude noise model.

GPS_BYTELOSS

Default 0

GPS Byte Loss (GPS_BYTELOSS)

Description

This parameter is not found as a standard GPS_BYTELOSS in the main codebase.

GPS_DISABLE

Default 0

GPS Disable (GPS_DISABLE)

Description

This parameter is not found as a standard GPS_DISABLE in the main codebase.

GPS_DRIFTALT

m
Default 0

GPS Drift Altitude (GPS_DRIFTALT)

Description

This parameter is not found as a standard GPS_DRIFTALT in the main codebase.

GPS_DRV_OPTIONS

Default 0

driver options (GPS_DRV_OPTIONS)

Description

Advanced configuration for the GPS driver, such as enabling specific UART ports for moving baseline data.

Tuning & Behavior

  • Default Value: 0
  • Bitmask:
    • Bit 0: Use UART2 for moving baseline (ublox)
    • Bit 2: Use baudrate 115200
    • Bit 4: Use ellipsoid height instead of AMSL

GPS_GLITCH

Default 0

GPS Glitch (GPS_GLITCH)

Description

This parameter is not found as a standard GPS_GLITCH in the main codebase.

GPS_GNSS_MODE

Default 0

GNSS constellation mask (GPS_GNSS_MODE)

Description

Specifies which global satellite systems the receiver should use (e.g., GPS, GLONASS, Galileo, BeiDou).

  • A value of 0 usually allows the receiver to use all supported constellations.

GPS_HDG

deg
Default 0

GPS Heading (GPS_HDG)

Description

The aircraft's actual path over the ground as measured by the primary GPS receiver.

  • ReadOnly.

GPS_HDOP_GOOD

Default 140
Range 100 900

GPS HDOP Threshold (GPS_HDOP_GOOD)

Description

GPS_HDOP_GOOD sets the "Trust Limit" for your GPS during pre-arm safety checks.

HDOP (Horizontal Dilution of Precision) is a measure of GPS geometric accuracy. A lower number is better. If your GPS reports an HDOP higher than this value, the autopilot will prevent you from arming in autonomous modes (like Loiter, PosHold, or Auto) because the position data is too imprecise.

  • 100: Extremely strict (Excellent signal required).
  • 140 (Default): Standard for most users.
  • 200+: Relaxed (Allows arming with poorer signals, risky).

Tuning & Behavior

  • Default: 140 (reported as 1.4 in some GCS).
  • Safety: Do not increase this value unless you have a very specific reason to fly in an area with poor sky visibility (e.g. narrow canyons). High HDOP can lead to "GPS Glitches" where the drone suddenly jumps several meters.

GPS_HZ

Hz
Default 0

GPS Update Rate (GPS_HZ)

Description

This parameter is not found as a standard GPS_HZ in the main codebase. GPS update rate is typically configured via GPS_RATE_MS.

GPS_INJECT_TO

Default 127

Destination for GPS_INJECT_DATA (GPS_INJECT_TO)

Description

Directs the flow of RTK correction data received from the ground station.

  • 0: First GPS
  • 1: Second GPS
  • 127: All (Broadcast to all active receivers)

GPS_JAM

Default 0

GPS Jamming (GPS_JAM)

Description

This parameter is not found as a standard GPS_JAM in the main codebase.

GPS_LAG_MS

ms
Default 0
Range 0 250

User-defined delay (GPS_LAG_MS)

Description

Allows the user to manually specify the latency of the GPS data. If set to 0, ArduPilot will use a hardcoded delay based on the detected GPS type.

GPS_LOCKTIME

s
Default 0

GPS Lock Time (GPS_LOCKTIME)

Description

This parameter is not found as a standard GPS_LOCKTIME in the main codebase.

GPS_MB1_OFS_X

m
Default 0
Range -5 5

Moving Base X Offset (GPS_MB1_OFS_X)

Description

GPS_MB1_OFS_X is the critical measurement for GPS-based yaw (heading).

When using two GPS units for heading (Moving Baseline), the autopilot calculates the drone's orientation by comparing the position of the "Rover" antenna to the "Base" antenna. To do this accurately, it must know the exact physical distance between them in the body frame.

  • Positive X: The Base antenna is in front of the Rover antenna.
  • Negative X: The Base antenna is behind the Rover antenna.

Tuning & Behavior

  • Default Value: 0.
  • Accuracy: This measurement must be accurate to within 1-2 centimeters for the heading to be reliable. Use a tape measure or calipers.
  • Orientation: This is the offset relative to the other antenna, not relative to the center of gravity.

GPS_MB1_OFS_Y

m
Default 0
Range -5 5

Moving Base Y Offset (GPS_MB1_OFS_Y)

Description

GPS_MB1_OFS_Y defines the lateral (left/right) distance between the two antennas used for GPS-Yaw.

  • Positive Y: The Base antenna is to the right of the Rover antenna.
  • Negative Y: The Base antenna is to the left of the Rover antenna.

GPS_MB1_OFS_Z

m
Default 0
Range -5 5

Moving Base Z Offset (GPS_MB1_OFS_Z)

Description

GPS_MB1_OFS_Z defines the vertical distance between the two GPS antennas.

  • Positive Z: The Base antenna is lower than the Rover antenna.
  • Negative Z: The Base antenna is higher than the Rover antenna.

GPS_MB1_TYPE

Default 0
Range 0 1

Moving Base Type (GPS_MB1_TYPE)

Description

GPS_MB1_TYPE enables GPS-based yaw (heading) without a compass.

This is part of the Moving Baseline feature, where two GPS receivers (one "Base" and one "Rover") are mounted on the drone. By calculating the precise vector between them, ArduPilot can determine the drone's heading with extreme accuracy, regardless of magnetic interference.

  • 0: Relative to alternate GPS instance (Default). The two GPS units on the drone talk to each other to find the heading.
  • 1: Relative to Custom Base. Used for more complex setups with external base stations.

Tuning & Behavior

  • Default Value: 0.
  • Requirement: Requires two RTK-capable GPS modules (like u-blox F9P).
  • Configuration: You must also set the offsets between the two antennas using GPS_MB1_OFS_X/Y/Z.

GPS_MB2_TYPE

Default 0
Range 0 1

Moving Base Type (GPS_MB2_TYPE)

Description

GPS_MB2_TYPE configures the second GPS unit for dual-GPS heading (GPS-Yaw).

See GPS_MB1_TYPE for detailed theory of operation. This parameter is used when you have a second independent moving-baseline pair or a complex 3-antenna setup.

GPS_MB_ONLY_PORT

Default 0
Range 0 2

Moving Baseline CAN Port Selection (GPS_MB_ONLY_PORT)

Description

GPS_MB_ONLY_PORT is used when setting up a Moving Baseline GPS system (where two GPS units work together to calculate the drone's heading without a compass).

This parameter tells the autopilot (or peripheral node) which CAN port should be used to send the RTK correction data between the two GPS units. Using a dedicated port ensures that these high-frequency corrections don't interfere with other vital telemetry on the main CAN bus.

  • 0: Auto.
  • 1: CAN Port 1.
  • 2: CAN Port 2.

Tuning & Behavior

  • Default: 0.
  • Usage: Only used on AP_Periph CAN nodes when configuring an integrated dual-GPS system over CAN.

GPS_MIN_ELEV

deg
Default -100
Range -100 90

Minimum elevation (GPS_MIN_ELEV)

Description

Rejects satellites that are too close to the horizon, where signal multi-pathing and atmospheric distortion are highest.

  • -100 uses the GPS module's internal default.

GPS_NAVFILTER

Default 8
Range 0 8

Navigation filter setting (GPS_NAVFILTER)

Description

Configures the GPS module's internal dynamic model. Setting this correctly for your vehicle type (e.g., Airborne 4G) helps the GPS maintain a more stable fix during high-acceleration maneuvers.

Tuning & Behavior

  • Default Value: 8 (Airborne 4G)
  • Values: 0:Portable, 2:Stationary, 3:Pedestrian, 4:Automotive, 5:Sea, 6:Airborne1G, 7:Airborne2G, 8:Airborne4G

GPS_NOISE

Default 0

GPS Noise (GPS_NOISE)

Description

This parameter is not found as a standard GPS_NOISE in the main codebase.

GPS_NUMSATS

Default 0

GPS Number of Satellites (GPS_NUMSATS)

Description

Displays the count of satellites providing signals for the primary GPS receiver. A higher count generally leads to a more reliable position fix.

  • ReadOnly: Automatically reported by the GPS module.

GPS_PORT

Default 0

GPS Serial Port (GPS_PORT)

Description

This parameter is not found as a top-level GPS_PORT in the main codebase. GPS port selection is handled via SERIALx_PROTOCOL.

GPS_POS

m
Default 0

GPS Antenna Offset (GPS_POS)

Description

Specifies the physical location of the GPS antenna in body-frame coordinates (X:Forward, Y:Right, Z:Down). Providing accurate offsets improves position and velocity estimation, especially during aggressive maneuvers.

GPS_PRIMARY

Default 0
Range 0 1

Primary GPS (GPS_PRIMARY)

Description

Determines which GPS module (1st or 2nd) is treated as the primary source when GPS_AUTO_SWITCH is disabled or in specific priority modes.

  • 0: First GPS
  • 1: Second GPS

GPS_RATE_MS

ms
Default 200
Range 50 200

Desired update rate (GPS_RATE_MS)

Description

The target update period for the GPS receiver.

  • 200ms = 5Hz (Standard)
  • 100ms = 10Hz (High performance)

GPS_RAW_DATA

Default 0
Range 0 2

GPS Raw Data Logging (GPS_RAW_DATA)

Description

GPS_RAW_DATA enables the autopilot to record the raw satellite measurements (carrier phase, pseudorange) into the internal DataFlash log.

This data is used for Post-Processed Kinematics (PPK). If you need centimeter-level accuracy for mapping but don't have a real-time RTK link, you can record this raw data and use software (like RTKLIB) later to calculate an extremely precise flight path.

  • 0: Disabled. Standard NMEA/Binary position data only.
  • 1: Enabled. Logs raw data to the flight controller's SD card.
  • 2: Device Specific. (Septentrio). Commands the GPS unit itself to start/stop its internal logging synchronized with vehicle arming.

Tuning & Behavior

  • Warning: Raw GPS data creates very large log files. Ensure you have a fast, high-capacity SD card.
  • Requirement: Requires a GPS module that supports raw output (e.g. u-blox "P" or "F" series, or professional Septentrio/Trimble units).

GPS_SAVE_CFG

Default 2
Range 0 2

Save GPS Configuration (GPS_SAVE_CFG)

Description

GPS_SAVE_CFG determines if the flight controller should permanently save the settings (Baud rate, update frequency, constellations) into the GPS module's own flash memory.

  • 0: Do Not Save. Autopilot configures the GPS on every boot, but the GPS reverts to factory defaults if powered off.
  • 1: Save. Autopilot saves the settings to the GPS flash.
  • 2: Save only when needed (Default). Autopilot only writes to the GPS flash if the configuration has changed.

Tuning & Behavior

  • Default: 2.
  • Advantage: Saving the configuration can make the "GPS Lock" and "Detection" phase of the boot process slightly faster, as the GPS doesn't need to be fully reconfigured from scratch every time.
  • Note: This is primarily supported by u-blox (6 series and newer) modules.

GPS_SBAS_MODE

Default 2
Range 0 2

SBAS Mode (GPS_SBAS_MODE)

Description

Enables or disables the use of SBAS corrections (like WAAS or EGNOS) to improve GPS accuracy.

  • 0: Disabled
  • 1: Enabled
  • 2: No Change (Don't reconfigure the module)

GPS_SBP_LOGMASK

Default -256

Swift Binary Protocol Logging Mask (GPS_SBP_LOGMASK)

Description

GPS_SBP_LOGMASK is a diagnostic tool for Swift Navigation GPS receivers (Piksi/Duro).

These receivers use the Swift Binary Protocol (SBP). This mask allows developers and advanced users to filter exactly which data types from the receiver are recorded in the ArduPilot onboard logs. This helps manage log size while capturing essential troubleshooting information.

Tuning & Behavior

  • Default: -256 (0xFF00).
  • Usage: For most users, leave at the default value. If instructed by Swift Navigation support or an ArduPilot developer, you may need to change this to capture specific low-level GNSS data.
  • Impact: Setting this to record high-rate data will significantly increase the CPU load and SD card bandwidth usage.

GPS_TYPE

Default 1

GPS type (GPS_TYPE)

Description

Enables the primary GPS and selects the specific driver for the connected hardware (e.g., u-blox, NMEA, DroneCAN).

Tuning & Behavior

  • Default Value: 1 (u-blox)
  • Common Values: 1:u-blox, 2:MTK, 5:NMEA, 9:DroneCAN, 14:MAVLink, 100:SITL
  • Requires reboot after changing to initialize the new driver.

GPS_VERR

m
Default 0

GPS Vertical Error (GPS_VERR)

Description

This parameter is not found as a standard GPS_VERR in the main codebase.