Wrong Altitude during Flying below 5m

Hi everyone,

I observed an altitude estimation issue during a recent flight and wanted to know if this is expected or if I should investigate something specific.

Setup:

  • PX4: v1.15.0
  • QGroundControl: v4.4.4
  • GPS: Holybro M9N
  • Vehicle: Octocopter
  • No lidar (barometer + GPS altitude only)

Flight details:

  • The vehicle was hovering at approximately 6 m above the ground.

  • During the flight, I switched several times between Position mode and Altitude mode.

  • After some time, I noticed the altitude displayed in QGroundControl gradually drifted downward.

  • Although the drone was actually flying at around 4 m, QGC was showing approximately -2.5 m altitude.

  • After landing and disarming, the displayed altitude immediately reset to 0 m.

Questions:

  1. Is this behavior expected when relying only on the barometer and GPS (without a Lidar)?
  2. Can frequent switching between Position and Altitude modes contribute to this altitude drift?
  3. Is this likely caused by barometer drift, EKF2 altitude estimation, or another issue?
  4. Are there any EKF2 or barometer-related parameters that I should check or tune to minimize this drift?

From my understanding of PX4 and how sensors work, without some kind of distance_to_ground metric, your UAV will drift.

For one, GPS height is much less accurate than XY position estimation. It can fluctuate more than 1m in the Z axis. If your scenarios define flight at high altitude, this mostly isn’t a concern.

Barometer, on the other hand, is much more precise (+/- 10cm, or maybe even less), but it is vulnerable to static pressure changes. Let’s say you take off from some location at time X. After a while, the atmospheric pressure at the starting location has changed (if not, you are living in a low-resolution simulation xD). So, this also changed your internal height above the home position - even if the drone is still hovering at the same height. There is a lot to discover about it and how EKF tries to compensate for that (I’m still trying to fully understand it).

In short, the barometer will drift over time. GPS would not be accurate enough.

Hope this helps.

Thanks Jesz,

Is there anything to do before flight to minimalize this one?

I encountered this issue before as well. Later, during flight tests, I made it a practice to keep the drone stationary on the ground for at least 30 seconds before arming it. After arming, I waited another 5 seconds before operating the joysticks to take off. This was done to allow sufficient time for the barometer and EKF2 to complete their calibration and correction processes, which helped alleviate the problem to a certain extent.

Using PX4’s Navigation Filter (EKF2) | PX4 Guide (main)
Some of the debugging information here might be helpful to you.