Content uploaded by Hannes Sommer
Author content
All content in this area was uploaded by Hannes Sommer on Feb 27, 2018
Content may be subject to copyright.
Why and How to Avoid the Flipped Quaternion Multiplication
Hannes Sommer∗, Igor Gilitschenski♯, Michael Bloesch†, Stephan Weiss‡, Roland Siegwart∗,
and Juan Nieto∗
Abstract— Over the last decades quaternions have become a
crucial and very successful tool for attitude representation in
robotics and aerospace. However, there is a major problem that
is continuously causing trouble in practice when it comes to
exchanging formulas or implementations: there are two quater-
nion multiplications in common use, Hamilton’s multiplication
and its flipped version, which is often associated with NASA’s
Jet Propulsion Laboratory. We believe that this particular issue
is completely avoidable and only exists today due to a lack of
understanding. This paper explains the underlying problem for
the popular passive world to body usage of rotation quaternions,
and derives an alternative solution compatible with Hamilton’s
multiplication. Furthermore, it argues for entirely discontinuing
the flipped multiplication. Additionally, it provides recipes for
efficiently detecting relevant conventions and migrating formulas
or algorithms between them.
NOMENCLATURE
Rk×1≃Rk;implicitly identified ∀k∈N
⋅×⋅ cross product
⋅×∶R3→R3×3,∀x,y∈R3:(x×)y=x×y
H∶=(R4,+,⊙),quaternions,(1,i,j,k)∶=(ei)4
i=1
U∶={q∈Hq=1},unit length quaternions
⊙1Hamilton’s multiplication, i.e. i⊙j=k
⊗flipped mult. [1]: ∀p,q∈H∶q⊗p=p⊙q
Ð→
q,I(q)∶H→R3,q=(q1, q2, q3, q4)↦(q2, q3, q4)
I∗(x)∶R3→H,x↦x1i+x2j+x3k⇒I○I∗=idR3
¯
qquaternion conjugation,¯
q∶=(q1,−q2,−q3,−q4)
SO(3)∶=({M∈R3×3M−1=MT∧det(M)=1},⋅)
I. INTRODUCTION
“The quaternion [1] is one of the most important repre-
sentations of the attitude in spacecraft attitude estimation and
control.” With these words Malcolm D. Shuster opened his
introduction of [2], “The nature of the quaternion” (in 2008).
It details on a conventional shift from Hamilton’s original
quaternion multiplication, ⊙, to its flipped version, ⊗, he had
successfully advocated for in the 1990s - in particular with
the very influential [1]. There, the flipped multiplication was
called natural2and the original was called traditional. Because
we consider “natural” too tendentious and because both labels
The authors are affiliated with, the ∗Autonomous Systems Lab, ETH,
Z¨
urich, CH, ♯Computer Science and Artificial Intelligence Laboratory, MIT,
Cambridge, MA, USA, †Dyson Robotics Lab, Imperial College London, UK,
‡Institute of Smart System Technologies, Alpen-Adria-Universitat Klagenfurt,
AT; e-mail: hannes.sommer@mavt.ethz.ch
1⊙is only used here for better readability (to contrast ⊗). For documents
using Hamilton’s multiplication only we recommend to just use the normal ⋅or
the default operator (omitted symbol), because it is the default multiplication
symbol for quaternions in mathematics, which should not be needlessly
questioned as the standardizing authority.
2In robotics this multiplication is often and inaccurately referred to as
JPL-convention. While this convention uses Shuster’s multiplication, it also
includes additional conventional decisions.
are generally rather unknown we will refer to the former
with Shuster’s multiplication and to the latter with Hamilton’s
multiplication. Back then, the goal of the introduction was
to prevent confusion and mistakes when dealing with chains
of rotations (compositions) motivated by the application of
spacecraft attitude estimation and control [2]. However, the
introduced conventional split with other fields (e.g. mathe-
matics, physics, or computer graphics / visualization) caused
a lot of confusion and was a source for potential mistakes in
practice at least in other fields, such as robotics. Therefore,
in this paper, we advocate to undo this split by only using
Hamilton’s original multiplication. At the same time we show
how an alternative solution can be used to solve the original
problem addressed in [1].
A. Original problem and Shuster’s solution
The historical problem with Hamilton’s multiplication ap-
peared only together with an arguably arbitrary, specific con-
vention on how to assign direction cosine matrices (DCM)3,
CS∶U→SO(3)to unit length quaternions. When using this
assignment, as in [1], the product of two quaternions, p⊙q,
would correspond to the product of the two corresponding
DCMs, but with reversed order:
∀p,q∈U∶CS(p⊙q)=CS(q)⋅CS(p).(1)
I.e. the mapping, CS, was not a homomorphism (U,⊙)→
(SO(3),⋅)but an antihomomorphism, which is generally more
surprising and therefore more error-prone. Introducing the
flipped ⊗is Shuster’s solution to this problem [1]:
p⊗q∶=q⊙p⇒CS(p⊗q)=CS(p)⋅CS(q).(2)
B. The problem today with Shuster’s solution
Since its introduction, a great fraction of spacecraft litera-
ture switched to ⊗[2]. On the other hand virtually the entire
rest of the scientific community dealing with quaternions is
apparently not following, and partially not even aware of this
transition in the spacecraft community as we will show in III.
Having two different quaternion multiplications in use comes
at a significant and continuous cost: formulas and implemen-
tations need translation or adaptation let alone one first must
identify which multiplication is used in a given formula or
algorithm. The latter can be particularly tedious if the authors
are not aware of the two possibilities and hence do not mention
which one they use4. If a reader is unaware of the split, the
3Equivalent in value to a corresponding coordinate transformation matrix
(between oriented orthonormal bases).
4As a small self experiment, the reader in doubt is invited to try to figure
out which quaternion multiplication the popular c++ template library for linear
algebra, Eigen, is using.
discovery that two different quaternion multiplications are in
use, and that in fact “the other” was employed, might be made
only after several failures.
The troubles may be little per subject but they affected
and will affect a significant number of scientist and en-
gineers causing delays in the best case. This accumulated
cost is particularly large for interdisciplinary domains such
as robotics that lean on publications from both conventional
worlds, for instance aerospace and computer vision. In fact,
in robotics there are several recent publications for each of
the two multiplications (see III). It is also a pressing matter
because the effort to correct becomes larger with every new
implementation or publication using a convention different
from what the community agrees on eventually.
C. Contribution
Given this current situation, it is an interesting question
whether the proposed switch was necessary. Or phrased differ-
ently, whether some benefit is actually worth this conventional
split or whether there is an economical alternative. Addressing
these questions this work provides the following contribu-
tions5:
●identify the problem of two quaternion multiplications
●investigate the necessity of the flip (2) to solve (1)
●advertise and explain one alternative solution
●demonstrate that this alternative yields more formal sim-
ilarity to corresponding formulas using matrices
●advocate to discontinue Shuster’s multiplication
●provide recipes to detect and migrate between quaternion
multiplication conventions
To the best of our knowledge, this is the first work explicitly
addressing the ambiguity of quaternion multiplication as a
problem and proposing a potential solution.
D. Outline
We start with important background information in II.InIII,
we summarize relevant contributions on quaternion multiplica-
tion related conventions, and tabulate their popularity in recent
or influential publications. Next, we propose an alternative
solution in IV. Then we argue for discontinuing Shuster’s
multiplication in V. Lastly, we provide recipes for detecting
and migrating rotation quaternion related conventions in VI.
II. BACKGROU ND: DUALI TY OF ROTATION
REPRESENTATIONS
Physical rotations are conceptually rather unambiguous.
However, when it comes to describing them, there are two
popular ways to do so. The active way is to describe what
happens to the rotated body’s points from a fixed world frame’s
perspective. The passive way is to describe how coordinates of
fixed world points change from the perspective of the rotated
body frame6. It comes in two flavours, world-to-body (PWTB)
and body-to-world (PBTW). The first describes the change
from before rotation to after and the second from after to
5An extended version of this paper with in-depth arguments, derivations,
proofs, and more additional material can be found here [3].
6The two ways are also distinguished as alibi (active) and alias.
before7. We call these options the usage8of the mathematical
model to describe the physical rotation. Mathematically, the
described actions on the observed points have identical prop-
erties in all three cases matching precisely the actions of the
special orthogonal group (SO9). But because given the same
physical rotation, PWTB describes the inverse compared to
PBTW, they yield mutually inverse group elements. Despite
of being conceptually very different, the active usage yields
always the same group element as PBTW. Consequentially we
will often not distinguish these two.The crucial consequence is
that while every parametrization of the SO can be employed
for all usages, switching usage from or to PWTB corresponds
to an inversion. The main target audience of this paper are
those who favour the PWTB usage because the problem (1)
is exclusive for the PWTB usage.
III. LITERATURE REVIEW
A. Literature on or introducing relevant conventions
According to [5] Shuster’s multiplication, ⊗, was introduced
in [6]. It was later proposed as a standard in [7] according
to [8]. Unfortunately, the exact details are impossible for us
to reconstruct as NASA is not publishing [7]. In [9] the
authors derive a homomorphic composition rule for Euler
(symmetric) parameter (ESP)10 (effectively ⊗) and infer a
required conjugation from ESP to Hamilton’s quaternions. In
IV we are proposing the same quaternion values but with
different derivation.
In [2] the author describes the transition from Hamilton’s
⊙to Shuster’s ⊗for “spacecraft attitude estimation and
control” literature citing [1] as “probably, more than any
other work,” responsible for the conventional shift. In [1]⊗is
indeed derived as necessity given some requirements, of which
one was the correspondence CS. At the same time Shuster
speculated already why mathematicians have no reason to
reform the quaternions: “The concern of pure mathematics
is not in representing physical reality efficiently but in ex-
ploring mathematical structures . .. As engineers, our interest
is in “im-pure” mathematics, contaminated by the needs of
practical application.” A major struggle with the quaternion
conventions within NASA is reported in [10], including the
discussion of a major conventional switch from the official
Space Shuttle program to the (American) International Space
Station software standard. The author compares these two
conventions with a third convention that he calls Robotics.
Neither [1] nor [2] are mentioned in [10] despite their apparent
relevance. The only easily accessible reference in [10] for
quaternions, [11], uses Hamilton’s multiplication and also does
not mention Shuster’s work.
The Navigation and Ancillary Information Facility (NAIF),
a sub organization of NASA’s Jet Propulsion Laboratory (JPL),
uses Hamilton’s multiplication everywhere in their primary
software suite called SPICE [12]. The authors use the short
terms SPICE quaternions and Engineering quaternions and
7The names stem from assuming that body and world frame are initially
aligned. Alternative: local to global vs. global to local [4].
8[4] uses “function” for active vs. passive without flavours.
9This paper only deals with SO(3).
10Usually treated as equal to the quaternion components
TABLE I
POP ULAR ITY OF T HE TWO M ULTIPL ICATI ONS12
Type/Community Hamilton13 Shuster
Online
encyclopedia
Encyclopedia of Math.,Wolfram
Mathworld,Planetmath,Britan-
nica,Wikipedia
Mathematics [14](B!), [18](Ba), [19](Ba),
[20](Baw), [21](B-)
Aerospace [9](B), [22](Bw), [14](B!),
[11](B!), [23](w), [24](!)
[6], [1], [5], [25],
[26], [27], [28],
[29], [30]
Robotics [31](a), [13](aw), [32](Bw),
[16](w), [17](w), [4](w), [33](w)
[8], [34], [26],
[35], [36]
Mechanics [37](w), [38](w), [39](Baw),
[40](Ba), [41](Ba) [42](Ba)
Control [23](w), [43](!), [33](w), [44](!)
Computer vision [31](a), [45](aw), [16](w)
Computer graphics /
visualization
[46](!), [45](aw), [47](aw),
[48](B!), [20](Baw), [49](-)
Applications and
software libraries
Wolfram Mathematica, Matlab’s
aerospace(!) and robotics toolbox,
C++ library Eigen, Google Ceres,
Boost,GNU Octave,ROS, NASA’s
SPICE (qxq c,m2q c)
Microsoft’s
DirectXMath
Library14
describe the first with “Invented by Sir William Rowan Hamil-
ton; Frequently used in mathematics and physics textbooks”
and the second with “Widely used in aerospace engineering
applications” (e.g. cspice/qxq c).
1) Robotics: In [4] the author proposes a classification
of rotation quaternion related conventions based on four bi-
nary choices leading to “12 different combinations”11. The
choice between homomorphic and anti-homomorphic matrix
to quaternion conversion (see V-B) is not among these choices.
Instead homomorphy is implicitly assumed as a natural re-
quirement. The author also points out two most commonly
used conventions, one using Shuster’s and one using Hamil-
ton’s multiplication. The author chooses to use Hamilton’s
multiplication because it “... coincides with many software
libraries of widespread use in robotics, such as Eigen, ROS,
Google Ceres, and with a vast amount of literature on Kalman
filtering for attitude estimation using IMUs ([13], [14], [15],
[16], [17], and many others).” At the same time PBTW usage
is chosen, circumventing the problem (1).
B. Popularity in influential and recent literature
In Table Iwe group publications, which are recently dealing
with rotation quaternions, by which quaternion multiplication
is used, by the type of publication, and the scientific commu-
nity for books and papers. Of course, this is merely a small
selection of corresponding publications in the respective fields.
Within these constraints the table shows: All relevant online
1112 (instead of 16) because one binary choice, body to world vs world to
body only makes sense in the passive case.
12The references are roughly in chronological order.
13Parentheses decorate differences from a default (article, passive world-
to-body usage): (B) book, (-) no rotations used, (a) active usage, (w) passive
body-to-world usage, (aw) ≃(a) or (w), (!) antihomomorphic QM-convention
(i.e. using CSin the Hamilton column).
14This is an unclear case since the documentation of the multiplication
function states: “Returns the product of two quaternions as Q2*Q1”, where
the multiplication function arguments are in the order Q1, Q2. I.e. Shuster’s
multiplication is implemented while the documentation uses Hamilton’s
multiplication (implicitly).
Hamilton Quaternion
Rotation Matrix
Rotation Vector
active
passive
q
q
C
C
CH
CS
exp(ϕ)exp(-ϕ)
exp(ϕ/2)
exp(-ϕ/2)
q-1
C-1
One
Physical
Rotation
Hamilton (⊙) & Shuster (⊗)
Rotation Matrix
Rotation Vector
active
passive
q,⊙
C
C
ϕ
ϕ
exp(ϕ)exp(-ϕ)
=
-ϕC-1
One
Physical
Rotation
exp(ϕ/2)
exp(-ϕ/2)
CH
CS
ϕ
ϕ
-ϕ
q,⊗
Fig. 1. Active (or passive body-to-world; outer ring) and passive (world-
to-body; inner ring) representatives of a single physical rotation and their
mutual conversions: black lines convert only between active and passive,
green convert between different parametrizations, and red additionally invert.
The bold lines on the left (Hamilton multiplication only) constitute the
homomorphic convention suggested in this paper. It is suitable for everybody
preferring passive world-to-body for qand C. Clinging to the green conversion
from the common active φto qeven if the quaternion is intended to be
employed passively, as done in [1]leads to the situation on the right (using
Shuster’s multiplication when employing quaternions passively). This neglects
the option of the highlighted passive q(on the left) and thus requires the
flipped multiplication, ⊗, and inevitably breaks the symmetry between Cand
qon the right compared to the left.
general purpose or mathematical encyclopedias, which we
could find, use Hamilton’s multiplication (without mentioning
any alternatives). And so do all major software packages. Most
of them also use precisely the quaternion to matrix mapping
we suggest as part of an alternative solution to (1)inIV.
The only scientific communities we could find using Shuster’s
multiplication are aerospace and robotics. Both seem to be still
divided. Even NASA itself and it’s substructure JPL seem to
be divided to this day.
IV. PROPOSED ALTE RNATIVE SOLU TI O N
The alternative solution we suggest for the original problem
(1) is to use a different correspondence rule, CH∶U∋
q↦CS(¯
q). Assuming we keep fixed how rotation matrices
represent rotations, this new correspondence inverts the corre-
sponding quaternion. It also yields the desired homomorphy
from quaternions to rotation matrices together with ⊙and the
usual matrix multiplication:
∀p,q∈U∶CH(p⊙q)=CH(p)⋅CH(q).(3)
This suggestion might give the wrong negative impression of
an “additional” inversion. But it could equally well be that for
CSthe “wrong” (inverted) quaternions were chosen. In fact
our observations in V-B.3 support this interpretation. Please
note that both solutions yield the usual way to apply the
rotation represented by a quaternion15 (see VI-B.2.e):
∀x∈R3,q∈U∶CH(q)x=I(q⊙I∗(x)⊙q−1)
CS(q)x=I(q⊗I∗(x)⊗q−1)(4)
V. RATI O NALE AGA IN S T SHU S TE R’S MULTIPLICATION
First of all, it is important to emphasize that the question
which quaternion multiplication to use commonly, should be
considered as a pragmatic question. Conceptually there is no
problem with any of the two multiplications or with having
two multiplications commonly used. Having said that, our
main argument is as follows:
15This fact is actually equivalent to both being homomorphic.
1) Both multiplications are equally capable and inter-
changeable for every application: As we explain in V-A one
multiplication is as good as the other in terms of applicability.
For example to represent rotations.
2) One of the two multiplications should be discontinued:
Having two quaternion multiplications in formulas and soft-
ware comes at a significant and ongoing cost (see I-B,III),
but does not provide benefits (see V-.1).
3) Hamilton’s multiplication is preferable: Hamilton’s mul-
tiplication is predominant over all existing publications. This
is because i) it is about 150 years older, and ii) Shuster’s
multiplication did not spread to mathematics or theoretical
physics and probably will never do. The latter arises from
the fact that both disciplines have very different needs that
typically do not even lead to the original problem (1) as
already observed in [1]. To the best of our knowledge it only
spread from aerospace to parts of robotics, which has similar
needs and is strongly influenced by aerospace literature. Also,
Hamilton’s multiplication is used by the vast majority of
current software (see Table I). These observations make it
extremely difficult to discontinue Hamilton’s multiplication
instead. Even more so, pure mathematics should be almost
impossible to influence in that respect because it is against
the very nature of mathematics to change such a definition
without an inner-mathematical reason. Additionally, as we
show in V-B.2, Hamilton’s multiplication has its benefits over
Shuster’s from a formal point of view. These benefits make
it less error prone if combined with CH, which is at least
as old and well-known16 as CS. It is typically used whenever
rotations are represented actively or PBTW (see II). Because of
that, CHis also already predominant among existing software
implementations (see Table I).
Employing CHalso for the very popular PWTB usage,
as we suggest, has a consequence that one could consider
its biggest drawback: It introduces the comparatively rarely
seen passive quaternion (see Table II, Fig. 1), and thus
induces an unusual conversion from an active rotation vector,
φ:q(φ)=exp(−0.5φ). Eventually, the original problem
(1) leaves two options: i) introducing an unusual quaternion
multiplication (Shuster’s solution) or ii) introducing an unusual
conversion from the active rotation vector to the (passive)
rotation quaternion (used e.g. in [9]). Having only these two
options is probably the very difficulty behind the overall
struggle and what prevented a standardization so far (see
III). Our position, in favour of ii), emerges from rephrasing
the question equivalently: What should be specific for the
passive usage of quaternions when compared to the active
usage, their multiplication or the conversion to the active17
rotation vector? It reveals an immediate argument for ii): the
conversion from active rotation vector to passive quaternion
should even be expected to be different from its conversion to
an active quaternion (compare also II). An argument against
i) is that the multiplication is used much more often, because
conversions are merely interface operations and usually do not
16CHis often referred to with Euler-Rodrigues formula.
17There is good reason to call the usual rotation vector active. But it is not
required here. Our argument works as well for neutral rotation vector.
appear where the heavy lifting is done. Also, if we have to
chose the multiplication depending on the usage of quaternions
to represent rotations, which multiplication is right for other
applications? Furthermore, it is very unusual and therefore
unexpected that a fundamental algebraic operation such as a
multiplication is a matter of dispute and convention, while it
is quite common for representations. Finally, the very same
question for rotation matrices was answered historically: there
is no flipped matrix multiplication in regular use. Instead
it is fully accepted that there is an active and a passive
rotation matrix related differently to an active rotation vector.
Why not accept the exact same for rotation quaternions while
employing them for exactly the same purpose?
A. Equal capability argument
In this section we explain why both multiplications are
equally capable to support V-.1). The migration recipes in
VI-B show that any algorithm or formula can be migrated
between the two multiplications with very simple steps: just
introduce quaternion conjugation at some places and exchange
all multiplications. This already shows that both multipli-
cations can provide the same service to the user (writer,
reader, programmer), as the migration concepts work in both
directions. The question remains whether one implementation
could be computationally more efficient than the other. How-
ever, one should easily be convinced that the extra cost for
some additional conjugations is negligible for most use cases
since it only involves scalar negations. Furthermore, for very
performance critical parts of an implementation, the negations
can almost always be statically merged into other operations
or simplified away mathematically.
B. Formal differences
In this section we are going to investigate the formal
differences of the two alternative solutions to the original
problem (1) to support parts of V-.3). Please note that this
does not contradict our observation of equal capability in V-
A, because formal similarity or symmetry do not affect the
practical capability of a mathematical tool. Instead it affects
mostly the probability of human error when dealing with the
tool. And this can be a strong argument, too. In fact it is the
very type of argument with which [1] justifies the introduction
of Shuster’s multiplication.
We start without any assumptions about how unit quater-
nions and proper orthogonal matrices are conceptually used
for modeling rotations18 and only focus on how quaternions
are converted to matrices. This conversion must be at least
implicitly determined by all consistent rotation conventions
involving rotation matrices and rotation quaternions. The ben-
efit is that our abstract observations apply automatically to all
such conventions. In particular the Cin CSand CHdoes no
longer stand for direction cosine matrix, but for any rotation
matrix concept.
1) QM-convention: We call a convention that determines
a specific conversion, C∶U→SO(3), and a particular
quaternion multiplication, ⋆, a QM-convention and represent
18For instance active/passive/DCM matrices.
it with (C,⋆). In this way many common conventions collapse
to a single representative. However, that is intended as their
differences do not matter for the following analysis, i.e. it
holds in any case. We call a QM-convention homomorphic iff
the multiplication order is preserved when switching between
quaternions and matrices, as in (3), antihomomorphic iff the
order flips, as in (1), and inconsistent otherwise. There are
only four options for consistent QM-conventions, namely all
pairs in {CH,CS}×{⊙,⊗}. It seems commonly accepted that
a homomorphy is preferable and less error-prone reducing the
good candidates to the two homomorphic QM-conventions,
(CH,⊙)and (CS,⊗), with their homomorphy given in (3)
and (2) respectively.
2) Formal comparison independent of the usage: In Ta-
ble II we compare the two homomorphic conventions. The
φdenotes a rotation vector in R3. The convention-factors
αC, αφ∈{−1,1}19 encode the usage of rotation matrices (αC)
and rotation vectors (αφ). The usage of the quaternion follows
from αCgiven the chosen (C,⋆)and is identical to αCfor
homomorphic QM-conventions. We’ll look deeper into their
effect in V-B.3. The indices Aand Bfor the angular velocities,
ω, indicate differences stemming from various usage choices
regarding ω. Depending on these choices one of the two
formulas is correct.
TABLE II
COMPARING HOMOMORPHIC QM-CONVENTIONS
Expression Equal expression given QM-Convention
Hamilton, CHShuster, CS
C,⋆CH,⊙CS,⊗
C(p)C(q)CH(p⊙q)CS(p⊗q)
C(q)xI(q⋆I∗(x)⋆q−1)
I(p⋆q)p1Ð→
q+q1Ð→
p+Ð→
p×Ð→
qp1Ð→
q+q1Ð→
p−Ð→
p×Ð→
q
i⋆j+k−k
C(q)q2
11+2q1Ð→
q×+Q(q)20 q2
11−2q1Ð→
q×+Q(q)20
C(φ)exp(+αCαφφ×)
⇒21q(φ)±exp(+αCαφφ/2)±exp(−αCαφφ/2)
αC˙
C+CωA×
+ωB×C
⇒21αC˙
q+1
2q⊙I∗(ωA)−1
2q⊗I∗(ωA)
+1
2I∗(ωB)⊙q−1
2I∗(ωB)⊗q
The neutral differences are highlighted in blue. Green vs.
red highlights the benefits of (CH,⊙)in terms of more sim-
ilarity between corresponding rotation matrix and quaternion
equations. The table clearly shows that (CH,⊙)yields more
formal similarity with the rotation matrices when related to
rotation vectors or angular velocities: The alternative, (CS,⊗),
does introduce a difference in sign for the expressions involv-
ing φor ω(−instead of +) compared to the matrix cases. This
difference in similarity with the corresponding rotation matrix
formula does not depend on the interpretation/usage (encoded
in αC,αφ,A, B) but only on the choice of the homomorphic
QM-convention.
Table II also indicates that additionally flipping the cross
product (negating the ⋅×) would change the similarity argument
in favour of (CS,⊗). In fact it seems probable that this lack
19PWTB & DCM ≃−1; active & PBTW ≃1
20Q(q)∶=(Ð→
q×)2+Ð→
qÐ→
qT
21C(φ),q(φ)and C(t),q(t)are coupled here through C(q).
of formal similarity was one reason to introduce the matrix
valued operator [[φ]] ∶=−φ×in [1, p. 445]. Unfortunately,
this is hard to verify because it was introduced only because
this “matrix turns out to be more convenient overall”. In [2]
this matrix was abandoned again.
3) Formal comparison distinguishing active and passive
usage: A further symmetry aspect in favor of Hamilton’s
multiplication becomes apparent if we compare both active
and passive usage of matrices and quaternions (see II and
Fig. 1). This yields the Table III, again using the factor αφ
to encode the usage of the a given rotation vector φ. In
contrast to Table II, which assumes an arbitrary but single
usage for rotation matrices and quaternions, it compares both
usages (corresponding values in column 2 and 3). Each row
corresponds to a rotation representation: rotation matrix and
three different flavours of rotation quaternions, each yielding
homomorphic conversion to the rotation matrix in row 1.
The table shows that neither using Shuster’s multiplication
for the passive and Hamilton’s for active usage (row 3), nor
a full switch to Shuster’s multiplication (row 4) can yield
the same level of form-similarity, when compared to the
rotation matrices, as the proposed Hamilton only (row 2)
option (similarity flaws are marked in red vs. green).
TABLE III
ACTIVE VS.PASS IV E US AG E GI VE N A ROTATIO N VE CT OR φ.
Rot. rep. Active Passive Composition
1) C(φ)exp(+αφφ×)exp(−αφφ×)⋅
Homomorphic rotation quaternion options:
2) q(φ)exp(+αφφ/2)exp(−αφφ/2)⊙
3) q(φ)exp(+αφφ/2)exp(+αφφ/2)⊙(act), ⊗(pass)
4) q(φ)exp(−αφφ/2)exp(+αφφ/2)⊗
VI. RE C IP E S
In this section we give some practical advice to a) identify
QM-conventions and b) migrate between them.
A. How to detect which QM-convention is used
QM-conventions are determined by two binary choices,
which quaternion to matrix map, C, and which quaternion
multiplication, ⋆. Therefore, it is enough to determine these
two choices, which can be done as follows:
1) For the quaternion multiplication:one of the easiest
ways is to find out the result of the product i⋆j. If the result
is kthen ⋆=⊙otherwise it is −kand ⋆=⊗.
2) The quaternion to matrix conversion:can be identified
by applying it to a suitable test quaternion, e.g. qT∶=
√0.5(1,0,0,1)T. It holds CH(qT)=CT∶=0−1 0
1 0 0
0 0 1 and
CS(qT)=CT
T. This test can also be performed on a matrix
to quaternion conversion. It maps CTto ±qTif CHis used
and to ±qTin case of CS.
B. Migrating from one QM-convention to another
There are several efficient ways to migrate atool (e.g.
formulas, proofs, publications or algorithms and implemen-
tations) between QM-conventions, where migration shall refer
to a transformation after which the tool does exactly the
same job but with all quaternions going in or out being
compatible with the target convention. We introduce here two
powerful alternative procedures, translate and interface, that
are applicable to all types of tools. Both procedures migrate
between the two homomorphic QM-conventions22. It can be
very helpful to first decompose a tool into smaller sub-tools
and migrate each with the most advantageous procedure.
1) The two migration procedures: See App. Afor a sketch
of a correctness proof. For both procedures a successive
mathematical simplification step is recommended.
a) Translate: Replace all quaternion constants,c∈H,
within the tool with their conjugated value, ¯
c, and all quat.
multiplications with their flipped version (⊗↔⊙).
b) Interface: Conjugate all quaternion valued in- and
outputs of the tool23. Components of a partial quaternion (i.e.
not constituting a complete quaternion) going in or out should
be treated as plain real numbers.
2) Examples: Next, we provide some examples:
a) i⊗j=−k:translates into −i⊙ −j=−(−k), which
simplifies to i⊙j=k. Interfacing it would not change it since
it has no inputs and only a logic output.
b) I(q):interfaces into I(¯
q)=−I(q). When translating
it, its implicit dependence on constants must be respected. One
way to define its returned triple (α)4
i=2∈Ris as part of the
unique solution to q=∑4
i=1αiei, with α1∈R. The equation
translates into q=∑4
i=1αiei, which has the solution ¯
α. Hence,
translation also yields −I(q).
c) ˙
q=−1
2q⊗I∗(ω):could be first decomposed in ˙
q=
−1
2q⊗ ⋅ and I∗(ω). The first translates into ˙
q=−1
2q⊙⋅24 .
The second interfaces into I∗(ω)=−I∗(ω). Putting together
yields the expected ˙
q=1
2q⊙I∗(ω).
d) CS(q):Interfaces into CS(¯
q)=CH(q)25. It trans-
lates into the same, because CSmust use coordinates with
respect to a basis (qi)4
1(constants) for its input and ∑αi¯
qi=
q⇔∑αiqi=¯
q, because αi∈R(compare V I −B.2.b).
e) I(q⊗I∗(x)⊗q−1):could be first decomposed in
I(⋅), interfacing into I(¯⋅)=−I(⋅), and q⊗I∗(x)⊗q−1,
translating into q⊙(−26I∗(x))⊙q−1. Putting together yields
the expected result, I(q⊙I∗(x)⊙q−1).
VII. CONCLUSION
In this paper, we suggested an alternative solution to the
antihomomorphy problem that lead to the introduction of
the flipped quaternion multiplication. We further proposed to
discontinue its use in favour of Hamilton’s original definition
combined with the suggested alternative solution. To argue for
this we gave evidence of the cost of maintaining two multipli-
cations and showed that for principal reasons there cannot be
any significant capability benefit in using the flipped multipli-
cation for theory or algorithms. Additionally, we demonstrated
that the formal similarity between matrices and quaternions,
when related to angular velocity or rotation vectors, is in
22To migrate a non homomorphic QM-convention first replace all mul-
tiplications with the other and flip their arguments. This is an equivalence
transformation yielding a tool using a homomorphic convention.
23Also suggested in [12].
24The variable qis an input and no constant.
25Hence, the matrix part of the QM-convention is indeed migrated.
26From translating constants in I∗(x)=x1i+x2j+x3k
favour of the Hamiltonian multiplication independently of any
other conventional decision as long as the definition of the
cross product is not additionally questioned. Furthermore, we
provided recipes for how to migrate formulas and algorithms
from one quaternion multiplication to the other as well as how
to detect which convention is used in a given context.
ACK NO WL EDG MEN T
The authors are grateful to Michael Burri and Anne-Katrin
Schlegel for very helpful comments.
APPENDIX
A. Proof sketch: Correctness of migration recipe
A full technical proof is far beyond the scope of this
short paper and we only provide a sketch of a proof: To
show the claim we assume the opposite and that we have
acounter example. I.e. a tool, T, that after some migration,
M, as in VI-B into M(T)is not doing the same job when
used with quaternions of the target convention. Formally,
M(T)does not yield the corresponding, i.e. quaternions in
the target convention and otherwise equal, outputs when given
corresponding inputs (denoted with T≃M(T)).
1) T can be assumed migrated as a whole by M:
(MdoesMigAsAWhole T) If not we take the first sub tool,
T′, on the way from input to output, for which T′≃M(T′),
as new Tuntil MdoesMigAsAWhole T.
2) T can be additionally assumed having no quaternion
in- or outputs and being translated by M: (¬Q(T)∧
MdoesTranslate T) To ensure that we inflate Tinto
ˆ
Tby adding bijective conversions per quaternion in- or
output, q, into a pair ∈R×R3×3through C27 (from the
source convention). ˆ
Tcan then be used for exactly the same
jobs by employing inverse conversions wherever quaternions
were exchanged with T. We migrate ˆ
Tby ˆ
Minto ˆ
M(ˆ
T)
by migrating the contained Tusing Mand translating the
inflation layer (effectively translating all source Cinto the
target C; see Example VI-B.2.d). Since ˆ
M(ˆ
T)would be used
through conversions using the target C, which would cancel
out the translated inflation, causing the same effective input
output behaviour as M(T)and therefore different from ˆ
T. It
follows ˆ
T≃ˆ
M(ˆ
T), while ¬Q(ˆ
T). Furthermore Tmust have
been already translated: If it had been interfaced (as a whole)
ˆ
M(ˆ
T)would exactly behave as ˆ
T, because the interfacing
conjugation effectively revokes the translation of the inflation,
rendering ˆ
Minto an equivalence transformation, contradicting
ˆ
T≃ˆ
M(ˆ
T). It follows ˆ
MdoesTranslate ˆ
Tand, since
component-wise translating is equivalent to translating as a
whole also ˆ
MdoesMigAsAWhole ˆ
T.
3) T is no counter example: It is well-known and straight
forward to verify that conjugation is a structure isomorphism
(H,+,⊙,¯⋅)≃(H,+,⊗,¯⋅)that lets the embedding R⊂H
invariant. Since Tcan only use the quaternions by means
of their structure and their relation to R(nothing more is
defined about them after all) replacing all quaternion constants
according to the isomorphism and all operations with their
isomorphic partners, as precisely done by the translation
27E.g. (sign(R(q))∥q∥,C(q∥q∥−1)) if q/=0, otherwise (0,0)
procedure, cannot change its input-output behavior for non-
quaternions. Therefore ¬Q(T)∧MdoesTranslate Tcon-
tradicts T≃M(T)and proves the claim.
REFERENCES
[1] M. D. Shuster, “Survey of attitude representations,” Journal of the
Astronautical Sciences, vol. 41, pp. 439–517, Oct. 1993.
[2] M. D. Shuster, “The nature of the quaternion,” The Journal of the
Astronautical Sciences, vol. 56, no. 3, pp. 359–373, 2008.
[3] H. Sommer, I. Gilitschenski, M. Bloesch, S. M. Weiss, R. Siegwart, and
J. Nieto, “Why and how to avoid the flipped quaternion multiplication,”
2018. [Online]. Available: https://arxiv.org/abs/1801.07478
[4] J. Sola, “Quaternion kinematics for the error-state kf,” LAAS-CNRS,
Toulouse, France, Tech. Rep, 2012.
[5] J. L. Crassidis, “Sigma-point kalman filtering for integrated gps and
inertial navigation,” IEEE Transactions on Aerospace and Electronic
Systems, vol. 42, no. 2, pp. 750–756, 2006.
[6] E. J. Lefferts, F. L. Markley, and M. D. Shuster, “Kalman filtering for
spacecraft attitude estimation,” JGCD, vol. 5, no. 5, pp. 417–429, 1982.
[7] W. G. Breckenridge, “Quaternions - proposed standard conventions,”
NASA, Tech. Rep. JPL-IOM-343-79-1199, 1999.
[8] N. Trawny and S. I. Roumeliotis, “Indirect Kalman filter for 3D attitude
estimation,” University of Minnesota, Dept. of Comp. Sci. & Eng., Tech.
Rep. 2005-002, Mar. 2005.
[9] J. L. Junkins and J. D. Turner, Optimal spacecraft rotational maneuvers.
Elsevier, 1986, vol. 3.
[10] D. Yazell, “Origins of the unusual space shuttle quaternion definition,” in
Aerospace Sciences Meetings, pages–. American Institute of Aeronautics
and Astronautics, vol. 66, 2009.
[11] B. Stevens and F. Lewis, Aircraft Control and Simulation. Wiley, 2003.
[12] N. NAIF, “Quaternions white paper,” 2003. [Online].
Available: ftp://naif.jpl.nasa.gov/pub/naif/misc/Quaternion White Paper/
Quaternions White Paper.pdf
[13] J. C. K. Chou, “Quaternion kinematic and dynamic differential equa-
tions,” IEEE TRA, vol. 8, no. 1, pp. 53–64, Feb 1992.
[14] J. Kuipers, Quaternions and Rotation Sequences: A Primer with Ap-
plications to Orbits, Aerospace, and Virtual Reality, ser. Mathematical
Sciences Series. Princeton University Press, 1999.
[15] P. Pini´
es, T. Lupton, S. Sukkarieh, and J. D. Tard ´
os, “Inertial aiding of
inverse depth slam using a monocular camera,” in ICRA 2007. IEEE,
2007, pp. 2797–2802.
[16] C. Roussillon, A. Gonzalez, J. Sol`
a, et al., “Rt-slam: A generic and
real-time visual slam implementation.” in ICVS. Springer, 2011, pp.
31–40.
[17] A. Martinelli, “Vision and imu data fusion: Closed-form solutions for
attitude, speed, absolute scale, and bias determination,” IEEE Transac-
tions on Robotics, vol. 28, no. 1, pp. 44–60, 2012.
[18] M. Hazewinkel, Encyclopaedia of Mathematics: Volume 6: Subject
IndexAuthor Index. Springer Science & Business Media, 2013.
[19] T. Gowers, J. Barrow-Green, and I. Leader, The Princeton companion
to mathematics. Princeton University Press, 2010.
[20] E. Lengyel, Mathematics for 3D game programming and computer
graphics. Cengage Learning, 2012.
[21] L. Rodman, Topics in quaternion linear algebra. Princeton University
Press, 2014.
[22] R. Battin, An introduction to the mathematics and methods of astrody-
namics, ser. AIAA education series. American Institute of Aeronautics
and Astronautics, 1987.
[23] R. Shivarama and E. P. Fahrenthold, “Hamilton’s equations with euler
parameters for rigid body dynamics modeling,” JDSMC, vol. 126, no. 1,
pp. 124–130, 2004.
[24] B. J. Bacon, “Quaternion-based control architecture for determining
controllability/maneuverability limits,” in AIAA Guidance, Navigation,
and Control Conference, 2012.
[25] J. L. Crassidis, F. L. Markley, and Y. Cheng, “Survey of nonlinear
attitude estimation methods,” JGCD, vol. 30, no. 1, pp. 12–28, 2007.
[26] T. D. Barfoot, J. R. Forbes, and P. T. Furgale, “Pose estimation using
linearized rotations and quaternion algebra,” Acta Astronautica, vol. 68,
no. 1-2, pp. 101–112, 2011.
[27] T. Ainscough, R. Zanetti, J. Christian, and P. D. Spanos, “Q-method
extended kalman filter,” JGCD, 2014.
[28] S. Z. Queen, “A kalman filter for mass property and thrust identification
of the spin-stabilized magnetospheric multiscale formation,” NTRS,
2015.
[29] J. M. Galante, J. Van Eepoel, C. D’Souza, and B. Patrick, “Fast kalman
filtering for relative spacecraft position and attitude estimation for the
raven iss hosted payload,” NTRS, 2016.
[30] J. S. McCabe, A. J. Brown, K. J. DeMars, and J. M. Carson III,
“Comparison of factorization-based filtering for landing navigation,”
NTRS, 2017.
[31] E. Pervin and J. A. Webb, “Quaternions in computer vision and
robotics,” Carnegie Mellon University, Tech. Rep., 1982.
[32] R. M. Murray, Z. Li, S. S. Sastry, and S. S. Sastry, A mathematical
introduction to robotic manipulation. CRC press, 1994.
[33] E. Fresk and G. Nikolakopoulos, “Full quaternion based attitude control
for a quadrotor,” in 2013 ECC, July, 2013, pp. 17–19.
[34] J. Diebel, “Representing attitude: Euler angles, unit quaternions, and
rotation vectors,” Matrix, vol. 58, no. 15-16, pp. 1–35, 2006.
[35] M. Li and A. I. Mourikis, “Improving the accuracy of ekf-based visual-
inertial odometry,” in ICRA 2012. IEEE, 2012, pp. 828–835.
[36] M. Li, H. Yu, X. Zheng, and A. I. Mourikis, “High-fidelity sensor
modeling and self-calibration in vision-aided inertial navigation,” in
ICRA 2014. IEEE, 2014, pp. 409–416.
[37] A. L. Schwab, “Quaternions, finite rotation and euler parameters,” Delft
University of Technology, Tech. Rep., 2002.
[38] A. L. Schwab and J. Meijaard, “How to draw euler angles and utilize
euler parameters,” in IDETC/CIE, 2006, pp. 10–13.
[39] D. Holm, Geometric Mechanics: Part II: Rotating, Translating and
Rolling. Imperial College Press, 2008.
[40] W. Heard, Rigid Body Mechanics: Mathematics, Physics and Applica-
tions, ser. Physics textbook. Wiley, 2008.
[41] S. Fl¨
ugge, Principles of Classical Mechanics and Field Theory /
Prinzipien der Klassischen Mechanik und Feldtheorie, ser. Encyclopedia
of Physics. Springer Berlin Heidelberg, 2013.
[42] M. T. Mason, Mechanics of Robotic Manipulation. MIT Press, 2016.
[43] S. Bonnable, P. Martin, and E. Sala¨
un, “Invariant extended kalman filter:
theory and application to a velocity-aided attitude estimation problem,”
in CDC/CCC 2009. IEEE, 2009, pp. 1297–1304.
[44] H. Gui and G. Vukovich, “Finite-time angular velocity observers for
rigid-body attitude tracking with bounded inputs,” International Journal
of Robust and Nonlinear Control, pp. n/a–n/a, 2016.
[45] R. Mukundan, “Quaternions: From classical mechanics to computer
graphics, and beyond,” in 7th ATCM, 2002, pp. 97–105.
[46] K. Shoemake, “Quaternion calculus and fast animation, computer ani-
mation: 3-d motion specification and control,” in Proc. SIGGRAPH87,
1987.
[47] A. J. Hanson, “Visualizing quaternions,” in ACM SIGGRAPH 2005
Courses. ACM, 2005, p. 1.
[48] J. Vince, Quaternions for Computer Graphics, ser. SpringerLink :
B¨
ucher. Springer London, 2011.
[49] A. Kolaman and O. Yadid-Pecht, “Quaternion structural similarity: A
new quality index for color images,” IEEE Transactions on Image
Processing, vol. 21, no. 4, pp. 1526–1536, April 2012.