I fusion ACC and GYRO data with Mahony algorithm, and then I want to show a line chart representing roll pitch and yaw to the user, so they can understand the degrees. As you can imagine, gimbal lock comes in at 90 degrees.

I also have an activity where the user can see a cube rotating correctly, having quaternions as input.

Is there a way to visualize the angles in degrees without gimbal lock? I can only manage to show an OpenGL shape rotating correctly, but my goal is to show the degrees.


1 Answer 1


One way to visualize things would be to use an actual gimbal representation (topological circles that are hierarchically linked).

Refer to this Wikipedia depiction of how this might work.

Essential steps to implement a gimbal mechanism:

  • check which Euler angle convention you're actually using. There are several (proper and Tayt-Brian)
  • you must make sure that the outer-most gimbal circle affects all of its inner circular children, rotating them
  • the gimbal lock effect is a natural side-effect when at least two of these circles are coplanar
  • in the end, a gimbal is a composite robotic joint where all axes have the same physical origin, but different zero-pose orientation

Regarding the gimbal lock issue, simply convert the quaternions to your preferred Euler angle convention following the pointers presented here. As you may find, the issue stems from the fact that there are simply more ways of representing certain orientations using the gimbal mechanism that lies behind the Euler angle representation. This is a mathematical singularity and getting around it usually requires treating the case separately.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .