### Error quaternion vs. Difference quaternion

greenspun.com : LUSENET : quaternions : One Thread

What's the physical difference between the quaternion error and the algebraic difference of two quaternions? Specifically, I've been working with applying quaternions to satellite rotational maneuvers. To express the error between the actual orientation of the spacecraft and the desired orientation, the equation, qE=inverse(qA)*qD is used where E, A, and D represent Error, Actual, and Desired respectively. In matrix form, the equation is, A(qE)=A(qD)*A(inverse(qA)) where A() is the 3x3 matrix contstructed from the quaternion. The desired and actual coordinate systems are collinear when the off-diagonal terms of A(qE) are zero implying that the two systems are collinear. For example, the two systems (xA, yA, zA) and (xD, yD, zD) are collinear when xA(dot)zD=0 and yA(dot)zD=0 (where (dot) symbolizes the dot product). The error quaternion, qE, when the two coordinate system are equal is; qE=[1 0 0 0]. Thus, qE represents the required rotation to go from the desired to the actual coordinate system. When the two systems are collinear, the error quaternion represents a rotation of zero degrees.

Now I turn to the difference operator. The difference between two quaternions is not the same as the error (or is it?). Thus, qE=qD-qA is not the same as qE=inverse(qA)*qD. Since quaternions represent rotations, the difference operator equation represents a rotation of 90 degrees when the actual = desired. Therefore, are the two coordinate systems actually collinear using this method? What is the relationship going on inside the difference operator? How can the result be interpreted?

Thank you for your time, -Doug Flanders

-- Doug Flanders (def@cisunix.unh.edu), June 14, 2002

Hello Doug:

The problem of using quaternions to handle rotations of satellites has been solved by NASA. I know they used quaternions on the pathfinder mission specifically, and probably all the others. I suggest writing them because they are publicly funded, and may even provide libraries of relevant code.

I have not focsued my studies on rotations, the one current application of quaternions. Your statement of the operations though does not make sense to me. Quaternions have four degrees of freedom. They can be written as 4x4 matrices. I will use my ASCII capitalization convention to write a quaternion, meaning a scalar is written in lower case, and a 3-vector is in upper case, like so q = (a, B). A rotation by an angle theta is:

p' = u p u^-1 (cos theta/2, U sin theta/2) (0, P) (cos theta/2, U sin theta/2)^-1

The rotation quaternion u is unitary, so u.u = (1,0). One must make sure that u is infact unitary before it gets used in a calculation. All the details on how to go about this are not known to me, but certainly are known to the pathfinder folks.

I have always read that rotations are accomplished using the multiplication by unitary matrices. I have heard that the unitary matrices are "re-orthogonalized" to minimize accumulated computational error. The paper which I am looking at is located here:

http://linux.rice.edu/~rahul/hbaker/home.html

Application of Quaternions to Computation with Rotations" by Eugene Salamin, unpublished Working Paper, Stanford AI Lab., 1979.

Good luck in your work, doug

-- Douglas Sweetser (sweetser@theworld.com), June 16, 2002.

Doug mentions the existence of NASA code using quaternions for space avionics. Yes, this code exists but has probably never been put on the WWW. NASA has sold it through the National Technology Transfer Center in Wheeling WV, though it my no longer be available. The document is JPL D-3729. The author is Allan R. Klumpp. It is a quaternionic linear algebra package translated into Ada83 from HAL/S.

-- Matthew McCann PE (mmccann@franciscan.edu), March 06, 2004.

Hello Matthew:

I know there is plenty of code for playing with quaternions on the web, particularly for doing 3D rotations. I have written a quaternion calculator that is very out of date, and a bit of software that can make animations (the interface is very rough). I've seen packages in Java, Perl and Python but do not have URLs.

doug

-- Douglas Sweetser (sweetser@alum.mit.edu), March 07, 2004.

Hi, Doug,

There are many small codes on the Web for quaternions. But the Ada83 code rewritten by Klumpp is no small toy. It is big and very serious i.e. mission-critical. Attitude control of the Space Shuttle, and the lives of its crew, depend on the near-perfection of this quaternionic linear algebra package. It is essential to the International Space Station too.

Best regards,

Matthew

-- Matthew McCann PE (mmccann@franciscan.edu), March 07, 2004.

Hello Matthew:

I vaguely remember emailing to a fellow a few years ago about quaternion programming and the Mars Rover. What they were very concerned about was error correction. The matrices to do rotations must always be unitary, and there are subroutines to check for rounding errors that can creep in.

Let's hope NASA gets the open source bug (no, I will not put money on that).

doug

-- Douglas Sweetser (sweetser@alum.mit.edu), March 07, 2004.

Hi, Doug,

If NASA hasn't released the code as open-source by now, it probably never will. I visited the National Technology Transfer Center personally a couple of years ago and requested to purchase the code. The folks there told me it was out-of-stock.

Matthew

-- Matthew McCann PE (mmccann@franciscan.edu), March 07, 2004.

Hello Matthew:

How about the code that was used in the Mars Rover? I am sure they did not reinvent the wheel. As we know, the performance and calculations for that craft worked great. They did four firings, and gave themselves a place for a fifth, but it was not needed.

doug

-- Douglas Sweetser (sweetser@world.std.com), March 07, 2004.

Hello, Doug,

I think it would be safe to say the code used on the Mars Rover was essentially the same as what was used on the Space Shuttle and International Space Station. Mission-critical software is most dependable when it is tried and proven legacy code. If it ain't broke, don't fix it. But it may have been updated with Ada95.

Matthew

-- Matthew McCann PE (mmccann@franciscan.edu), March 08, 2004.

FYI, part of the problem with the different space programs, is that they do not all use the same convention. Example, the space shuttle uses a Left-Handed convention for its quaternions, whereas, ISS uses a right handed convention. So, some of the quat to angle computations will be slightly different. Also, the different subsystems on a vehicle may even have different rotation sequences. Example, space shuttle attitude maneuvers are done using Pitch-Yaw- Roll while GPS attitude aiding data is done using a Yaw-Pitch-Roll sequence.

-- cenla (elachney@earthlink.net), April 05, 2004.

Quaternions for spacecraft attitude description and maneuver is a well practiced art and, once the basics are understood, is straight forward and, compared to the alternatives of Euler angles and direction cosine matrices, etc., are very simple. I am a spacecraft attitude control engineer with the Boeing Company. If you are a student or independent researcher, I would be glad to provide whatever expertise I can; if you are an employee or agent of one of Boeing's competitors, I can only wish you good luck. Let me hear from you. You can email me at noel.h.hughes@boeing.com or at my home, nhughes1@qwest.net

Noel Hughes

-- noel h hughes (noel.h.hughes@boeing.com), September 08, 2004.

Moderation questions? read the FAQ