What are the potential repercussions of restarting the EKF2 after charging?

In our application we have a very large drone that fast charges with a very high current. We noticed that during charge, the heading reported by QGC could drift up to 30deg and would take some time to return to the correct heading value. To get around this, we have taken to programmatically restarting the EKF2 after each charge. This resets the mag heading value successfully.

Are there downstream problems that this could cause?

If so, is there an alternative recommendation for how to handle this?

For reference, we have also tried disabling the Magnetometer Bias Estimator as it tries to learn the biases while charging. This didn’t seem to have much an effect.

I’m assuming this very large drone flies outdoors only?

In that case you could try dual GPS heading antennas as they perform much better in high noise environments than mangetometers. You would need to order 2x GPS’s in order to do this and mount them elevated and with a minimum of 30-50cm distance between the gps’s.

Some DroneCAN RTK GPS’s that are compatible with dual heading feature:

  1. Ark F9P

  2. Holybro F9P

2 Likes

Hi, there is no issue resetting the EKF between each flight, however you could maybe avoid this if you reduce the thresholds of the magnetometer checks (so the EKF won’t try to fuse the mag when the mag is affected by high current).
see EKF2_MAG_CHECK, EKF2_MAG_CHK_INC and EKF2_MAG_CHK_STR.

You can check in the log the values of estimator_status.mag_inclination_deg and estimator_status_mag_strength_gs during charging to set the thresholds accordingly.

1 Like

Yes, correct.

Definitely working on pushing for GPS Compassing in future builds. Thanks for the links!

Thanks for the info @bresch!

We are forked off v1.13 so I believe the inclination checks aren’t available, unfortunately.

We are seeing another oddity that I am having a bit of trouble tracking down. The in-air magnetometer reset happens prematurely quite often. Here is an example from a ulog:

As you can see, the cs_mag_aligned_in_flight flag triggers well before the thrust has reached the minimum for takeoff (0.7 for our craft).

This doesn’t happen every time, but it seems to happen about 50% of the time. Any ideas? I think the mechanism behind this was changed in v1.15… unfortunately upgrading isn’t an option for us in the short term.

Hi, the in-flight mag alignment is triggered at 1.5m above ground.
You should investigate why you’re getting this dist_bottom jump to > 1m while the distance sensor reports 0.7m. Is it maybe due to the barometric altitude change due to prop wash and the distance sensor not being valid?

1 Like

The strength check was already available IIRC; but I’m not sure if we already had the threshold as a parameter (but you can change this in your fork if needed).

1 Like

@bresch Actually… I think I was assuming there was something that prevents the EKF from fusing the distance sensor until the moment that it jumps.

Is that not the case? should those values be well aligned, and not experience jumps?

Is it maybe due to the barometric altitude change due to prop wash and the distance sensor not being valid?

Perhaps? I can investigate that. Thanks for the direction.