Hello,
I am currently developing an outdoor multirotor platform based on PX4 Autopilot running on a Raspberry Pi (PilotPi), and I would like to share a detailed summary of the troubleshooting steps I have taken so far regarding a persistent EKF2 “Heading estimate not stable” preflight failure.
System Overview
-
Autopilot: PX4 (EKF2)
-
Companion / Host: Raspberry Pi (Ubuntu)
-
IMU: ICM42605 (SPI)
-
Barometer: MS5611 (I2C, Internal)
-
Magnetometers:
-
MAG0: IST8310 (I2C, Internal)
-
MAG1: QMC5883 (I2C, external, integrated in GPS module)
-
-
GPS: BZ-251 (u-blox M10, UBX protocol, 10 Hz)
GPS Verification
-
GPS was tested independently on the Raspberry Pi using
/dev/ttySC0 @ 115200. -
Confirmed valid NMEA output.
-
PX4 GPS driver was tested with both protocols:
-
gps start -p nmea→ no valid data -
gps start -p ubx→ successful
-
-
PX4 reports:
-
Fix type: 3
-
Satellites used: 21
-
Position, velocity, and timing data valid
-
-
Conclusion: GPS is working correctly and publishing valid data
EKF2 and Performance Validation
-
EKF2 status shows stable timing:
-
EKF rate: 200 Hz
-
Average execution time: ~10 µs
-
-
Work queue monitoring confirms no scheduling overruns.
-
Conclusion: CPU performance and scheduling are not the cause of the issue
Magnetometer Investigation
IST8310 (MAG0)
-
Detected correctly by PX4
-
Calibration repeatedly fails due to severe noise
-
EKF2 consistently rejects magnetometer data
-
Known issue with IST8310 noise characteristics confirmed during testing
QMC5883 (MAG1)
-
Detected on I2C bus and visible via
listener sensor_mag -
Priority and calibration parameters verified
-
Despite this, EKF2 does not accept it as a valid yaw source
-
Heading remains unavailable (
heading = NaN) -
PX4 continues to report:
-
Preflight Fail: heading estimate not stable -
Found 0 compass (required: 1)
-
Configuration Attempts
-
Verified magnetometer priority parameters
-
Attempted to force EKF2 magnetometer usage
-
Confirmed that EKF2 is running with valid local and global position estimates
-
Tested indoor and outdoor environments
-
Verified that the issue persists even with a valid GPS fix
Current Conclusion
-
EKF2 requires a reliable yaw observation source for arming
-
In the current configuration:
-
IST8310 is rejected due to noise
-
QMC5883 is not accepted as a valid EKF2 yaw source
-
No dual-GPS yaw is available
-
-
As a result, PX4 cannot produce a stable heading estimate and blocks arming
Please let me know if you need any additional logs, parameters, or test results.