PX4 supports global navigation satellite systems (GNSS) (including GPS, GLONASS, Galileo, BeiDou, QZSS and SBAS) using receivers that communicate via the UBlox, MTK Ashtech or Emlid protocols, or via UAVCAN. It also supports Real Time Kinematic (RTK) GPS Receivers, which extend GPS systems to centimetre-level precision.
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 internal priority (external magnetometers have a higher priority). 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.
- Emlid Reach M+ (emlid.com)
At time of writing PX4 does not support RTK GPS with this module (only "ordinary" GPS). Support is expected in the near future.
Some popular GPS/compass options include:
- Ublox Neo-M8N GPS with Compass (Hobbyking)
- mRo GPS u-Blox Neo-M8N Dual Compass LIS3MDL+ IST8310 (mRo store)
- Drotek uBlox GPS/Compasses (drotek)
- Holybro Micro M8N GPS Module (getfpv)
- Holybro Ublox NEO-M8N GPS Module (getfpv)
- Holybro Pixhawk 4 GPS Module (UBLOX 8MN GPS + IST8310 compass + LED + Safety switch).
- Here GNSS GPS (M8N) (getfpv)
- Zubax GNSS 2 (zubax.com)
- 3DR uBlox GPS with Compass kit (getfpv) - Discontinued
Instructions for connecting the GPS and compass are usually provided by the manufacturer (at least for more common Autopilot Hardware).
Pixhawk Series controllers usually 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 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.
Information about supported devices and setup/configuration can be found in the sidebar under: RTK 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.
The following steps show how to configure a secondary GPS on the
TELEM 2 port in QGroundControl:
- Find and set the parameter GPS_2_CONFIG to TELEM 2.
- Open QGroundControl and navigate to the Vehicle Setup > Parameters section.
- Select the GPS tab (1), then open the GPS_2_CONFIG parameter (2) and select TELEM 2 from the dropdown list (3).
- Reboot the vehicle in order to make the other parameters visible.
- Select the Serial tab, and open the SER_TEL2_BAUD parameter (
TELEM 2port baud rate): set it to Auto.
Compass calibration is covered in: Compass Configuration. The process is straightforward and will calibrate all connected magnetometers.
Additional configuration can be performed using the CAL_MAGx_ parameters (where
Generally you will not need to modify these as compasses are autodetected, prioritised and are all calibrated at the same time
(a possible exception is CAL_MAGx_EN which might be used to disable an internal compass).
You may however wish to read them, as they will let you know which magnetometers are internal or external (CAL_MAGx_EN) and which is being uses as the main heading source (CAL_MAG_PRIME).