GPS/Compass (landing page)

Copter/Plane/Rover support integration with GPS, Compass and other positioning technologies:



These GPS can incorporate real time kinematic data, either internally generated or externally provided, to improve the precision of the position estimate from the normal GPS meter range down to the cenitmeter range (see RTK GPS Correction (Fixed Baseline)). This increased precision also allows for “Moving Baseline” yaw estimates using two devices on a vehicle with certain RTK GPSes (F9P based) or dedicated Moving Baseline GPSes. See GPS for Yaw (aka Moving Baseline).


It is important that a GPS be connected to the first SERIALx port that has its SERIALx_PROTOCOL parameter set to “5” (GPS) since it will stop searching for GPS during bootup if not found on the first port configured for GPS protocol.

GPS Driver Options

Several GPS operating options are provided by the GPS_DRV_OPTIONS parameter. This parameter is a bit mask and allows multiple option selections at the same time:

  • bit 0: if set, will send RTK correction data from the first GPS directly to the second via the second’s UART port for GPS for Yaw (aka Moving Baseline), instead via the autopilot.

  • bit 1: if set, enable SBF moving baseline yaw using custom base and GPS_MB1 offsets.

  • bit 2: if set, use 115.2Kbaud for max serial data rate for those GPSes not capable of higher rates.

  • bit 3: if set, routes RTK data between two CAN GPSes via CAN instead of via the autopilot.

  • bit 4: if set, GPS reports altitude in ellipsoid height instead of height AMSL.

GPS Auto Switch

When using two GPS units there are a number of switching options that can be selected with GPS_AUTO_SWITCH.

  • 0: Use Primary

    Always use the primary GPS, this can be either the first or second as set with GPS_PRIMARY

  • 1: Use best

    Automatically select the best GPS, this is done based on GPS fix status (2D / 3D / rtk) if both GPSs have the same fix status the one with the larger number of satellites is used.

  • 2: Blend

    Blend is best suited for use with two identical GPS units, see GPS blending

  • 4: Use primary if 3D fix or better

    Use primary GPS as set with GPS_PRIMARY if it has a 3D fix or better. This should be used when two dissimilar GPS units are used, one high quality primary unit, and a secondary less accurate unit. In this case the high quality GPS will often have a better quality fix even if it has fewer satellites. Using ‘Use best’ in this case would result in using the poorer quality GPS and result in more switching between GPS units. Unlike ‘Use Primary’ this option still allows falling back to the secondary GPS if 3D fix is lost on the primary.

An additional variation with GPS switching is EKF3 affinity and lane switching. An EKF lane can be setup to use either GPS and the whole EKF lane is then switched based on its health. If the GPS_PRIMARY is used for a lane, and GPS_AUTO_SWITCH is enabled, then the lane will use GPS info as determined by the GPS_AUTO_SWITCH setting.