Abnormal lean that changes direction continuously

I have an extremely strange problem that has a constant which is that the drone flies very well on take off and for the first few seconds, roughly the first 20 seconds.
Then leans appear and change continuously during the flight, i.e. maybe after the first 20 seconds it tilts back, then left, then forward, then right.
In this graph I can clearly see, at first the 2 overlapping tracks and then they diverge in one way and also in its opposite.
this is the log with default parameter:

default params ek3.bin - Google Drive

In this log the copter starts to lean back, after on the left and on the end of the flight on the right.

this behavior is constant, every flight, it only works at the beginning, it would seem to be an EKF problem and having read some scattered indications I tried varying the parameter EK3_ABIAS_P_NSE from default 0.02 to half = 0.01 this is the log

I made a third flight reducing this value a lot to 1/20th of the default, with EK3_ABIAS_P_NSE 0,001

Have the accels been precisely calibrated? No movement at all when pressing the button?

Yes, several time. I Ve also tried another Imu, same issue. What Is driving me crazy Is that at take off and for the First 20 seconds It works, After what you can see in the above plots

Can you remove the log in requirement?

EKF is learning large accel biases

Thanks @andyp1per,

How it’s possible for the EKF to working perfectly for the first around 20 seconds?
Why EKF works perfectly for the first 20 - 25 seconds and then is learning large accel biases ?

What EKF parameters or other could I change to try to solve this problem?

Yesterday I was thinking of trying to give less weight to the accelerometer but now I am starting to think the opposite… is my interpretation correct that the accelerometer is correct and it is instead the EKF that for some reason does not weigh it enough and instead creates this incorrect lean?

I’ve only had a quick peek at the logs but a few things:

  1. the vehicle doesn’t have a GPS. It should be possible to fly fine without a GPS but I’m just pointing this out because most vehicles do have a GPS so it is more possible that we have a bug. The EK3_SRC1_xxx parameters are set so that the EKF will not consume any GPS data by GPS_TYPE = 2. It shouldn’t matter but you could set GPS_TYPE = 0.
  2. Arming checks are all disabled. This is generally not a good thing to do. Disabling one or two checks that you know are false positives is OK but disabling all is not good.
  3. The main loop rate has been increased to 800hz. I’d revert this to 400hz to see if that helps.
  4. GND_EFFECT_COMP is set to 0. This won’t be related to the problem but it’s rarely a good idea to do this. Best to revert this to the default of 1.
  5. EK3_ABIAS_P_NSE has been reduced from the default of 0.003 to 0.001 meaning the EKF has been told to trust the accelerometers more.
  6. LOG_BITMASK has been changed from the default 1767126 to 132305 so there’s less logging than normal I think.

Vibration levels are totally fine.

I wonder if it could be heat related.

Just as a reference, I have an old flight controller with failing IMUs so after some short time of flight the copter would start to lean over and yet the IMUs reported level flight, the effect getting worse and worse the longer you fly, it would quickly become impossible to control.
So not exactly the same problem, but something to consider.

1 Like

Yes, maybe it would be best for @Giorgio_Rinolfi to swap out the autopilot for another to see if the problem is resolved (it probably will be). I know there’s some extra cost involved in doing that of course but it might be the quickest way to a solution.

Thank you Randy for your suggestions,

  1. I’ve made fly tests with the F9P GPS and RTK base, but the same issue remain
  2. I know, I’m doing it on purpose for allowing me fast testing on this specific issue.
  3. I’ve tried, no change.
  4. It gave some issue in the past and I’d prefer to keep it disabled.
  5. I guess it’s a typo and you wanted to write 0,03, but furthermore Isn’t the default 0.02 ? It seems so to me for last official firmware.

Anyway from the above plot doesn’t seem the accel to be correct and instead the EKF not trusting it enough and becoming incorrect?
6. Thanks, I`m going to change as you suggested for next logs.

I guess its not heat dependent because in 20 second with strong air generated by the propellers doesnt make much sense.


what are the default values? even for the log bitmask parameter, the default value proposed by MP is different from 1767126 you propose

There is a parameter change you can try. The EK3_ACC_BIAS_LIM parameter sets not only the maximum allowable range of the accelerometer bias states, it also scales the initial uncertainty in those biases assumed by the EKF on startup. The default value is 1.0 m/s/s which is large (0.1g) I would try reducing it to 0.1 m/s/s. Also try getting me a replayable log if that doesn’t work (fly with LOG_REPLAY = 1 and LOG_DISARMED = 1)

1 Like