1 47th AIAA Aerospace Sciences Meeting Including The New Horizons Forum and Aerospace Exposition 5-8 January 2009, Orlando, Florida AIAA Origins of the Unusual Space Shuttle Quaternion Definition Douglas J. Yazell 1 Honeywell, Houston, Texas, This paper is offered to the history session of this conference. It relates to a mathematical convention which is fundamental to guidance, navigation and control, and is used by many other systems of a single spacecraft. The space shuttle program successfully pioneered the extensive use of quaternions for spacecraft. This program has a strong influence on conventions used by later space programs, but the American part of the International Space Station (ISS) uses a different convention, and most spacecraft now use a convention that agrees with ISS and not the space shuttle. This ISS convention has no negative sign in its quaternion definition, and the space shuttle quaternion has one negative sign, negating its vector part. The ISS convention does a better job of simplifying the mathematics. The benefit of re-use of space shuttle experience and products is offset by the fact that publicly available documentation of quaternion mathematics does not follow the space shuttle convention. Nomenclature δ = quaternion rotation angle u = quaternion rotation unit vector, with only two properties, magnitude and direction u1, u2, u3 = vector components of u q = quaternion S = scalar part of quaternion q V = vector part of quaternion q q -1 = quaternion inverse i = reference to the imaginary part of a complex number a + i b i, j, k = reference to the hyperimaginary part of a hypercomplex number a + (i b + j c + k d) A I. Introduction N Euler sequence of rotations, such as the familiar airplane yaw, pitch, then roll sequence, with all angles positive for a climbing, right-hand turn, is often replaced by a single rotation about a unit quaternion s rotation axis for spacecraft. Both space shuttle and the American part of the International Space Station (ISS) contain quaternion_inertial_to_body in their software and telemetry *. The names are spelled differently, but they are both inertial to body, not body to inertial. They are used in the same equation to solve for body coordinates when inertial coordinates are known. This same equation describes the orientation of the vehicle with respect to the inertial coordinate system. If body coordinates are known, the equation can easily be rearranged to solve for inertial coordinates, without changing any description of the coordinate system motion or the vehicle motion. Any quaternion can be divided into a scalar part and a 3-element vector part. In our work, the inverse is formed by negating its vector part. This quaternion transformation equation operates on a quaternion containing inertial coordinates, premultiplying by one quaternion and postmultiplying by a second quaternion. These quaternions, the pre- and postmultiplying quaternions, are the inverse of each other. The space shuttle quaternion negates its vector part and is used in the premultiply position. It then has two negative signs which cancel each other when it forms 1 Principal Systems Engineer, Defense & Space, 2525 Bay Area Blvd, Suite 200, AIAA Associate Fellow. * Refs. 1 and 2 for space shuttle solve for B coordinates from A coordinates, and a figure in each reference shows that B is the moving coordinate system and is moving away from coincidence with a fixed coordinate system. Ref. 3 for space station also solves for B coordinates from A coordinates. It does not show a sketch, but specifies that names such as inertial to body are helpful (as opposed to body to inertial, which it does not mention). 1 Copyright 2009 by Douglas J. Yazell. Published by the, Inc., with permission.
2 that quaternion inverse. The ISS quaternion has no negative signs in its definition and is used in the postmultiply position, so the same result for body coordinates is obtained by both spacecraft programs. One drawback to the space shuttle convention is the fact that, outside of that program, most documentation of quaternion mathematics does not have a negative sign in a quaternion definition until the quaternion inverse is formed. II. Quaternion Conventions A minimum number of equations are presented to familiarize an aerospace history audience with the vocabulary. It is helpful to start with an influential convention, the one used in robotics. Robotics has a fundamental coordinate transformation ( Moving to Fixed ) that obtains coordinates in a Fixed (Inertial) coordinate system from coordinates known in a Moving (Body) coordinate system: v Inertial Body = qv q 1 (1) where the quaternion has a scalar part (S) and a vector part (V): S = V and the quaternion inverse is formed by negating the vector part. q (2) S = V q 1 (3) This uses a pre-multiply convention, pre-multiplying by the quaternion and post-multiplying by the quaternion inverse. This quaternion is defined by a scalar part S and a vector part V which has three scalar parts. Both a quaternion and its inverse are quaternions. Our quaternion s inverse is formed by negating its vector part. The rules of quaternion multiplication 4 will not be presented here, but note, for example, that for a position vector whose coordinates are being transformed, a zero scalar part is assigned, and the position vector coordinates then become the vector part of that quaternion. This results in quaternions such as v Body and v Inertial in Eq. (1). To define the above terms S and V, = cos δ 2 S (4) V u δ = sin u 2 u (5) We use unit quaternions here, which have a norm of one, so that the square root of the sum of the squares of those four scalar elements is one. Three rotations such as yaw, pitch, and roll can be replaced by a single equivalent rotation about a single rotation unit vector u. The three coordinates of this vector are in Eq. (5), and they are the same in the two coordinate systems. All conventions (including space shuttle, ISS, and robotics) presented in this paper adhere to these four conventions for coordinate transformations and definition of the vehicle s orientation: (I) When the rotation angle is zero, the two coordinate systems have the same orientation. (II) The Body coordinate system rotates away from coincidence with the Inertial coordinate system, not into coincidence. (III) The rotation is right-handed. (IV) The coordinate systems are right-handed (and orthogonal) 2
3 With a complete description of coordinate system rotation, the description of the vehicle s orientation is obvious. Equations of the type in Eq. (1) can also be interpreted as vector rotation in a single coordinate system, but that interpretation is avoided in this paper. This paper will not present the familiar matrix equations for sequences of Euler rotations, but a few notes about them will be made in order to compare the order of stacking for matrices and quaternions when the equations describe successive rotations. The classic airplane Euler sequence is a familiar example, the yaw, pitch, and then roll angles, rotating from, for example, a North-East-Down coordinate system, so that the first angle is the heading, the second angle measures how far up or down the nose moves, and the third angle measures a roll angle about a line down the long axis of the airplane, with all angles positive for a climbing, right-hand turn. The robotics matrix equation for this motion of the end effector or link orientation stacks from left to right: the 3x3 yaw rotation matrix, then the pitch rotation matrix, then the roll rotation matrix, premultiplying a 3 x 1 column matrix of Body (Moving) coordinates to obtain the Inertial (Fixed) coordinates. The corresponding quaternions in the premultiply position in a modified Eq. (1) stack left to right: the yaw quaternion, the pitch quaternion, and then the roll quaternion. The corresponding inverses would then appear in the postmultiply position from right to left, but stacking refers to the multiplication order of these quaternions for successive rotations, not the order of these quaternion inverses. Both sides of Eq. (1) can be pre-multiplied by the quaternion inverse and post-multiplied by the quaternion q to obtain Eq. (6). This is the equation used by the American ISS software 3, and the ISS quaternion Inertial to Body is in the post-multiply position. v Inertial = q v q (6) Body 1 These mathematical operations used to obtain Eq. (6) do not change the description of the motion of the coordinate system or the vehicle orientation. For both Eq. (1), used in robotics, and Eq. (6), used in aerospace, conventions I, II, III, and IV apply. Also, for both Eqs. (1) and (6), Eqs. (2) through (5) apply. The matrix version of Eq. (6) for the classic airplane Euler sequence, yaw, pitch, and then roll, is familiar to aerospace engineers. The matrix order is right to left: the yaw matrix, then the pitch matrix, and then the roll matrix, and they premultiply the 3 x 1 column matrix of Inertial (Fixed) coordinates to obtain the Body (Moving) coordinates. This describes the vehicle orientation with respect to the Inertial coordinate system, but the robotics version of that equation, which is described in an earlier paragraph, describes the same orientation with the reverse order of matrices. Just as Eq. (6) is obtained easily from Eq. (1), the robotics matrix equation is obtained easily from the aerospace matrix equation, noting that the inverse of these rotation matrices are the transposes. This results in the robotics rotation matrix being the transpose of the aerospace rotation matrix for all rotations: in this case, yaw, pitch, and roll. Successive rotations in Eq. (6) stack from left to right in the postmultiply position. Multiplication order ( stacking ) for successive rotations Matrices which can premultiply 3x1 column matrices Quaternions (q) ( = q -1 ) Quaternion premultiply or postmultiply Coordinate transformation equation Robotics Left to Right Left to Right Premultiply Moving to Fixed (Body to Inertial) Shuttle (STS) Right to Left Right to Left Premultiply Inertial to Body ISS and most of aerospace Right to Left Left to Right Postmultiply Inertial to Body Table 1 A summary of operations for successive rotations The robotics paradigm solves for Fixed (Inertial) coordinates and the aerospace paradigm solves for Moving (Body) coordinates. Space shuttle orbital flights began in 1981 and ISS on-orbit operations began in Ref. 2 (1975), which is cited in Ref. 1 (1982), states very early in the paper that the (Fixed to Moving, which we can call Inertial to Body ) space shuttle quaternion coordinate transformation equation is written this way: v (7) Body Inertial 1 = qsts v qsts 3
4 For the space shuttle, that places quaternion Inertial to Body in the pre-multiply position. Ref. 2 (1975), then proceeds at length to show that given Eq. (7) and the definitions in Eqs. (4) and (5), we conclude This can be seen by comparing Eq. (7) to Eq. (6). 1 = q (8) As Ref. 4 (2003) points out, Ref. 2 (1975) can use Eqs. (7) and (8), but could also have written the following equation in place of Eq. (7): v Body 1 Inertial = qsts v qsts (9) That would have led Ref. 2 (1975) to conclude, in place of Eq. (8): = q (10) This can be seen by comparing Eq. (9) to Eq. (6). Ref. 4 (2003) points out that the post-multiply convention used Eqs. (6) and (9) is more common in aerospace than the pre-multiply convention of Eq. (7). The author of Ref. 2 (1975) does not demonstrate any awareness of the option presented in Eqs. (9) and (10). Ref. 2 (1975) thus ends with these two space shuttle definitions in place of Eqs. (4) and (5), using Eq. (8) in Eqs. (2) and (3): S = V (11) 1 = S ( V ) (12) Although the two negative signs cancel out in Eq. (12), it is an awkward way to define the inverse of the fundamental quaternion for the given application. A general rule seems to have been adopted by later aerospace programs, including the American part of ISS: Define the application s fundamental quaternion with no negative signs. Since we always simultaneously premultiply by a quaternion rotational operator and postmultiply by its inverse, it is always easy to implement this rule. III. Program History Despite the repeated space shuttle interaction with ISS, they carry these different definitions for this fundamental subject. Astronauts are trained to read quaternions in a readout of four numbers using ISS onboard computers. With practice, it s as easy as reading a display of three Euler angles. It is rather complex to then explain that the space shuttle program defines its quaternion in a different way. Quite a few space shuttle engineers were familiar only with that quaternion convention in recent years. When they moved on to other aerospace programs, it was sometimes a painful surprise to find that most other aerospace programs use a quaternion convention that is the same as the American ISS quaternion convention. IV. Mathematics History While writing this paper, a two-dimensional (2D) example was considered, since cos(δ) +/- i sin(δ) is a rotational operator in the complex plane. For example, any complex number a + ib can be viewed as a vector in a plane with a horizontal real axis and a vertical imaginary axis. For our example, we are using vector coordinate transformation, not vector rotation, so let s examine a1 + i a2, corresponding to Inertial vector coordinates transposed as [a1 a2] in 2D and [a1 a2 0] in 3D. When solving for Body (Moving) coordinates from Inertial (Fixed) 4
5 coordinates, using conventions (I), (II), (III), and (IV), cos(δ) i sin(δ) obtains the correct answer for Body coordinates, which is a1 cos(δ) + a2 sin(δ) for its first coordinate and a1 sin(δ) + a2 cos(δ) for its second coordinate. And cos(δ) + i sin(δ) obtains the wrong answer. This is a surprising result, since it provides a bit of support for the space shuttle convention: it is natural to want to extend this to define the space shuttle quaternion convention to be cos(δ/2) sin(δ/2)(i u1 + j u2 + k u3) instead of cos(δ/2) + sin(δ/2)(i u1 + j u2 + k u3). As noted earlier, the 2D vector is a1 + i a2, and the 3D quaternion is 0 + sin(δ/2)(i a1 + j a2 + k 0). In 1843, William Rowan Hamilton invented quaternions using i, j, and k in place of i, extending complex numbers to hypercomplex numbers. He defined the simple rules for multiplying with i, j, and k, and not just i. He needed 15 or more years to extend that 2D example with complex numbers to 3D with his invention of quaternions. But in the 2D case, multiplication commutes, and only one of the two operators gives the right answer. In the 3D case, we simultaneously premultiply and postmultiply by the quaternion operator and its inverse, so, unlike Ref. 2 (1975) for space shuttle work, we have two choices that give the same correct answer for body coordinates. In selecting our definition of quaternion_inertial_to_body, we can premultiply with the space shuttle quaternion or postmultiply with the ISS quaternion. My formal training with quaternions, ending in 1992, was in a graduate study program including teachers and texts in the field of robotics. I was not familiar with the space shuttle quaternion convention. Despite my work with quaternions, from 1988 to 1992, in many applications on Space Station Freedom guidance, navigation, and control, I was surprised to see the 1997 American ISS quaternion convention: this was something completely new in my experience. That s an example of the sometimes dramatic difference in vocabularies and points of view for different fields such as engineering, physics, mathematics, and robotics. Equally strong differences sometimes exist in fields such as aerospace navigation and flight control. And some aerospace engineers and documents view these equations first and foremost as coordinate transformations, while others view the same equations first and foremost as a definition of vehicle orientation. In my limited experience, these latter two viewpoints do not conflict, but communication among professionals can be difficult because of these different points of view. It s natural to ask if one of these two quaternion conventions (space shuttle and ISS) is better than the other, though they achieve the same result. Quaternion mathematics used in these programs is more complex than shown here, so the more common and simpler ISS convention is preferred in that sense. On the other hand, re-use of the space shuttle convention will sometimes be helpful. V. Conclusions This history paper begins a public conversation about the mysterious origin of the space shuttle quaternion convention. My conclusion, which I conclude was later supported when I recently read Ref. 2 for the first time, is that responsible space shuttle engineers were familiar with the robotics premultiply convention of Eq. (1), and they took that to be the form of the equation (premultiply, not postmultiply) for coordinate transformation and attitude definition: they rearranged the robotics equation as required for aerospace tradition to solve for Body coordinates and not Inertial coordinates, but they kept the premultiply form, as shown in Eq. (7). With conventions (I) through (IV), as explained above, only one choice remained for them in They defined the quaternion inverse of Eq. (6) to be their quaternion in Eq. (7). As the aerospace world moved away from the pioneering space shuttle quaternion convention, documents began describing the space shuttle quaternion as a left-handed quaternion, since it has a negative sign in the vector part of its definition. But the most common space shuttle application 1,2 is a right-handed coordinate system rotation used for coordinate transformation and attitude definition. Refs. 1 and 2 never describe the space shuttle quaternion as lefthanded. The space shuttle quaternion convention appears to be result of choosing the pre-multiply convention for coordinate transformation when the post-multiply convention was not considered 2. This could easily have been the influence of the use of quaternions in robotics in 1975 and before. Since the space shuttle was pioneering the extensive use of quaternions in spacecraft, a strong influence from a field other than aerospace would not be a surprise. Re-use of the space shuttle quaternion convention for later programs has obvious benefits, but there are bad effects, too. Good quaternion documentation is still hard to find, and extra work is required to compare it to the space shuttle example. That complexity is not present with the ISS quaternion example 3, which Ref. 4 states is the most common example in aerospace. Imagine the ISS engineers selecting their quaternion convention despite the influence of the space shuttle quaternion convention. There must have been great resistance, but somehow the ISS engineers chose and 5
6 implemented a convention prior to the 1998 ISS launch which Ref. 4 described in 2003 as being the most common choice in aerospace. A general rule seems to have been adopted in aerospace: Define the application s fundamental quaternion with no negative signs. This rule corresponds well with quaternion use in the American part of ISS, which matches most aerospace programs, and it corresponds well with quaternion use in robotics. Modern spacecraft often combine robotics and aerospace vocabularies and communities. Acknowledgments Rodolfo Gonzalez at NASA Johnson Space Center was generous with his time, resources, and expertise as we had a few short conversations just before the final draft of this paper was completed, though he did not see this paper in any form. All quaternion conventions mentioned in this paper use right-hand Eigen information, which refers to the quaternion unit vector and the quaternion rotation angle. Mr. Gonzalez also mentioned the order in which quaternions and matrices stack when successive rotations are described. This subject is now developed a bit more in this paper. I apologize in advance for any undetected wrong content in this paper. I thank other authors for their publications on this slippery subject. References 1 Schletz, B., Use of Quaternions in Shuttle Guidance, Navigation and Control, AIAA , Carroll, J. V., The Notation and Use of Quaternions for Shuttle Ascent Steering, Memo 10C-75-47, CSDL, Appendix A (a two-page appendix): QUATERNION CONVENTION DEFINITION, part of the Technical Description Document for the PG-1 Guidance, Navigation & Control System, Product Group 1 (PG-1), McDonnell Douglas Aerospace, Space & Defense Systems, Space Station Division, 17 January 1997, Document Number MDC 95H0223, REVISION D. 4 Stevens, B. L., and Lewis, F. L., Aircraft Control and Simulation, 2 nd ed., John Wiley & Sons, 2003, Chap. 1, which was a free download from the publisher s web site (http://www.wiley.com/wileycda/wileytitle/productcd html), pg. 18 6