All attitude representations are based on Analytical Mechanics of Space Systems, 4th Edition by Schaub and Junkins. That text, in addition to being excellent in its own right, is recommended as a guide to fully understand the attitude math implemented in ModelSpace.

Documentation on Individual Attitude Representations

ModelSpace includes four attitude representations — DCM, Quaternion, Euler321, and MRP. Each representation is derived from the Matrix and/or CartesianVector classes. Documentation on each individual representation is included here:

More information on attitude math operations is provided below.

Attitude Math Functions

Description and Naming

The quaternion math functions operate on attitude representations (DCM, Quaternion, Euler321, and MRP) and follow a consistent naming convention:

  • Capital letters represent matrices.

  • Lowercase letters represent scalars.

  • Vectors are treated as 1-dimensional matrices.

  • Pass-by-reference return values are all named result.

  • The letter used in the function indicates the order of operations (e.g., A/a comes first, then B/b).

The attitude math functions are operator overloaded to provide a convenient method for rotating vectors into different frames. Simply multiplying an attitude representation by a vector will automatically rotate it. For non-DCM attitude representations, an implicit cast to DCM is used to rotate the vector.

Attitude representation follows the Schaub naming convention in Analytical Mechanics of Space Systems, 4th Edition, where DCM [AB] represents the orientation of frame A with respect to frame B. A vector represented in frame B can be rotated into frame A by multiplication — vector_in_a = vector_in_b. Similarly, in ModelSpace, quaternions, MRPs, and Euler angles defined as quat_a_b (and so forth) are the attitude representation of the orientation of *A relative to B. For convenience, all ModelSpace attitude representations can be multiplied directly by vectors to rotate them. For example, vector_in_a = quat_a_b*vector_in_b.

If the above sounded unfamiliar to the reader, ATTX highly recommends the excellent (and short) paper provided by Dr. Schaub here: Attitude Kinematics and Dynamics Reference

For a complete guide on interacting with the quaternion math functions, refer to the Doxygen documentation: Quaternion Math Functions Doxygen

Multiplying Attitude Representations

Description C++ Example Python Example

Multiplying Two DCMs - Multiplies two DCMs and returns the result. This is useful for chaining attitude representations

DCM<double> A({{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}})
DCM<double> B({{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}})
DCM<double> result = A * B;
# Python equivalent not yet implemented

Multiplying Two Quaternions - Multiplies two Quaternions and returns the result. This is useful for chaining attitude representations. Implicitly converts to DCM to handle the rotation

Quaternion<double> a({1.0, 0.0, 0.0, 0.0})
Quaternion<double> b({1.0, 0.0, 0.0, 0.0})
Quaternion<double> result = a * b;
# Python equivalent not yet implemented

Multiplying Two Euler321s - Multiplies two Euler321s and returns the result. This is useful for chaining attitude representations. Implicitly converts to DCM to handle the rotation

Euler321<double> a({0.0, 0.0, 0.0})
Euler321<double> b({0.0, 0.0, 0.0})
Euler321<double> result = a * b;
# Python equivalent not yet implemented

Multiplying Two MRPs - Multiplies two MRPs and returns the result. This is useful for chaining attitude representations. Implicitly converts to DCM to handle the rotation

MRP<double> a({0.0, 0.0, 0.0})
MRP<double> b({0.0, 0.0, 0.0})
MRP<double> result = a * b;
# Python equivalent not yet implemented

Rotating a Vector via DCM - Rotates a vector using a DCM and returns the result.

DCM<double> A({{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}})
CartesianVector<double, 3> b({0.0, 0.0, 0.0});
CartesianVector<double, 3> result = A*b;
# Python equivalent not yet implemented

Rotating a Vector via Quaternion - Rotates a vector using a Quaternion and returns the result.

Quaternion<double> a({1.0, 0.0, 0.0, 0.0});
CartesianVector<double, 3> b({0.0, 0.0, 0.0});
CartesianVector<double, 3> result = a * b;
# Python equivalent not yet implemented

Rotating a Vector via Euler321 - Rotates a vector using Euler321 and returns the result.

Euler321<double> a({0.0, 0.0, 0.0});
CartesianVector<double, 3> b({0.0, 0.0, 0.0});
CartesianVector<double, 3> result = a * b;
# Python equivalent not yet implemented

Rotating a Vector via MRP - Rotates a vector using an MRP and returns the result.

MRP<double> a({0.0, 0.0, 0.0});
CartesianVector<double, 3> b({0.0, 0.0, 0.0});
CartesianVector<double, 3> result = a * b;
# Python equivalent not yet implemented