It’s bothered me for a long time that the two sources of angles fed into the complementary filter do not have the same meaning. Since adding the rotation matrix code this has been increasingly evident. Finally with the graphs from yesterday, and the consistent forward drift, understanding this has become a top priority.
The nub of the problem is the difference in the context of the angles:
Euler angles are cumulative: they represent the rotation of gravity between the inertial reference frame (earth axes aligned with north, west and up) and the quadcopter X, Y, and Z axes respectively. To perform the rotation each angle is applied in sequence.
Integrated Gyro angles are independent – they are all in the quad frame, and represent rotation rate around each of the quads axes all within the quad reference frame. Gravity doesn’t enter the equation.
So currently the complementary filters is trying to merge two different types of angles and can only produce garbage as a result.
I may to convert gyro angles into Euler angles, and for a change I found a site which explained these well, and in clear language and equations that don’t obfuscate the facts behind fancy symbols.
There’s a few other links from that page that explain other parts of the quad code really clearly too. Well worth reading.
Or I may need to use Kalman to smooth out the Euler angles, and dispose of the complementary filter altogether.
Or there may be a plan C that I’ve not had time to think of yet.
But I’m stuck on a bus for 2 hours tomorrow, so I’ll have plenty of time to muse and snooze!