Altitude estimate problem -> almost crash

Today I made some test flight and the last one almost end on a crash.
I’ve switched to firmware 4.1.5 and connect RTK again and use barometer as primary altitude source. But with EK3_ALT_M_NSE = 4m instead of the default (2m)
The first flight was a good one, I’ve make some GUIDED test and land without an issue. (2022-05-11 13-47-35.bin)
I change the battery and take of for another experiment (2022-05-11 13-58-39.bin) this time the copter begin to “jump” again in the air. I land it and change EK3_SRC1_POSZ from 1 (baro) to 3 (GPS). I leave EK3_SRC2_POSZ = 1
After that I reboot the pixhawk and take off again. I’ve notice some minor jumps so I decide to go to GUIDED mode and made a second test. I have battery failsafe very conservative so in the middle of the test failsafe was triguered. The copter start to descend to land and I’ve tried to correct the place for landing. But at 4 or 5 mts from the ground the copter stop responding to my commands. I’ve switched to stabilized mode and reduce de throtle but the copter doesn’t descend, It makes some oscillations without loosing altitud, I’ve commanded 0 throttle and nothing. Then the copter start to climb at a very high speed to a very high altitude. I’ve manage to get the copter to the ground almost without damage.
Now, I’m looking at the flight log in order to understand what append. I’ve notice a radio failsafe, but my main concern is the CTUN.Alt, because I can’t explain why it estimate -50mts altitude for some time and I think it was the source of the problems.

The GPS and Baro report good altitude measurements and AHRS estimate good altitude too.

Can someone help me with this?


Why increase EK3_ALT_M_NSE ?

This is the RMS value of noise in the altitude measurement. Increasing it reduces the weighting of the baro measurement and will make the filter respond more slowly to baro measurement errors, but will make it more sensitive to GPS and accelerometer errors.

Increasing the above parameter made height estimation more sensitive to accel noise i.e. vibrations which average around 20m/s/s,and could be throwing off the estimated altitude

You can see in Normalised Innovations Plot

Clearly, Height Estimation is being rejected the most
and Position estimation innovations are quite high as well.
Afaik Innovation Values above 1 are rejected by EKF.

While the Altitude data from GPS and Baro are matching within acceptable differences

And your copter doesn’t seem to be tuned properly in accordance with the tuning guide. Might wanna head there and start from the basics

I increase EK3_ALT_M_NSE to make GPS altitude more confidence than barometer. I have RTK GPS, so I trust more on GPS than Barometer.
Position estimation innovations where rejected on the last part of the flight, in that moment I was fighting with the copter and wind trying to land safely.
But it is clear that there was some problem with height estimation. I’m not sure that vibration on the Z axis was the problem. In fact you’ve notice high variance on altitude estimation during the complete flight but the altitude estimated by the EKF drops to -70mts one time. I don’t know where the problem is but I have some doubt about vibration.

Please, take a look at this two flight. The first one was a perfect one, but vibe Z is as high as the second one:

and as you can see XKF4.SH have good values. I’ve notice some error and events on this flash log, I’m not sure what they mean.

After that flight I change the battery, take off and notice some “jumps” of the copter in altitude hold. I thought that it was a problem with barometer and wind condition, so I land, change the EK3_SRC_PZ to GPS and take off again. This third flight was the one with the altitude estimation problem.

The three data flash logs are on drive folder attached to the first post.
I really thank the time you spend to help me. I hope you can see the other logs and help me.

I will spend some time to make a better tune of the copter before continue with my work.