to_quaternion#

DCM.to_quaternion(method: str = 'shepperd', **kw) ndarray#

Quaternion from Direction Cosine Matrix.

There are five methods available to obtain a quaternion from a Direction Cosine Matrix:

  • 'chiaverini' as described in [CS99].

  • 'hughes' as described in [Hug86].

  • 'itzhack' as described in [BI00] using version 3 by default. Possible options are integers 1, 2 or 3.

  • 'sarabandi' as described in [ST19] with a threshold equal to 0.0 by default. Possible threshold values are floats between -3.0 and 3.0.

  • 'shepperd' as described in [She78].

Parameters:

method (str, default: 'shepperd') – Method to use. Options are: 'shepperd', 'hughes', 'itzhack', 'sarabandi', and 'chiaverini'.

Examples

>>> R = DCM(rpy=[10.0, -20.0, 30.0])
>>> R.view()
DCM([[ 0.92541658, -0.31879578, -0.20487413],
     [ 0.16317591,  0.82317294, -0.54383814],
     [ 0.34202014,  0.46984631,  0.81379768]])
>>> R.to_quaternion()   # Uses method 'shepperd' by default
array([ 0.15842345,  0.5510871 , -0.40599185,  0.71160076])
>>> R.to_quaternion('shepperd')
array([ 0.15842345,  0.5510871 , -0.40599185,  0.71160076])
>>> R.to_quaternion('hughes')
array([ 0.15842345,  0.5510871 , -0.40599185,  0.71160076])
>>> R.to_quaternion('itzhack', version=2)
array([ 0.15842345,  0.5510871 , -0.40599185,  0.71160076])
>>> R.to_quaternion('sarabandi', threshold=0.5)
array([0.15842345, 0.5510871 , 0.40599185, 0.71160076])