Learn R Programming

RSpincalc (version 1.0.2)

Q2EA: Convert from rotation Quaternions to Euler Angles

Description

Q2EA converts from Quaternions (Q) to Euler Angles (EA) based on D. M. Henderson (1977). Q2EA.Xiao is the algorithm by J. Xiao (2013) for the Princeton Vision Toolkit - included here to allow reproducible research.

Usage

Q2EA(Q, EulerOrder='zyx', tol = 10 * .Machine$double.eps, ichk = FALSE, ignoreAllChk = FALSE)

Arguments

Q
Quaternion (Q) vector [q1, q2, q3, q4].
EulerOrder
Euler Order (xyx, yzy, zxz, xzx, yxy, zyz, xyz, yzx, zxy, xzy, yxz, zyx).
tol
Tolerance from deviations from unity for the determinant of rotation matrices or the the vector length for unitary vectors.
ichk
Logical, FALSE=disables near-singularity warnings.
ignoreAllChk
Logical, TRUE=disables all warnings and error checks (use with caution!).

Value

Euler Angles (EA) vector [psi, theta, phi].

Details

Euler Angles (EA) xyz <=> x(roll) y(pitch) z(yaw) Type 1 Rotations (Tait-Bryan angles): xyz - xzy - yxz - yzx - zyx - zxy Singular if second rotation angle is -90 or 90 degrees. Type 2 Rotations (proper Euler angles): xyx - xzx - yxy - yzy - zxz - zyz Singular if second rotation angle is 0 or 180 degrees.

Euler angles [psi, theta, phi] range from -90 to 90 degrees. Tait-Bryan angles [psi, theta, phi] range from 0 to 180 degrees. Angles about Euler vectors range from 0 to 180 degrees.

References

D. M. Henderson, 1977 Shuttle Program. Euler Angles, Quaternions, and Transformation Matrices Working Relationships. National Aeronautics and Space Administration (NASA), N77-31234/6

J. Xiao, 2013 Princeton Vision Toolkit. Available from: http://vision.princeton.edu/code.html http://vision.princeton.edu/pvt/GCBreader/quaternion.m

John Fuller, 14 Jul 2008 SpinCalc, Function to Convert between DCM, Euler angles, Quaternions, and Euler vectors. http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm--euler-angles--quaternions--and-euler-vectors

Paolo de Leva, 01 May 2013 SpinConv, Conversion from a rotation representation type to another. http://www.mathworks.com/matlabcentral/fileexchange/41562-spinconv

See Also

EA2Q

Examples

Run this code
## Not run: 
# Q <- c(-0.1677489, -0.7369231, -0.3682588, 0.5414703)
# Q2EA(Q,'xyx')
# ## End(Not run)

Run the code above in your browser using DataLab