EKF Lane Switch messages

Hi everyone!

We’re having a few EKF Lane Switch messages in some of the flights. It’s happening in two identical drones.

Basically, it’s a 25kg MTOW drone with orange cube+ and two Here3 receivers.

The lane switch messages are coincident with yaw reset messages in the logs (screenshot below).

The flight itself is nominal, no compass or mag field messages or alerts.

Compass calibration was done twice and this is still happening.

I’m just afraid I might me missing something so it would be nice if you have any insight about it.


https://drive.google.com/drive/folders/1VroLtmuZNeF5i0nQB7IFEGJjbGgifAT6?usp=sharing

The compasses are affected by the current draw.
This is not a great flight for it, but I ran the log through Magfit anyway and these parameters should give you better compass performance.
If you can do a flight with a couple of circles, yaw (on axis) and maybe a figure 8 - that would give a better log to further improve the compass calibration.
GNSS update rate will benefit from a minor change to select less constellations too (choose 5 or 65, whichever gives you quickest time to a 3D Fix with lowest HDOP).

GPS_GNSS_MODE,5    //  or 65
GPS_GNSS_MODE2,5   //  or 65
COMPASS_DIA_X,1.002
COMPASS_DIA_Y,1.067
COMPASS_DIA_Z,0.946
COMPASS_DIA2_X,1.007
COMPASS_DIA2_Y,1.045
COMPASS_DIA2_Z,0.900
COMPASS_DIA3_X,0.800
COMPASS_DIA3_Y,0.800
COMPASS_DIA3_Z,0.800
COMPASS_MOT_X,0.477
COMPASS_MOT_Y,-0.168
COMPASS_MOT_Z,0.173
COMPASS_MOT2_X,0.002
COMPASS_MOT2_Y,0.051
COMPASS_MOT2_Z,-0.352
COMPASS_MOT3_X,4.971
COMPASS_MOT3_Y,-10.000
COMPASS_MOT3_Z,-1.361
COMPASS_MOTCT,2
COMPASS_ODI3_Z,-0.200
COMPASS_ODI_X,0.023
COMPASS_ODI_Y,-0.036
COMPASS_ODI_Z,0.022
COMPASS_ODI2_X,0.009
COMPASS_ODI2_Y,-0.042
COMPASS_ODI2_Z,0.032
COMPASS_ODI3_X,-0.200
COMPASS_ODI3_Y,0.200
COMPASS_OFS_X,-183
COMPASS_OFS_Y,-507
COMPASS_OFS_Z,376
COMPASS_OFS2_X,-241
COMPASS_OFS2_Y,-139
COMPASS_OFS2_Z,645
COMPASS_OFS3_X,324
COMPASS_OFS3_Y,421
COMPASS_OFS3_Z,750
COMPASS_SCALE,1.00
COMPASS_SCALE2,1.00
COMPASS_SCALE3,1.00

For general tuning you can start with:

INS_ACCEL_FILTER,10
INS_HNTCH_MODE,1
INS_HNTCH_REF,0.2
INS_HNTCH_FREQ,30
INS_HNTCH_BW,15
INS_HNTCH_FM_RAT,0.7
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,4

And send another log of just hovering and some movements in AltHold (mostly) and a bit in Loiter.

Here’s some about Magfit, there’s even a scripted flight been developed to better aid compass calibration.

1 Like

Thanks for the answers, @xfacta here is the flight logs both in ALTHOLD and LOITER for analysis.
https://drive.google.com/drive/folders/1-vMJC92L54RbuC_k2XYOWDWNR1cxbuvN?usp=sharing

I cant see a log there where you set any of the parameters I suggested

@xfacta These logs are just some flights in order for you to get a better view as is, before changing the parameters.

You can safely set all the parameters I listed before doing another test flight. More flights without the new settings might fractionally give us better compass numbers than those already listed - but so would a flight with the new values, and we would be able to see if results are matching expectations.
There’s a few settings there that are to improve flight and aid further tuning too.

1 Like

@xfacta Hello, we did a test on the parameters you showed us and we had the same results, we just didn’t change the GPS_GNSS_MODE, do you think this would help with the lane switch issue?
Screenshot from 2023-07-17 13-42-56
Logs
https://drive.google.com/drive/folders/1ocsrw0Dn-HZ8RPEiBRGvTCI4_j2MejMQ?usp=sharing

You should change the GPS settings.
You can see on the map the two GNSS units are somewhat different in position
image
and in logs if you look at GPA.Delta they have an erratic update rate.
I would definitely use:

GPS_GNSS_MODE,5    //  or 65
GPS_GNSS_MODE2,5   //  or 65

but you will have to test which gives you the best HDOP. Use the same value for both GNSS units.

You didnt seem to put in any of the other recommendations I made, so there’s not much more I can say except try running Autotune and
PSC_ACCZ_I,0.4
PSC_ACCZ_P,0.2

As I said before all the params I specified are safe to use. Some are to gather more data and some are to make small improvements.
By the way, a flight in Auto mode doesnt help a lot, use AltHold and Loiter and fly manually.

1 Like

Hi @xfacta
Thanks for the prompt response

Sure, this week I’ll run additional tests considering all the recommendations.
I’ll provide more logs by Friday.

By the way, would you recommend different GPS_GNSS_MODE values for the case the drone is in Europe or Asia? (Not the case for the log we sent)

Leave that value the same for most regions.

1 Like

@xfacta Hello, did more tests with the drone, changing all the requested parameters, could you confirm that everything is correct? Thanks in advance.
https://drive.google.com/drive/folders/1Mq3XD_1r8XzfL1EBQdrnIJfLuKOCfHAZ?usp=sharing

@xfacta Hello, today on the same day we made several flights in AUTO mode and the drone showed numerous EKF messages, I changed the parameters that you recommended to what we used and even so we had several messages, in these logs that I am sending you there are several flights with several different configurations, and I will also send you some logs from another drone in the same configuration that does not give as many messages as this one, and in our research I also saw that there is a recent discussion about the EKF and I would like to know if this could be a bigger problem than I imagine.

EKF discussion link

Link to flight logs in auto
https://drive.google.com/drive/folders/1VnTsawbTDe6xEr9mB1YNLV_fmbPtQ9I8?usp=sharing

Link to other drone logs
https://drive.google.com/drive/folders/19PID-GLb7uzzL_IqALaKTWXz-S88ROlG?usp=sharing

Hi @xfacta ! I’m working with Gabriel in this project and I have some comments to share:




OBS: the last screenshot is from a flight with a drone from the same model but with a slightly different propeller, so the tuning could be a bit off.

Considerations:

  • I can see that the yaw_reset always match the XKF3 ErSc peaks and also the RErr variations.

  • Innovation in magnetic field strenght and velocity doesn’t seem to be related.

  • Innovation in position (Down Component) seems to be related.

Questions:

  • The vibration graphics show very low levels (under 8 m/s²), and indeed the cube and the whole electronics block are sitting on dampers. Could the cube be “too isolated” from the airframe?
  • Could (should) we safely raise the EK3_ERR_THRESH to 0.5 instead of 0.2?
  • Should we change EK3_GSF_RUN_MASK or EK3_GSF_USE_MASK?

I’m aware that some changes were done from 4.3.X on, but changing FW is always a sensitive topic for us, as it could raise questions from regulators. Anyway, we’ll start testing it with dev drones.

Thanks a lot!

I already replied to this over at Ardupilot a couple of days ago