ModelSpace
Documentation for ModelSpace models and classes.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
clockwerk::DCM Class Reference

Class defining a direction cosine matrix inherited from Matrix. More...

#include <DCM.h>

Inheritance diagram for clockwerk::DCM:

Public Member Functions

 DCM ()
 Default constructor generates DCM as an identity matrix. More...
 
 DCM (const floating_point(&initial)[3][3])
 
 DCM (const DCM &initial)
 
 DCM (const std::array< std::array< floating_point, 3 >, 3 > &initial)
 
 ~DCM ()
 
int16 inverse (DCM &result) const
 Function to return the inverse of the matrix. More...
 
DCM inverse () const
 
void rate (const CartesianVector< 3 > &omega_f1_f2__f1, Matrix< 3, 3 > &dcmdot_f1_f2)
 Function to calculate the rate of change in the current representation based on the omega vector. More...
 
int16 toEuler321 (Euler321 &euler_f1_f2) const
 Function to convert current attitude to 321 Euler sequence. More...
 
Euler321 toEuler321 ()
 
int16 toQuaternion (Quaternion &q_f1_f2) const
 Overloaded functions to convert current attitude to quaternion. More...
 
Quaternion toQuaternion ()
 
int16 toMRP (MRP &mrp_f1_f2) const
 Overloaded functions to convert current attitude to MRP. More...
 
MRP toMRP ()
 
- Public Member Functions inherited from clockwerk::Matrix< 3, 3 >
 Matrix ()
 Default constructor to initialize a matrix to all zeroes for ease of use. More...
 
 Matrix (floating_point elements)
 Constructor to initialize a matrix with all the same element. More...
 
 Matrix (const floating_point(&initial)[R][C])
 
 Matrix (const Matrix< R, C > &initial)
 
 Matrix (const std::array< std::array< floating_point, C >, R > &initial)
 Array constructor for the matrix class. Initializes from std::array. More...
 
 ~Matrix ()
 
int16 str (char *output, size_t size) const
 Function to dump information on matrix. More...
 
int16 fromStr (const char *val)
 Set value of matrix from string in same format as str() More...
 
int16 set (uint32 row, uint32 col, const floating_point &value)
 Function to set a single value in the matrix. More...
 
int16 get (uint32 row, uint32 col, floating_point &result) const
 Function to get a single value in the matrix. More...
 
floating_point get (uint32 row, uint32 col) const
 Function to get a single value in the matrix. More...
 
void setFromArray (const floating_point *start_ptr)
 Function to set the values of the matrix row-wise. More...
 
void getAsArray (floating_point *start_ptr) const
 Function to get the values of the matrix row-wise. More...
 
void getCopy (Matrix< R, C > &result) const
 Function to get a copy of the matrix. More...
 
Matrix< R, C > & operator= (const Matrix< R, C > &other)
 Equals operator overload for matrix. More...
 
floating_point * operator[] (uint32 idx)
 Function to return a matrix row or vector value. More...
 
std::pair< uint32, uint32 > size () const
 Function to get the size of the matrix. More...
 
void max (floating_point &result, std::pair< uint32, uint32 > &index) const
 Function to return the maximum value in the matrix. More...
 
void min (floating_point &result, std::pair< uint32, uint32 > &index) const
 Function to return the minimum value in the matrix. More...
 
int16 det (floating_point &result) const
 Function to return the determinant of the matrix. More...
 
int16 inverse (Matrix< R, C > &result) const
 Function to return the inverse of the matrix. More...
 
Matrix< R, C > inverse () const
 
void transpose (Matrix< C, R > &result) const
 Function to return the transpose of the matrix. More...
 
Matrix< C, R > transpose () const
 
int16 trace (floating_point &result) const
 Function to return the trace of the matrix. More...
 
void setToZeros ()
 Function to set all elements of the matrix to zero. More...
 
int16 identity ()
 Function to set matrix to identity, if it is a square matrix. More...
 
int16 eye ()
 

Additional Inherited Members

- Public Attributes inherited from clockwerk::Matrix< 3, 3 >
std::array< std::array< floating_point, C >, R > values
 
- Protected Member Functions inherited from clockwerk::Matrix< 3, 3 >
int16 _checkLookupBoundaries (uint32 start_r, uint32 end_r, uint32 start_c, uint32 end_c) const
 
