Standard VTOL (in MC Mode): Geofence Ceiling Violation 28 Meters Below Configured Ceiling


I have a question regarding the reference for geofence ceiling altitudes.


I have a newly configured VTOL (standard VTOL, Cube Orange running PX4 1.13) that I took off in multicopter mode in Stabilized flight mode. At around 2 meters above ground, I switched to altitude mode (still in multicopter) which immediately triggered a geofence ceiling failsafe. The geofence was set to 30 meters, meaning that the failsafe was triggered 27-28 meters below it. When looking through the logs there are several different altitude topics with different reference points, however the only one i find that is above 30 meters is vehicle_global_position/alt_ellipsoid which at this location sits at 61-63 meters. I highly doubt that this topic is used to trigger geofence ceiling failsafes, which makes me wonder which topic is. The one I expected to be used is vehicle_local_position/dist_bottom, but at the time of the geofence violation this value was 2.03 meters. vehicle_global_position/alt was at 17.39 meters. I have no external sensors for altitude, only the internal barometer and external GPS receiver.

In the logs you will also see a chaotic thrust and PWM output values. The reason for this is that the drone hit 20-30 cm tall grass coming in the way of the props. This did not happened until landing though, so I am unsure why it looks like this started already way above the grass. However my main concern is not regarding this, but about what triggered the geofence failsafe.

Flight Controller Log

The log from the file can be found here:

Related posts

I have been searching for similar posts but found nothing that I think is the same issue. The closest one is Geofence Altitude Premature Trigger and Overshoot Loop (GitHub: Geofence issues · Issue #16679 · PX4/PX4-Autopilot · GitHub) which mentions geofence failsafe triggers at 5-10 meters below the set ceiling altitude, however in my situation it was triggered 27-28 meter below.

I also found this issue: ms5611: ignore reading 0 by julianoes · Pull Request #20350 · PX4/PX4-Autopilot · GitHub (being fixed in 1.13.1), however I do not understand if it is related. I have negative barometer values (and also Local Position Z values) in my log, but I don’t know if this would cause a geofence ceiling failsafe, especially since none of my altitude readings (except for vehicle_global_position/alt_ellipsoid) are above, or close to, the configured ceiling.

Recreating the issue

Unfortunately I do not have a SITL environment available, so I haven’t been able to test this in simulation. I have tried it with another VTOL (a smaller standard VTOL), which triggered the geofence failsafe action 8 meters too early (geofence ceiling at 30 meter and vehicle_local_position/dist_bottom being 22 meters), which is in line with the related post linked above. Therefore I am not sure if it is the same issue as my main one that triggered 27-28 meters too early.

What I’m looking for help with

My question is why did the geofence ceiling violation take place at all? My theories are:

  • Negative barometer values
  • Bad barometer readings due to being close to the ground
  • PX4 uses an altitude reference for geofence ceilings that I do not understand
  • Any of the two related posts/issues above

but I don’t know which one of these theories seems most correct. Any kind of input is greatly appreciated.