The Quaternion class defined in C++ provides a quaternion representation for attitude in Cartesian coordinate systems. It is derived from the CartesianVector class and includes additional functionalities specific to attitude representation.
The Quaternion Class
Description and Naming
The Quaternion class is a templated class with one template argument - T.
Quaternion<T>
produces a quaternion with four elements of type T.
The argument is:
-
T - The type of the quaternion elements. This should be a floating point type.
The Quaternion class inherits from the CartesianVector class but has additional characteristics:
-
It always has four elements.
-
The default constructor initializes it to represent zero rotation (1, 0, 0, 0).
-
It includes functions to convert to other attitude representations and calculate the rate of change based on angular velocity.
For a complete guide on interacting with the Quaternion class, refer to the Doxygen documentation: Quaternion Doxygen
Creating a Quaternion
Description | C++ Example | Python Example |
---|---|---|
Default Constructor - Creates a quaternion representing zero rotation. |
|
|
Constructor with Initial Value - Creates a quaternion initialized with values from an initializer list. |
|
|
Constructor with std::array - Creates a quaternion initialized with values from a std::array. |
|
|
Copy Constructor - Creates a new quaternion as a copy of another quaternion. |
|
|
Assignment Operator - Assigns values from one quaternion to another. |
|
|
Calculating the Rate of Change
Description | C++ Example | Python Example |
---|---|---|
Rate of Change - Calculates the rate of change of the quaternion based on the angular velocity vector. |
|
|
Conversions to Other Attitude Representations
Description | C++ Example | Python Example |
---|---|---|
Convert to DCM - Converts the quaternion to a Direction Cosine Matrix (DCM). |
|
|
Convert to DCM (Return by Value) - Converts and returns the quaternion as a DCM. |
|
|
Convert to MRP - Converts the quaternion to a Modified Rodrigues Parameter (MRP). |
|
|
Convert to MRP (Return by Value) - Converts and returns the quaternion as a MRP. |
|
|