int16 _LUPDecompose (floating_point *A[R], uint32 P[R+1]) const
 Function to take a 2-d matrix represented by A and decompose it into LU form. More...
 

Detailed Description

Class defining a direction cosine matrix inherited from Matrix.

This file defines a simple DCM attitude representation for cartesian coordinate systems. It is largely the same as the base matrix class, with the following exceptions:

  • Set to be square, 3x3 (that's where it will primarily be used)
  • Default constructor is identity matrix, rather than zeroes
  • Inverse is set to account for orthogonal matrix
  • Functions defined to convert to other attitude
  • Function defined to calculate rate of change as a function of omega

Naming conventions

  • All naming conventions and equations are per Analytical Mechanics of Space Systems by Schaub and Junkins
  • The omega vector is sometimes denoted by w and assumed frame consistent with the attitude representation. For example, if a DCM represents the relative orientation between two frames [BN] the omega vector is assumed to be w_(B/N)
  • The naming convention for all vectors is: variablename_obj1_obj2__frameN (note the double underscore preceding frame) and reads back as: "variable variablename representing the relationship between obj1 and obj2 represented in frameN"
  • Unless otherwise noted angles are in RADIANS NOTE: All attitude representations, including DCMs, are assumed to represent a three dimensional, cartesian coordinate system because that is what they are used, and in many cases defined, for.

Constructor & Destructor Documentation

◆ DCM() [1/4]

clockwerk::DCM::DCM ( )
inline

Default constructor generates DCM as an identity matrix.

◆ DCM() [2/4]

clockwerk::DCM::DCM ( const floating_point(&)  initial[3][3])
inline

Constructor for Matrix class with initialization. Initializes matrix to values passed in via array

◆ DCM() [3/4]

clockwerk::DCM::DCM ( const DCM initial)
inline

Copy constructor for Matrix class. Copies data from matrix object to the current instance

◆ DCM() [4/4]

clockwerk::DCM::DCM ( const std::array< std::array< floating_point, 3 >, 3 > &  initial)
inline

Constructor for Matrix class with initialization. Initializes matrix to values passed in via array

◆ ~DCM()

clockwerk::DCM::~DCM ( )
inline

Destructor – doesn't do anything because we don't dynamically allocate

Member Function Documentation

◆ inverse() [1/2]

DCM clockwerk::DCM::inverse ( ) const
inline

◆ inverse() [2/2]

int16 clockwerk::DCM::inverse ( DCM result) const

Function to return the inverse of the matrix.

Parameters
resultPBR return of matrix inverse
Returns
Integer value corresponding to error codes in clockwerkerrrors.h
Note
Overloaded for value return

◆ rate()

void clockwerk::DCM::rate ( const CartesianVector< 3 > &  omega_f1_f2__f1,
Matrix< 3, 3 > &  dcmdot_f1_f2 
)

Function to calculate the rate of change in the current representation based on the omega vector.


Dynamics and kinematics functions

Parameters
omega_f1_f2__f1Angular velocity vector for the attitude representation - omega of frame 1 wrt frame 2 expressed in frame 1
dcmdot_f1_f2Rate of change in the current DCM

◆ toEuler321() [1/2]

Euler321 clockwerk::DCM::toEuler321 ( )

◆ toEuler321() [2/2]

int16 clockwerk::DCM::toEuler321 ( Euler321 euler_f1_f2) const

Function to convert current attitude to 321 Euler sequence.


Conversions to other attitude representations

Parameters
PBRreturn of 321 Euler sequence in PBR case
Returns
Integer error code corresponding to errors in clockwerkerrors.h
Note
Cannot overload for return by value because conversion isn't guaranteed

◆ toMRP() [1/2]

MRP clockwerk::DCM::toMRP ( )

◆ toMRP() [2/2]

int16 clockwerk::DCM::toMRP ( MRP mrp_f1_f2) const

Overloaded functions to convert current attitude to MRP.

Parameters
PBRreturn of MRP in PBR case
Returns
MRP in return by value case

◆ toQuaternion() [1/2]

Quaternion clockwerk::DCM::toQuaternion ( )

◆ toQuaternion() [2/2]

int16 clockwerk::DCM::toQuaternion ( Quaternion q_f1_f2) const

Overloaded functions to convert current attitude to quaternion.

Parameters
PBRreturn of quaternion in PBR case
Returns
Quaternion in return by value case

The documentation for this class was generated from the following files: