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)?

Thanks in advance!

Reply to
weg22
Loading thread data ...

Here's a web site that provides a lot of useful information about converting between the various rotation orientation representations:

My limited understanding of the math is that you may not be able to avoid the Euler singularities.

-Wayne

Reply to
Wayne C. Gramlich

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... .

Reply to
Matthias Melcher

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

Reply to
weg22

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

Reply to
A. Caspis

I am trying to pull off autonomous hovering with a fixed-wing aircraft in the "nose-up" position (pitch=90, 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 :-)

Reply to
weg22

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.