I have been working on an optical flow\lidar based position controller to fly a small quadcopter indoors, which raised some questions regarding attitude and altitude estimation in Arducopter which I haven’t been able to resolve. I would greatly appreciate any explanation of the following observations, or even better - solution as to how to get the best attitude estimate.
The quadcopter is holding its position within a 25cm radius circle, yet the pitch and roll reported in the Attitude mavlink message settle at around 10 degrees. Obviously at such values the quad should accelerate and not hold its position. I looked at the logs, comparing the Attitude estimated by EKF2, EKF3 and AHRS2 as well as at the accelerometer measurements. The best agreement with the accelerometer was obtained from AHRS2 – with the quad holding its position, the pitch and roll are close to zero, whereas the EKF2 and EKF3 drift away from zero and settle at rather large angles.
I have attached the log file for a flight which used EKF3 for navigation. In this flight it was mainly the roll angle that exhibited the behavior I described (See image). All of the filters seemed to agree on the pitch.
I uploaded the log file here:
I observed that the altitude estimate of both EKF2 and EKF3 deviate from the lidar measurements. The altitude estimated is between 25%-50% less that the lidar measurement. Looking at the accelerometer measurement, Az seems to be rather small (9.6m/s^2), so this might explain it.