ALT_HOLD using GPS for altitude while barometer is primary source

Hi,

I was under the impression that ALT_HOLD did not use GPS data when EK2_ALT_SOURCE is set to 0 (barometer).

However, in the log from a recent flight I noticed that part way through the flight, the flight controller believed altitude value appears to start to follow the GPS value for a period, instead of the barometer. It then corrected to match the barometer reading at large intervals.

In this case the GPS altitude is incorrect, and the barometer was actually more accurate.

I also have AHRS_GPS_USE = 1, which does not include GPS for height (although I am not totally sure if this is relevant).

This log was taken using Arducopter 4.0.3 running on a Cube Orange.

Can anyone clarify in what way ALT_HOLD uses GPS data when both GPS and barometer are available, but barometer is set to be the primary altitude source?

Am I just analysing the log incorrectly, and GPS altitude is not what is causing the difference between barometric and believed altitude?

There is a picture of the relevant section of the log below.

Thanks!

1 Like

GPS is used for vertical velocity. There have been various discussions about making this better, but requires code changes

Ok, that makes sense then, thanks for the information.

I do feel that alt hold (with barometer for altitude) is at least partly designed for where there is no compass and GPS.

Using GPS when it is available can cause issues.
It is not intuitive, and you might be deliberately using ALT_HOLD mode due to GPS innaccuracy.