# RTK GPS

[Real Time Kinematic (RTK)](https://en.wikipedia.org/wiki/Real_Time_Kinematic) GNSS/GPS systems provide centimeter-level accuracy, allowing PX4 to be used in applications like precision surveying (where pinpoint accuracy is essential).

This feature requires _QGroundControl_ running on a laptop/PC and a vehicle with a WiFi or Telemetry radio link to the ground station laptop.

:::note Some RTK GPS setups can provide yaw/heading information, as an alternative to the compass:

* [RTK GPS Heading with Dual u-blox F9P](rtk_gps/u-blox_f9p_heading).
* GPS directly output yaw (see table below). :::

## Supported RTK Devices

PX4 supports the [u-blox M8P](https://www.u-blox.com/en/product/neo-m8p), [u-blox F9P](https://www.u-blox.com/en/product/zed-f9p-module) and the [Trimble MB-Two](https://www.trimble.com/Precision-GNSS/MB-Two-Board.aspx) GPS, and products that incorporate them.

The RTK compatible devices below that are expected to work with PX4 (it omits discontined devices). The table indicates devices that also output yaw, and that can provide yaw when two on-vehicle units are used. It also highlights devices that connect via the CAN bus, and those which support PPK (Post-Processing Kinematic).

| GPS                                                                                           | Yaw Output | [Dual F9P GPS Heading](rtk_gps/u-blox_f9p_heading) | [DroneCAN](dronecan) | PPK |
| --------------------------------------------------------------------------------------------- | :--------: | :------------------------------------------------: | :------------------: | :-: |
| [ARK RTK GPS](rtk_gps/ark_rtk_gps)                                                            |            |                          ✓                         |           ✓          |     |
| [CUAV C-RTK GPS](rtk_gps/rtk_gps_cuav_c-rtk)                                                  |            |                                                    |                      |     |
| [CUAV C-RTK2](rtk_gps/rtk_gps_cuav_c-rtk2)                                                    |            |                                                    |                      |  ✓  |
| [CUAV C-RTK 9Ps GPS](rtk_gps/rtk_gps_cuav_c-rtk-9ps)                                          |            |                          ✓                         |                      |     |
| [Femtones MINI2 Receiver](rtk_gps/rtk_gps_fem_mini2)                                          |            |                                                    |                      |     |
| [Freefly RTK GPS](rtk_gps/rtk_gps_freefly) (F9P)                                              |            |                                                    |                      |     |
| [CubePilot Here3](https://www.cubepilot.org/#/here/here3)                                     |            |                                                    |           ✓          |     |
| [Holybro H-RTK F9P Helical or Base](rtk_gps/rtk_gps_holybro_h-rtk-f9p)                        |            |                          ✓                         |                      |     |
| [Holybro DroneCAN H-RTK F9P Helical](https://holybro.com/products/dronecan-h-rtk-f9p-helical) |            |                          ✓                         |           ✓          |     |
| [Holybro H-RTK F9P Rover Lite](rtk_gps/rtk_gps_holybro_h-rtk-f9p)                             |            |                                                    |                      |     |
| [Holybro DroneCAN H-RTK F9P Rover](https://holybro.com/products/dronecan-h-rtk-f9p-rover)     |            |                                                    |           ✓          |     |
| [Holybro H-RTK M8P GNSS](rtk_gps/rtk_gps_holybro_h-rtk-m8p)                                   |            |                                                    |                      |     |
| [Holybro H-RTK UM982 GPS](rtk_gps/rtk_gps_holybro_unicore_um982)                              |      ✓     |                                                    |                      |     |
| [LOCOSYS Hawk R1](rtk_gps/rtk_gps_locosys_r1)                                                 |            |                                                    |                      |     |
| [LOCOSYS Hawk R2](rtk_gps/rtk_gps_locosys_r2)                                                 |      ✓     |                                                    |                      |     |
| [Septentrio AsteRx-RIB](rtk_gps/septentrio_asterx-rib)                                        |      ✓     |           Septentrio dual antenna heading          |                      |  ✓  |
| [Septentrio mosaic-go](rtk_gps/septentrio_mosaic-go)                                          |      ✓     |           Septentrio dual antenna heading          |                      |  ✓  |
| [SparkFun GPS-RTK2 Board - ZED-F9P](https://www.sparkfun.com/products/15136)                  |            |                          ✓                         |                      |     |
| [SIRIUS RTK GNSS ROVER (F9P)](https://store-drotek.com/911-sirius-rtk-gnss-rover-f9p.html)    |            |                          ✓                         |                      |     |
| [mRo u-blox ZED-F9 RTK L1/L2 GPS](https://store.mrobotics.io/product-p/m10020d.htm)           |            |                          ✓                         |                      |     |
| [Trimble MB-Two](rtk_gps/rtk_gps_trimble_mb_two)                                              |      ✓     |                                                    |                      |     |

:::note Some RTK modules can only be used in a particular role (base or rover), while others can be used interchangeably. :::

## Positioning Setup/Configuration

RTK positioning requires a _pair_ of [RTK GPS devices](#supported-rtk-devices): a "base" for the ground station and a "rover" for the vehicle.

In addition you will need:

* A _laptop/PC_ with QGroundControl (QGroundControl for Android/iOS do not support RTK)
* A vehicle with a WiFi or Telemetry radio link to the laptop.

:::note _QGroundControl_ with a base module can theoretically enable RTK GPS for multiple vehicles/rover modules. At time of writing this use case has not been tested. :::

### Hardware Setup

#### Rover RTK Module (Vehicle)

The connection method and cables/connectors required depends on the selected RTK module (and on the [flight controller](../flight_controller)).

Most are connected via the flight controller's GPS port, in the same way as any other GPS module. Some are connected to the [CAN](can) bus (i.e. using [DroneCAN](dronecan)).

See [documentation for the selected device](#supported-rtk-devices) and [DroneCAN](dronecan) for more information on wiring and configuration.

#### Base RTK Module (Ground)

Connect the base module to _QGroundControl_ via USB. The base module must not be moved while it is being used.

:::tip Choose a position where the base module won't need to be moved, has a clear view of the sky, and is well separated from any buildings. Often it is helpful to elevate the base GPS, by using a tripod or mounting it on a roof. :::

#### Telemetry Radio/WiFi

The vehicle and ground control laptop must be connected via [wifi or a radio telemetry link](telemetry).

The link _must_ use the MAVLink 2 protocol as it makes more efficient use of the channel. This should be set by default, but if not, follow the [MAVLink2 configuration instructions](#mavlink2) below.

### RTK Connection Process

The RTK GPS connection is essentially plug and play:

1. Start _QGroundControl_ and attach the base RTK GPS via USB to the ground station. The device is recognized automatically.
2.  Start the vehicle and make sure it is connected to _QGroundControl_.

    :::tip _QGroundControl_ displays an RTK GPS status icon in the top icon bar while an RTK GPS device is connected (in addition to the normal GPS status icon). The icon is red while RTK is being set up, and then changes to white once RTK GPS is active. You can click the icon to see the current state and RTK accuracy. :::
3.  _QGroundControl_ then starts the RTK setup process (known as "Survey-In").

    Survey-In is a startup procedure to get an accurate position estimate of the base station. The process typically takes several minutes (it ends after reaching the minimum time and accuracy specified in the [RTK settings](#rtk-gps-settings)).

    You can track the progress by clicking the RTK GPS status icon.

    ![survey-in](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-c51b3e61c80c69433ef9807008749f0bf23f6722%2Fqgc_rtk_survey-in.png?alt=media)
4. Once Survey-in completes:
   *   The RTK GPS icon changes to white and _QGroundControl_ starts to stream position data to the vehicle:

       ![RTK streaming](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-4724c07151e8cce783b157d635c9a059fb969575%2Fqgc_rtk_streaming.png?alt=media)
   *   Vehicle GPS switches to RTK mode. The new mode is displayed in the _normal_ GPS status icon (`3D RTK GPS Lock`):

       ![RTK GPS Status](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-a4ed9125df1ab1caae358b1e122cdf2501f5a1d3%2Fqgc_rtk_gps_status.png?alt=media)

### Optional PX4 Configuration

The following settings may need to be changed (using _QGroundControl_).

#### RTK GPS settings

The RTK GPS settings are specified in the _QGroundControl_ [General Settings](https://docs.qgroundcontrol.com/master/en/SettingsView/General.html#rtk_gps) (**SettingsView > General Settings > RTK GPS**).

![RTK GPS Setup](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-4e004cc38e03dff52f442ccfb3833798d413823a%2Fsettings_view_general_rtk_gps.jpg?alt=media)

These settings define the minimum duration and minimum accuracy for completing the RTK GPS setup process (known as "Survey-In).

:::tip You can save and reuse a base position in order to save time: perform Survey-In once, select _Use Specified Base Position_ and press **Save Current Base Position** to copy in the values for the last survey. The values will then persist across QGC reboots until they are changed. :::

#### MAVLink2

The MAVLink2 protocol must be used because it makes more efficient use of lower-bandwidth channels. This should be enabled by default on recent builds.

To ensure MAVLink2 is used:

* Update the telemetry module firmware to the latest version (see [QGroundControl > Setup > Firmware](https://docs.qgroundcontrol.com/master/en/SetupView/Firmware.html)).
* Set [MAV\_PROTO\_VER](../../../advanced_config/parameter_reference#MAV_PROTO_VER) to 2 (see [QGroundControl Setup > Parameters](https://docs.qgroundcontrol.com/master/en/SetupView/Parameters.html))

#### Tuning

You may also need to tune some parameters as the default parameters are tuned assuming a GPS accuracy in the order of meters, not centimeters. For example, you can decrease [EKF2\_GPS\_V\_NOISE](../../../advanced_config/parameter_reference#EKF2_GPS_V_NOISE) and [EKF2\_GPS\_P\_NOISE](../../../advanced_config/parameter_reference#EKF2_GPS_P_NOISE) to 0.2.

#### Dual Receivers

A second GPS receiver can be used as a backup (either RTK or non RTK). See the [EKF2 GPS Configuration](../../../advanced_config/tuning_the_ecl_ekf#gps) section.

### Vehicle Setup Example

The airframe build topic [DJI Flamewheel 450 with distance sensor and RTK GPS](../../airframes/frames_multicopter/dji_flamewheel_450) describes an airframe setup with the Here+ RTK GPS and a Pixhawk 3 Pro.

## Further Information

* [RTK-GPS (PX4-Integration)](../../development/hardware/rtk_gps): Developer information about integrating RTK-GPS support into PX4.
* [Real Time Kinematic](https://en.wikipedia.org/wiki/Real_Time_Kinematic) (Wikipedia)
