Quaternion Conventions: Hamilton and JPL

Nov 12, 2017

Quaternion is a commonly used 3D rotation parameterization. It is written like $\mathbf{q}=q_0 + q_1 i + q_2 j + q_3 k$, in which $i, j, k$ forms the three bases of the imaginary part (analogous to the imaginary part of a complex number) and $i^2=j^2=k^2=-1$. Usually a rotation is represented by a unit quaternion (a quaternion whose norm is 1).

I used to think there is only one notation for quaternions, like the one from Wikipedia [1]:

\[i^2=j^2=k^2=ijk=-1\]

With such definition, the transformation from a unit quaternion to a rotation matrix is like:

\[{\bf R}=\begin{bmatrix} 1-2q_2^2-2q_3^2 & 2q_1q_2-2q_0q_3 & 2q_1q_3+2q_0q_2 \\ 2q_1q_2+2q_0q_3 & 1-2q_1^2-2q_3^2 & 2q_2q_3-2q_0q_1 \\ 2q_1q_3-2q_0q_2 & 2q_2q_3+2q_0q_1 & 1-2q_1^2-2q_2^2 \end{bmatrix}\]

However, I recently noticed that in some literature the transformation from quaternion to rotation matrix is not the one above, but its transpose. This confused me. My confusion was cleared when I read a tutorial Indirect Kalman Filter for 3D Attitude Estimation [2] by Stergios I. Roumeliotis etc. The truth is that there are two conventions for quaternions, Hamilton and JPL. The key difference between the two conventions lies in the relation between the three imaginary bases. In Hamilton convention, $ijk=-1$, while JPL defines $ijk = 1$. As consequences, the multiplication of quaternions and the transformation between quaternions and other rotation parameterizations differ with different quaternion conventions.

The co-existence of two conventions for quaternions is still confusing for me. Quaternion is introduced by mathematician William Rowan Hamilton, so I guess Hamilton convention has been used from the beginning by him. Then where the hell is JPL convention from? According to the materials I read that use JPL (like the tutorial by Roumeliotis), it comes from the well-known NASA Jet Propulsion Laboratory (JPL), and the cited original document seems to be a tech report titled Quaternions - Proposed Standard Conventions, which, unfortunately, I failed to search and find.

One thing for sure, the co-existence of two conventions has resulted in some confusion and arguments among researchers.

For instance, oddly enough, although the Quaternion entry in Wikipedia uses Hamilton, and the Quaternions and spatial rotation entry [3] uses Hamilton too, the Conversion between quaternions and Euler angles entry [4], on the contrary, uses JPL. I have to say, inconsistency and impreciseness and is a major weakness of free encyclopedias that everyone can edit like Wikipedia.

Nicolas Rotella also mentioned this problem in his report [5], and complained that “unfortunately, the quaternion algebra used in these conventions is often mixed up in the literature”. He finally chose JPL.

There are also some concerning arguments and discussions in GitHub. One such issue from a project of ETH-ASL:

lXOZ8J.png

It seems Hamilton receives more favor from their group.

In another report Quaternion kinematics for the error-state KF [6], Joan Sola also voted for Hamilton.

My personal opinion: the current situation of two quaternion conventions co-existing is awful. I cannot understand what is the necessity of proposing another notation when there is Hamilton convention well used. I know you guys from JPL (the lab) are amazing in creation and engineering, but arbitrarily introducing new standards is evil. In current situation, Any reliable material should at least point out the convention they use at the beginning. From a realistic point of view, the widely used linear algebra library Eigen uses Hamilton; Matlab uses Hamilton (MathWorks: Quaternion); ROS, Google Ceres Solver use Hamilton; let’s use Hamilton to avoid any chaos in our development work. JPL to hell.

Updated 2018-03-19: As for the Wikipedia entry [4], after confirmation, it actually just claims to use JPL, but still uses Hamilton throughout the equations… Don’t know why someone just added this mismatched claim. Thanks to Hannes for reminding me of this case.

Moreover, Hannes wrote a paper on this problem with more extensive historical investigation and implementation suggestions. Read his paper on arxiv. A shorter version is also available at ResearchGate.

References:

[1] Wikipedia: Quaternion

[2] Nikolas Trawny and Stergios I. Roumeliotis, Indirect Kalman Filter for 3D Attitude Estimation

[3] Wikipedia: Quaternions and spatial rotation

[4] Wikipedia: Conversion between quaternions and Euler angles

[5] Nicholas Rotella, Quaternion Review and Conventions

[6] Joan Sola, Quaternion kinematics for the error-state KF

License (CC) BY-NC-SA | Subscribe RSS | Email xmann_zh@foxmail.com | Back Top 🫠 |