I am working with the CJMCU build of cleanflight on a small drone. As of now, the algorithm for altitude hold uses a first order complementary filter to combine data from the barometer and the accelerometer (after integrating the accelerations twice). However, I have noticed a considerable lag in the altitude readings and this seems to be hampering the control algorithm's performance.
The filter in question has been implemented in https://github.com/diydrones/ardupilot/blob/db8a2f7e8bb2183e6d281e7a348d455d855cf5e1/libraries/AP_TECS/AP_TECS.cpp However, I'm unable to understand how this works.
Pardon me for any errors I may have committed.