Servers by jDrones

ArduPilot "latest" switched to use EKF3 by default

For those developers who fly “latest” (aka “master”) we have just changed the default AHRS (Attitude Heading Reference System) from EKF2 to EKF3. Please be careful and report any issues you find either here or directly on discuss.

Please note that we do not recommend that users fly “latest” because it could have issues and the dev team doesn’t have the resources to provide support for this largely untested code. Instead it is best to stick with the stable and beta releases (once they are made available).

The differences between EKF2 and EKF3 include:

  • EKF3 works better for tailsitters or any other vehicle that spends a lot of time pointing directly upwards or downwards. This is because EKF3 estimates accelerometer biases for all 3 axis while EKF2 only does the vertical axis
  • EKF3 supports some additional sensors including Beacons and Wheel Encoders
  • EKF3 supports GPS-for-Yaw
  • EKF3 supports GPS to Non-GPS transitions
  • EKF2 may work better on vehicles that spin very rapidly because it estimates gyro scale factors while the EKF3 does not. Modern gyro scale factors are nearly always 1.0 though so this is probably not an issue

Even with the change to EKF3, the older EKF2 is still available on most boards and users can switch between them by changing these parameters (and rebooting the autopilot):

  • AHRS_EKF_TYPE = 2 or 3 depending upon which EKF you want
  • EK2_ENABLE = 1 to enable EKF2
  • EK3_ENABLE = 1 to enable EKF3

It is best not to enable both EKF2 and EKF3 at the same time because it could overload the CPU on some autopilots. It is unlikely to crash but it may fly badly.

This change is in preparation for the start of beta testing for ArduPilot-4.1. It is difficult to predict exactly when 4.1 beta testing will begin but it is likely that at least Rover will start in the next month followed by Plane and Copter. Thanks for your patience!


@rmackay9 Thanks for your dedication Randy…and everyone involved :wink:

Without EKF3 we could’nt have made all the great experiments we are doing here


A note of caution for any Plane user flying EKF3 as it currently exists without a compass…on takeoffs the time to get yaw aligned can be many seconds, resulting in very significant heading errors…also, if one lands and disarms, then re-arms a few minutes later, the EKF can actually become unstable to the point of losing control in modes other than manual…see PR #15810 which addresses these issues…

Awesome news! ThanksTeam!

Does it mean the position and velocity estimates are from EKF2 and the roll, pitch and yaw from EKF3? Or all estimates by default are swapped to EKF3? I do not want to be picky just sometimes INS is used for full state estimates while AHRS is the synonym for Euler angle estimates only and a different set of sensors are included in the estimation.

All estimates by default are now swapped to EKF3

1 Like

In the GPS estimated heading, ekf3 performed well.

1 Like


Ah, you tried GPS-for-Yaw? Great! This really should be one of the most popular features of 4.1 and EKF3.

Hey @rmackay9
I’d like to try GPS-for-Yaw, but I have F9P module on CAN node. Any idea when work for CAN moving baseline starts?
Thank you!

1 Like


The PR linked below resolve an issue with the CAN GPS ordering issue which I guess is critical to getting GPS-for-Yaw working using CAN F9 GPSs. I’m unsure if there are any other issues…

1 Like

yes, I have tested GPS heading estimation in 4.1 firmware.

1 Like

Thanks @rmackay9
@cuav_le Did you use CAN GPS ordering?

WRT the comment regarding high spin rates, EKF3 will perform better than EKF2 when there is sustained high yaw rates about the vertical (local gravity) axis in hover. EKF2 can develop roll and pitch errors resulting in a ‘wobble’ and temporary degradation of position hold accuracy.

Servers by jDrones