You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.
Allows all sorts of computations with quaternions. We should look at nalgebra's quite complete implementation of quaternions of this (note however that they use the {i,j,k,w} notation, which is not common in the aerospace industry).
Proposed signatures
This is only available in the algorithms module.
Quaternion definition
/// Defines a quaternion where `w` corresponds to the scalar value sin(Φ/2) and X, Y, Z correspond to the vector part.pubstructQuaternion{pubw:f64,pubx:f64,puby:f64,pubz:f64,}
Conversion to/from a direct cosine matrix
Question: should this function return an error if the provided matrix is not a valid DCM? This can be checked by the following assertion being violated: C*C^T = I_3x3 . However, there are rounding errors where the resulting DCM is not exactly identity.
Recommendation: provide two functions: dcm_to_quat and dcm_to_quat_unchecked where the unchecked does not check that the input DCM is valid. We could also provide both an implementation of TryFrom and From which would respectively use the "checked" and "unchecked" versions of the function. Moreover, providing a From implementation will automatically provide the Into implementation, allowing for infallible conversion from a quaternion to a Matrix3 (cf. docs).
/// Try to convert a 3x3 matrix into a quaternion. Will return an error if the matrix is not a valid direct cosine matriximplTryFrom<&Matrix3<f64>> to Quaterion{typeError = AniseError;}/// The following function is actually called. pubfndcm_to_quat(dcm:&Matrix3<f64>) -> Result<Quaternion,AniseError>{}
Combine rotations
Defines the operation q_A2C = q_A2B + q_B2C . This operation cannot fail.
implAddforQuaternion{}
Inverse rotations
Defines the operation q_A2C = -q_C2A. This operation cannot fail.
implNegforQuaternion{}
Rotate a vector by this quaternion
Defines the rotation of a vector by the provided quaternion such that ^{A}v = q_B2A * ^{B}v , where "^{A}v" means "vector in the A frame"
implMul<Vector3>forQuaternion{}
Extract the principal rotation vector and the rotation angle
Allows all sorts of computations with quaternions. We should look at nalgebra's quite complete implementation of quaternions of this (note however that they use the {i,j,k,w} notation, which is not common in the aerospace industry).
Proposed signatures
This is only available in the algorithms module.
Quaternion definition
Conversion to/from a direct cosine matrix
Question: should this function return an error if the provided matrix is not a valid DCM? This can be checked by the following assertion being violated: C*C^T = I_3x3 . However, there are rounding errors where the resulting DCM is not exactly identity.
Recommendation: provide two functions:
dcm_to_quat
anddcm_to_quat_unchecked
where theunchecked
does not check that the input DCM is valid. We could also provide both an implementation ofTryFrom
andFrom
which would respectively use the "checked" and "unchecked" versions of the function. Moreover, providing aFrom
implementation will automatically provide theInto
implementation, allowing for infallible conversion from a quaternion to a Matrix3 (cf. docs).Combine rotations
Defines the operation q_A2C = q_A2B + q_B2C . This operation cannot fail.
Inverse rotations
Defines the operation q_A2C = -q_C2A. This operation cannot fail.
Rotate a vector by this quaternion
Defines the rotation of a vector by the provided quaternion such that ^{A}v = q_B2A * ^{B}v , where "^{A}v" means "vector in the A frame"
Extract the principal rotation vector and the rotation angle
This can be useful for analysis.
The text was updated successfully, but these errors were encountered: