arduino-libraries / MadgwickAHRS

Arduino implementation of the MadgwickAHRS algorithm
465 stars 196 forks source link

Madgwick::computeAngles incorrect. #19

Closed baghelp closed 6 years ago

baghelp commented 6 years ago

The yaw pitch and roll values returned by computeAngles is incorrect. for example, using q = [0.5000 0 0.7071 -0.5000], the compute angles would return yaw: -90, pitch: 45, roll: -90 when the correct values are yaw: 90, pitch: 45, roll: -90. This problem only arises in certain quadrants. It is a little hard to visualize these rotations, but I trust the implementation here: https://quaternions.online/ it is my go-to comparison for testing. A correct implementation can be found on the wikipedia page for this conversion (https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles)

baghelp commented 6 years ago

Sorry, I was wrong. I was just making a some dumb mistakes.