Appendix ii – converting quaternions, Appendix ii, Converting quaternions – PNI SENtral User Manual
Page 42: Appendix ii – converting, Quaternions. the
PNI Sensor Corporation
Doc #1018049 R03
SENtral Technical Data Sheet
Page 41
Appendix II
– Converting Quaternions
SENtral outputs orientation data in quaternions, using a North-East-Down (NED) convention.
This is done to avoid the singularities inherent in using Euler angles (heading, pitch, and roll),
and because the fusion algorithms are easier to implement with quaternions. However, normally
quaternions are not the desired final output format. Most end users will want heading, pitch, and
roll, while Android looks for a rotation vector and generally uses a rotation matrix for
orientation. Plus, Android and Win8 both expect data to be presented in the East-North-Up
(ENU) convention. This appendix discusses how to convert SENtral’s output quaternions into
these other output formats.
Converting from NED to ENU
While the North-East-Down (NED) convention is common in many industries, both Android
and Windows 8 use the East-North-Up convention. Below is the equation to convert from
NED to ENU.
Heading, Pitch, and Roll
Most end users will want orientation data reported as heading, pitch, and roll. Below are the
Excel transformation equations. Note that for other programs, such as Matlab, the ATAN2
arguments may be reversed.
Heading = atan2[(Qx
2
– Qy
2
– Qz
2
+ Qw
2
), 2*(QxQy + QzQw)]
Pitch = asin[-2*(QxQz – QyQw)]
Roll = atan2[(–Qx
2
– Qy
2
+ Qz
2
+ Qw
2
), 2*(QxQw + QyQz)]
Where:
Results are in radians.
The quaternions are the outputs from SENtral in NED convention.
Heading increases as the device rotates clockwise around a positive Z axis, and the
range is 0° – 360°. (i.e. it matches what you would expect on a compass.)
Pitch increases when pitching upward and the range is ±180°.
Roll increases when rolling clockwise and the range is ±90°.