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.

From my experience take off in altitude mode…Once you switch to Position flight mode , land the drone and restart the flight in POSITION flight mode …You will see almost accurate altitude values …tested it using mission under QGC , it worked correctly…

The magnitude of the offset here is interesting. Going from roughly 4 m actual height to about -2.5 m indicated height seems worth investigating in the estimator data rather than assuming this is normal barometric drift.

I would try to identify the first point where the height sources begin to disagree.

If you still have the .ulg from this flight, could you share it?

In particular, I would compare:

  • barometric altitude

  • GNSS altitude

  • EKF local vertical position

  • vertical velocity

  • estimator innovations / innovation test ratios

  • estimator status and reset events

  • the timestamps of the Position ↔ Altitude mode transitions

It would also be useful to check EKF2_HGT_REF and the enabled height-source configuration.

PX4 can fuse multiple height sources, but the long-term height estimate follows the configured reference source. Without a range sensor, the interesting question here is therefore not simply whether barometric drift exists, but which measurement first diverges from the estimator and whether an estimator reset or fusion-state transition occurs around the same time.

The immediate return to zero after landing/disarming is another reason I would inspect the estimator/reset timeline.

If you can upload the ULog, I’d be interested in looking at the first divergence point.