EKF lane change causes change in canonical altitude

Just had a scary situation where an EKF lane change caused the vehicle altitude (POS.Alt) to jump drastically. This is also the altitude which is reported in the GLOBAL_POSITION_INT MAVLink message, which I was using to navigate the drone in Guided mode.

The jump in altitude was because the two EKF cores had very different origin altitudes. However, it was my understanding that this altitude should remain consistent regardless of EKF origin (ie, it should be relative to the EKF origin currently in use). @rmackay9 I hope you don’t mind the ping, but this seems like unintended/undesirable behavior.

To be clear, when the EKF switched lanes,
These altitudes changed:

  • POS.Alt
  • GLOBAL_POSITION_INT.alt
  • POS.RelHomeAlt

These altitudes did NOT change:

  • POS.RelOriginAlt
  • CTUN.Alt
  • CTUN.BAlt (and BARO.Alt)
  • NKF1.PD (for both cores)

@rmackay9 Can I get clarification as to whether this is intended behavior? I don’t see any other MAVLink message published by Ardupilot that would contain an EKF altitude that is independent of EKF origin.

1 Like

I had this happen again. I noticed that it’s a known issue, both with EKF2 and EKF3.

It seems to have little practical consequence when flying in AltHold or Loiter, but since it causes the altitude reported via MAVLink to be incorrect, it becomes a safety issue if that is being used to control the drone.