Quad altitude is drifting up and down but logged climb rate is constantly positive

Hi all! Has described on the title, I have a problem with my Quad altitude hold. In the begining of the flight the altitude hold control feels good and responsive but after a few minutes it feels laggy and a small descent input starts a descent of up to 2m and a small climb input starts a climb of the same magnitude. I let go off the sticks and the drone continues moving slowly up or down depending on the previous input and then stops after 2 or 3m.

In the search for the cause of this problem I found that the altitude in reality is drifting up and down but the logged climb rate is constantly positive.

The climb rate starts has expected but slowly seems to drift to positive values despite the drone not being climbing.

I dont know if this is the cause of the problem and also dont know the reason for this :frowning:

log: 10.94 MB file on MEGA

My suspicion is the rangefinder is configured wrong, it seems to be reading too low.
There’s two barometers that differ and it looks like Ardupilot is averaging their readings, since there is no GPS altitude for comparison and the rangefinder seems wrong.
You should check the rangefinder and disable (or shield?) the baro that is wrong.

Hi! I am sure the rangefinder is reading accurate because I was in fact hovering around 1 to 3m from the ground while testing.

I installed an external barometer (the second one) because the baro on the fc was suffering from turbulence. The external one is covered with foam and placed in the back of the quad which reduces this bad effect. I selected the external baro as primary so I thought that the EKF would not use the onboard baro readings :thinking:
If it does in fact use these readings, how can I disable an onboard FC barometer?

In the place I was testing there is not much gps coverage so I wonder if with good gps signal the altitude behaviour would improve or not.

Today I managed to disable the internal baro through modification of the code and building a new .hex file. I flew the drone again and the same happened.

Log: 7.52 MB file on MEGA

I have another drone with the exact same configuration and parameters and this behaviour does not happen. Can this be an hardware fault?