PX4 supports global navigation satellite systems (GNSS) (including GPS, GLONASS, Galileo, BeiDou, QZSS and SBAS) using receivers that communicate via the u-blox, MTK Ashtech or Emlid protocols, or via UAVCAN. 它还支持 实时动态（RTK）GPS接收器 ，它将 GPS 系统扩展到厘米级精度。
PX4 can be used with the following compass parts (magnetometers): Bosch BMM 150 MEMS (via I2C bus), HMC5883 / HMC5983 (I2C or SPI), IST8310 (I2C) and LIS3MDL (I2C or SPI). Up to 4 internal or external magnetometers can be connected, though only one will actually be used as a heading source.
The system automatically chooses the best available compass based on their priority (external magnetometers have a higher priority than internal magnetometers). If the primary compass fails in-flight, it will failover to the next one. If it fails before flight, arming will be denied.
When using Pixhawk-series flight controllers, we recommend using a combined GPS + Compass mounted as far away from the motor/ESC power supply lines as possible - typically on a pedestal or wing (for fixed-wing). The internal compass may be useful on larger vehicles (e.g. VTOL) where it is possible to reduce electromagnetic interference by mounting the Pixhawk a long way from power supply lines. On small vehicles an external compass is almost always required.
# Supported GNSS and/or Compass
PX4 should work with any unit that communicates via the u-blox, MTK Ashtech or Emlid protocols, or via UAVCAN. This list contains GNSS/Compass units that have been tested by the PX4 dev team, or which are popular within the PX4 community.
- ✓ or a specific part number indicate that a features is supported, while ✗ or empty show that the feature is not supported. "?" indicates "unknown".
- Where possible and relevant the part name is used (i.e. ✓ in the GPS column indicates that a GPS module is present but the part is not known).
- Avionics Anonymous UAVCAN Magnetometer (opens new window) is a compass (not a GPS).
- Some RTK modules can only be used in a particular role (base or rover), while others can be used interchangeably.
- The list may omit some discontinued hardware that is still supported. For example CubePilot Here+ RTK GPS is discontinued and may be removed from the list in a future release. The original Here has already been removed. Check earlier versions if a discontinued module is not mentioned here.
# Hardware Setup
Instructions for connecting the GPS (and compass, if present) are usually provided by the manufacturer (at least for more common Autopilot Hardware).
Pixhawk Series controllers typically have a clearly labeled port for connecting the GPS, and the compass is connected to either the I2C or SPI port/bus (depending on the device).
The Zubax GNSS 2 (opens new window), CubePilot Here3 CAN GNSS GPS (M8N) (opens new window), and Avionics Anonymous GNSS/Mag (opens new window) can also be connected via UAVCAN.
Pay attention to pinout when connecting the GPS module. While these are all software-compatible, there are several different pin orderings.
# GNSS Configuration
The "standard" GPS configuration is provided below. Additional device-specific configuration may be provided in PX4 or manufacturer device documentation (e.g. Trimble MB-Two > Configuration).
The GPS protocol expected by PX4 defaults to u-blox (by default other GPS types like Trimble, Emlid, MTK, will not be detected) The protocol can be configured with GPS_x_PROTOCOL.
# Configuring the Primary GPS
GPS configuration on Pixhawk is handled transparently for the user - simply connect the GPS module to the port labeled GPS and everything should work.
The default Serial Port Configuration works for most devices. If you are using the Trimble MB-Two you will need to modify the configuration to explicitly set the rate to 115200 baud.
# Configuring a Secondary GPS (Dual GPS System)
The following steps show how to configure a secondary GPS on the
TELEM 2 port in QGroundControl:
- Open QGroundControl and navigate to the Vehicle Setup > Parameters section.
- 选择 GPS 选项卡(1)，然后打开 GPS_2_CONFIG 参数(2)，并从下拉列表(3) 中选择 TELEM 2。
- Reboot the vehicle in order to make the other parameters visible.
- 选择 串口 选项卡，并打开 SER_TEL2_BAUD 参数 (
TELEM 2端口波特率)：将其设置为 Auto。
After setting up the second GPS port:
- Configure the ECL/EKF2 estimator to blend data from both GPS systems. For detailed instructions see: Using the ECL EKF > Dual Receivers.
# Configuring GPS as Yaw/Heading Source
When using GPS for yaw fusion you will need to configure the following parameters:
|GPS_YAW_OFFSET||The angle made by the baseline (the line between the two GPS antennas) relative to the vehicle x-axis (front/back axis, as shown here).|
|EKF2_AID_MASK||Set bit position 7 "GPS yaw fusion" to |
If using this feature, all other configuration should be setup up as normal (e.g. RTK Positioning).
# Compass Configuration
Compass calibration is covered in: Compass Configuration. The process is straightforward and will autodetect, calibrate and prioritise all connected magnetometers.
Further compass configuration should generally not be required.
All external compasses are given the same priority by default, which is higher than the prority shared by all internal compasses.
# Disable a Compass
As stated above, generally no further configuration should be required.
That said, developers can disable internal compasses if desired using the compass parameters. These are prefixed with CALMAGx (where
To disable an internal compass:
- Use CAL_MAGn_ROT to determine which compasses are internal. A compass is internal if
- Then use CAL_MAGx_PRIO to disable the compass. This can also be used to change the relative priority of a compass.