EKF3 - Uncommanded periodic high throttle out in PosHold

I had another look at the logs. It seems to be related to the Baro and that (just a guess) EKF tries to compensate something:

Hi Thorsten

I use the bulb and earplug method. works for me. however it does seem that vibrations is not the issue here.
It almost looks like you are using the barometer indoors. Might be wrong again!

from an very aggressive 3 minute flight. I can unfortunately not find a better one to show.
Hope you find the solution to your problem. I myself had a bad crash a few weeks ago because I had my props the wrong way around . crashed due to uncontrollable yaw…

These are really low vibes! Looks like a rigid frame!

GPS and Baro alt seem to be consistent. But CTUN.Alt and DAlt are off:

I increased EK3_ALT_M_NSE to 4. But this should be ok I guess.

XKF4.SH increases after about 3min 40 sec, while XKF9.SH remains stable (similar to IPD).
So it seems the first EKF core had problems. What could be the source?

I switched back to EKF2 and made some more test flights including a longer mission of 36min without any incident. Ayyway, I am still very interested to learn where these jumps came from.

It may be offtopic, but why is DAlt changing in an auto mission?

I had a look a few days back and could not see what is causing the desired climb rate to spike like that.

Also, we do some long multirotor flights and have observed the desired altitude changing for seemingly no reason. I have not figured it out. Terrain features are off, you can check that on your side too. I have no idea how, but it looks as if we are seeing a long term pressure trend correction.

@jfield thanks for having a look!
It didn’t happen again. But there must be reason for the spikes…

There is a drift in air pressure over time and thus the estimated height when using a baro. During longer flights the baro and GPS based heights can easily diverge > 10m.
There was a PR recently which adressed this problem with some internal height correction. Maybe this is what I am seeing in the log. But I thought it was off by default. Even not sure if it is in AC3.5.2 at all. I’ll check.

Your RC.IN_3 is about 1650 here, so it is a climb command.
And the FC does his job - it climbs and Alt does match desired Alt pretty well.
But FC does that in a strange way… It climbs like in a PWM manner.

May be it is related to a PID values?

Thanks Sergey!

Yes, it really does it in a strange way! All other things can be explained I guess.

Baro and GPS alt:
they differ but follow throttle. So they are not the cause.

RCIN.C3:
At 83.5 - 86.5 (line number 10^3) I brought the copter to an agl of about 2.2m, because I wanted to touch the legs.
At 92.5 I started responding to the jumps.
At 95, 97 and 102.5 I tried to reduced throttle/altitude in direct response to the jumps.
You are right that RCIN.C3 is at 1650. But maybe this is due to the deadband in PosHold.
Interestingly the GPS.Alt is closer to what I saw. However, my initial altitude adjustment is not visible in the GPS.Alt graph (but it was only about 30cm or so).

IMU.AccZ:
The first spike, which can clearly be seen in IMU.AccZ is at 85. Previous spikes maybe at 84.6 and/or at 84.3. Hence, it started already while I was adjusting altitude to the 2.2m agl. So, there might be a relation to the process of adjusting altitude.

The copter flies fine with the PIDs so I doubt that it is a PID issue. What is different to my other copters regarding ArduPilot is fast IMU sampling (PixRacer), OneShot and EKF3.

Any suggestions for further tests?

Agree, raw Baro and GPS altitude does not match well the altitude estimated by FC. But that I believe it is because of acceleration spikes that are affected on EKF estimation.

It’s not very clear for me why issue was gone after you enabled EKF2. Because as per my understanding EKF is just a attitude estimator and should not affect on throttle behavior.

Did you tried to fly with EKF3 again after that?

I am not sure if it is really an EKF3 problem. I was in the air for several hours with EKF3 without any problems. To revert back to EKF2 was just a precaution. This strange behavior only occurred once - at least when I realized it. But it was definitely scary and I really like to know the reason.
I’ll make some tests with EKF3 again this week.

By the way what is your props? I also saw a strange vibration in the beginning of your log. I had something similar when used a poor quality flexible 10’’ props. They generally did fly well but on some exact RPM there was a hard bumpiness and vibrations.

These are T-Motor 9.5’’ props. Vibration should be ok. I made some tests in the beginning of the flight to check responsiveness. So the vibes are due to my pitch and roll commands:

Hi Thorsten,

This looks like an EKF 3 problem to me. I can see the throttle spike is caused by an attitude error progressing through the control loops, not a acceleration progressing up. So I suspect the EKF 3 has an issue with the altitude prediction. This is further supported by the divergence from both the GPS height and Baro height.

The innovations are also going crazy (XKF3.IPD). I would need to forward this onto someone else to look at though as I am getting out of my depth.

After a preliminary analysis I have spotted a few anomalies:

  1. During up and away flight, thrust variation is causing ±2 m of baro variation. This effect needs to be reduced because it creates a feedback loop resulting in low frequency throttle surging.

  1. The landing ground effect compensation is activated externally to the EKF in mid-flight and baro fusion is blocked temporarily (innovations flat-line) which should not happen.

  1. After the landing ground effect flag clears and baro fusion resumes, the IMU1 EKF height solution moves away from the Baro, but the innovation test ratio does not increase by much indicating that the height state variance is rapidly increasing. This indicates that the covariance matrix has become badly conditioned as a result of stoppage of baro fusion.

To investigate this further I need to know which version of SW was being flown. EKF3 is still in the developmental stage, so unless you are experimenting with range beacons, visual odometry or required some specific feature that EKF3 provides, I would recommend you switch to EKF2.

Thanks @Leonardthall and @priseborough for having a look!

The Firmware Version was V3.5.0 (633501f9).

Yes, I switched back to EKF2 and since then all is fine. But, I am always happy to test new stuff… Hope it helps in some way.
I’ll try different foam. Thanks!

Hello
I have the same problem ,i noticed that when the quad is moving in fast forward or sideways the altitude randomly increases with some jerks and when stopped it tried to level

Also i have tried hovering in high winds and the altitude aggressively increases with jerks from roll and pitch axix ,and in low wind condition its calm n only behaves aggresively when moves

After this issue i moved from 4.0.1 to 4.0.2 and the flights were stable in both the conditions but after 4 day same issue.

Help
Will post the log files