beautypg.com

Appendix i – converting quaternions, Appendix i, Converting quaternions – PNI SENtral MandM User Manual

Page 30

background image

PNI Sensor Corporation

Doc #1020129 revE

SENtral M&M Technical Datasheet

Page 29

Appendix I

– 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°.