The Euler321 class defined in C++ provides a 3-2-1 Euler angle sequence representation for attitude in Cartesian coordinate systems. It is derived from the CartesianVector class and includes additional functionalities specific to attitude representation.

The Euler321 Class

Description and Naming

The Euler321 class is a templated class with one template argument - T. Euler321<T> produces an Euler321 with three elements of type T. The argument is:

  • T - The type of the Euler321 elements. This should be a floating point type.

The Euler321 class inherits from the CartesianVector class but has additional characteristics:

  • It always has three elements.

  • The default constructor initializes it to zeros.

  • 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 Euler321 class, refer to the Doxygen documentation: Euler321 Doxygen

Creating an Euler321

Description C++ Example Python Example

Default Constructor - Creates an Euler321 initialized to zeros.

Euler321<double> euler1;
euler1 = Euler321()

Constructor with Initial Value - Creates an Euler321 initialized with values from an array.

Euler321<double> euler2({0, 0, 0});
euler2 = Euler321([0, 0, 0])

Constructor with std::array - Creates an Euler321 initialized with values from a std::array.

std::array<double, 3> initial = {0, 0, 0};
Euler321<double> euler3(initial);
initial = [0, 0, 0]
euler3 = Euler321(initial)

Copy Constructor - Creates a new Euler321 as a copy of another Euler321.

Euler321<double> euler4(euler3);
euler4 = euler3

Calculating the Rate of Change

Description C++ Example Python Example

Rate of Change - Calculates the rate of change of the Euler321 based on the angular velocity vector.

CartesianVector<double, 3> omega;
Matrix<double, 3, 1> eulerdot;
euler1.rate(omega, eulerdot);
omega = CartesianVector3D()
eulerdot = Matrix31()
euler1.rate(omega, eulerdot)

Conversions to Other Attitude Representations

Description C++ Example Python Example

Convert to DCM - Converts the Euler321 to a Direction Cosine Matrix (DCM).

DCM<double> dcm;
euler1.toDCM(dcm);
dcm = DCM()
euler1.toDCM(dcm)

Convert to DCM (Return by Value) - Converts and returns the Euler321 as a DCM.

DCM<double> dcm = euler1.toDCM();
dcm = euler1.toDCM()