In APM (ArduPlane/ ArduCopter) with/ without Mission Planner, we can observe that when the board is titled down, pitch angle changes from 0 (horizontal position), to 90 (vertically pointing downward), and tilting it further brings/decreases it back to 0 in the reverse position. 


See figure, you will understand my point. How do I distinguish any two same angle readings (which basically look alike but the board has different orientation). I am sure, other have faced this too. I need to do some processing with these angles, and important for me to know which angle (85 deg) orientation the board is really in, the processing get confused due to not handling this scenario.


Looking for a quick solution to tackle this. Thank you!

Views: 638


Replies are closed for this discussion.

Replies to This Discussion

the yaw is the answer

Hi Michael,

I am sorry, I didn't understand your answer. Could you elaborate it please. I want a solution for determining the orientation of the (duplicate) pitch and not the yaw.

Attached in the image, which describes the problem.


The left 85degree pitch and the right 85 degree pitch in your diagram will have yaw angles (compass bearings) which are 180 degrees different, it changes as you pass the zenith, that's what distinguishes them from each other.

Hi Martin,

Thanks for your answer. I am sorry, but I still need some more clarity. If I understand correctly, the two 85 degrees are different due to the readings of the compass sensor? Or is it the DCM yaw angle that you mean I should read? 

I was simply referring to the compass heading on the HUD.

I'm no maths expert but maybe you will find the DCM yaw angle in the outputs from the gyros.


I am facing another problem now. The 'yaw_sensor' reading when the board's pitch is 0 degrees is different from when the pitch angle is 45 degrees and deviates even more when the pitch angle tends towards 90 degrees. I am not moving the board left/right, just pitching it up and down. 

I thought the yaw reading must be with respect to earth's reference? Am I using the wrong values of 'yaw_sensor' output from AHRS or must I use DCM, yaw output values ???

Look forward to some help, thanks!

Hi Martin,

After I try your solution, it results in a gimbal lock where the YAW angle becomes crazy and swings in any direction as I approach pitch = 90 degrees. Can you tell me how to use DCM matrix alone to resolve this (both pitch problem and yaw gimbal lock).

Another point, Can I use the heading of compass alone for estimating YAW ??

Hi Shyam,

In case anyone on this thread is still interested, you and I figured out that you were running into a gimbal lock problem with Euler angles. There were a couple of possible solutions, including using direction cosines instead of Euler angles. However, you and I came up with a simple solution that allowed you to use Euler angles, which you posted here.

Best regards,

Bill Premerlani

Thanks Bill. As we got the solution to this problem, I will close this thread.

Best regards,



© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service