# Quaternions

Hi all,
If I have a desired attitude quaternion: q0_d = 0.707 q1_d = 0 q2_d = .707 q3_d = 0
where q0_d is the cos(theta/2) term. And then, if I compute the error
quaternion:
[q_e (4x1)] = [q_d (4x4)] X [q (4x1)]
where q is the current attitude quaternion, then how would I get the angular error with respect to each axis. That is, is there a way I can convert my error quaternion values (from above) back to Euler angles WHILE still avoiding the Euler singularities (i.e. gimbal lock)?
β
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
snipped-for-privacy@drexel.edu wrote:

Here's a web site that provides a lot of useful information about converting between the various rotation orientation representations: <http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm
My limited understanding of the math is that you may not be able to avoid the Euler singularities.
-Wayne
β
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>

As you know, Eulers have an order, like XYZ, YXZ, ZYZ, etc. . Simply convert your Quaternion into XYZ, throw away the Y and Z, then convert into YXZ, throw away the X and Z, finally convert into ZXY, and throw away the X and Y. You will get the error in the X, Y, and Z from the three previous operations. Of course, you can not get the original rotation beck from these... .
β
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Oh yeah, I forgot to mention my reasoning for converting to Euler angles is this - I am using this on an airplane for which I am controlling rotation about the z-axis with the rudder, rotation about the y-axis with the elevator and rotation about the x-axis with ailerons. If I use Euler angles, I can have an error which relates to each one of the control surfaces (i.e. if my yaw error is large, then I know I have to give full rudder deflection). However, if my quaternion error is large...it's not quite clear to me how I would translate that into rudder, elevator, and aileron deflection. Does anyone know of a way?
Thanks
β
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
snipped-for-privacy@drexel.edu wrote:

Well, isn't this relevant for small errors only ?
If you have a 180° yaw error, are you going to turn with the rudder only ?
If you have a 160° yaw error and also 45° roll, will you first make the plane horizontal and then turn 160° with the rudder, or will you use the existing roll to turn 200° with the elevator ?
AC
β
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
I am trying to pull off autonomous hovering with a fixed-wing aircraft in the "nose-up" position (pitch, yaw=0). Therefore, if I have errors of more than, say 30 degrees, it will not be able to maintain this attitude. So...yes, I am only hoping to have small errors :-)
β
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>

## Site Timeline

• ### To calculate the turn angle of robot using interrupts.

• - next thread in General Robotics Forum
• ### Servo drive signals for HP 7978 tape drive controller

• - last updated thread in General Robotics Forum

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.