Problem with default PSC_POSZ_P leading to oscillation in AltHold

TLDR : Changing the value PSC_POSZ_P from 1.0 to 2.0 in Ardupilot fixed the altitude oscillations. There could be a problem with the default value.

I encountered some serious altitude oscilations. Those were long and wide (5-10 sec and 1m), you can find videos of before the fix here and after the fix here

Before the fix :

After the fix :

BEFORE doing this I followed the tuning instruction here (AltHold section) https://ardupilot.org/copter/docs/tuning-process-instructions.html and here https://ardupilot.org/copter/docs/altholdmode.html . Those two aren’t exactly the same for some reasons. And I do not have a lot thrust (hover at 68%) but the problems is not there because I fixed it.

Changing PSC_POSZ_P from 1.0 to 2.0 in Ardupilot fixed it for some reasons. NGL, this setting is wierd because it does not apear in the control loop of the documentation, Ardupilot advises to half it if there are oscilations but it was already at the minimum value (??? wrong default value I guess). Plus the oscilations seems to come from a weak P value that undercorrects, not an overshoot. So I multiplied it by 2 instead of 0.5 and it worked perfectly.

It realy seems like this value is wrong by default because the doc (almost) does not talk about it (only in one of two links I sent), from the doc it seems like it’s not influenced by the thrust or weight and the doc only advises to reduce it but it’s already at the minimum.

Will the altitude be stable if I change “PSC_POSZ_P” from “1.0 to 2.0”?

It worked for me. (but please check my next comment)

Update : This problem may have come from somewhere else and the trick explained here somehow worked. I’m not sure.

I discovered a problem on my EKF later on that led to the oscillations coming back. I solved it here. So please bear in mind that the advice/fix I gave in this thread were done with a malfunctioning EKF that could have been the real root of the issue.

Thank you.
Isn’t your altitude stable during flight?

Yes my altitude was stable before my update message and after (i.e. now), with PSC_POSZ_P=2.