functionfrom_T

Return quaternion orientation object Q from transformation matrix T

Extends from Modelica.Icons.Function (Icon for functions).

Information

Syntax

Q = Quaternions.from_T(T, Q_guess);

Description

This function returns a quaternions orientation Q. computed from a transformation matrix T and depending on the initial guess Q_guess. Generally, the transformation matrix T can be gained using a function from the TransformationMatrices package.

See also

to_T. from_T_inv, Frames.from_T, TransformationMatrices.from_T.

Inputs

TypeNameDefaultDescription
Real[3,3]TTransformation matrix to transform vector from frame 1 to frame 2 (v2=T*v1)
Quaternions.OrientationQ_guessnullRotation()Guess value for Q (there are 2 solutions; the one close to Q_guess is used

Outputs

TypeNameDefaultDescription
Quaternions.OrientationQQuaternions orientation object to rotate frame 1 into frame 2 (Q and -Q have same transformation matrix)

Revisions

  • January 2021 by Jakub Tobolar
    reimplemented for more efficient and numerically stable algorithm according to https://d3cw3dd2w32x2b.cloudfront.net/wp-content/uploads/2015/01/matrix-to-quat.pdf. It compares only one particular diagonal element with another to select one of the four code parts. Then, the selected code delivers four components which are close to the desired quaternion, so that it has only be scaled by an appropriate factor.
    We appreciate the effort of Mike Day, the author of the abovementioned document. Credit also goes to Matthias Hellerer (DLR) for making inquiries and the first Modelica implementation.