Quadrotor flight dynamics dictate that x and y acceleration in
the body coordinate system (imu) are always zero. Non-zero values are
only produced by sensor noise, external wind force, IMU not in the center of gravity etc. Additionally, IMU measurements can directly be used for attitude estimation only when the system is not accelerating (in hover or constant speed condition). If we ignore the extreme cases this condition can only be achieved when phi and theta are 0.
Based on this I can not see the value of direct attitude estimation based only on the accelerometer data.
I would really appreciate if somebody can explain the purpose of this part of the code or show me if I have missed something.