![]() |
ModelSpace
|
Quaternion class for attitude representation. More...
#include <Quaternion.hpp>
Public Member Functions | |
Quaternion () | |
Default constructor generates Quaternion sequence as zero rotation – 1 0 0 0. | |
Quaternion (const T(&initial)[4]) | |
Constructor for Matrix class with initialization. Initializes matrix to values passed in via array. | |
Quaternion (const Quaternion< T > &initial) | |
Copy constructor for Quaternion class. Copies data from Quaternion object to the current instance. | |
Quaternion (const std::array< T, 4 > &initial) | |
Constructor for Matrix class with initialization. Initializes matrix to values passed in via array. | |
~Quaternion () | |
Destructor – doesn't do anything because we don't dynamically allocate. | |
Quaternion< T > & | operator= (const Quaternion< T > &other) |
Equals operator overload for quaternion. | |
void | rate (const CartesianVector< T, 3 > &omega_f1_f2__f1, Matrix< T, 4, 1 > &quatdot_f1_f2) const |
Function to calculate the rate of change in the current representation based on the omega vector. | |
void | toDCM (DCM< T > &dcm_f1_f2) const |
Function to convert current attitude to DCM. | |
DCM< T > | toDCM () const |
void | toMRP (MRP< T > &mrp_f1_f2) const |
Function to convert current attitude to MRP. | |
MRP< T > | toMRP () const |
int | rotationAngle (double &val) const |
Calculate the rotation angle represented by the quaternion. | |
T & | operator[] (unsigned int idx) |
Function to return a vector value. | |
int | set (const unsigned int &idx, const T &value) |
Setter specific to the vector class. | |
int | set (const unsigned int &row, const unsigned int &col, const T &value) |
Function to set a single value in the matrix. | |
int | get (const unsigned int &idx, T &result) const |
Getter specific to the vector class. | |
T | get (const unsigned int &idx) const |
Getter specific to the vector class. | |
int | get (const unsigned int &row, const unsigned int &col, T &result) const |
Function to get a single value in the matrix. | |
T | get (const unsigned int &row, const unsigned int &col) const |
Function to get a single value in the matrix. | |
int | norm (T &result) const |
Function to take the norm of a vector. | |
T | norm () const |
Function to take the norm of a vector. | |
int | normSquared (T &result) const |
Function to take the squared norm of a vector. | |
T | normSquared () const |
Function to take the squared norm of a vector. | |
int | unit (CartesianVector< T, L > &result) const |
Function to return the unitized version of the vector. | |
int | unitize () |
Function to unitize the current vector. | |
int | normalize () |
Function to unitize the current vector. | |
std::string | str () const |
Function to write out vector as a string. | |
void | dump () const |
Function to dump information on matrix. | |
void | setFromArray (const T *start_ptr) |
Function to set the values of the matrix row-wise. | |
void | getAsArray (T *start_ptr) const |
Function to get the values of the matrix row-wise. | |
void | getCopy (Matrix< T, R, C > &result) const |
Function to get a copy of the matrix. | |
std::pair< unsigned int, unsigned int > | size () |
Function to get the size of the matrix. | |
void | max (T &result, std::pair< unsigned int, unsigned int > &index) const |
Function to return the maximum value in the matrix. | |
void | min (T &result, std::pair< unsigned int, unsigned int > &index) const |
Function to return the minimum value in the matrix. | |
int | det (T &result) const |
Function to return the determinant of the matrix. | |
int | inverse (Matrix< T, R, C > &result) const |
Function to return the inverse of the matrix. | |
Matrix< T, R, C > | inverse () const |
void | transpose (Matrix< T, C, R > &result) const |
Function to return the transpose of the matrix. | |
Matrix< T, C, R > | transpose () const |
int | trace (T &result) const |
Function to return the trace of the matrix. | |
void | setToZeros () |
Function to set all elements of the matrix to zero. | |
int | identity () |
Function to set matrix to identity, if it is a square matrix. | |
int | eye () |
Public Attributes | |
std::array< std::array< T, C >, R > | values |
The actual values held by the matrix – a two dimensional array of values indexed as (row, column). NOTE: Public for ease of access and speed (no need to use setter/getter), and functions in Matrix and Safemath libraries are tested safe. Behavior using matrices outside of clockwerk libraries should use setter/getter, rather than direct access, for safety. | |
Protected Member Functions | |
int | _checkLookupBoundaries (const unsigned int &start_r, const unsigned int &end_r, const unsigned int &start_c, const unsigned int &end_c) const |
Function to check, given a set of submatrix boundaries, that those boundaries are valid for the current matrix. | |
int | _LUPDecompose (T *A[R], unsigned int P[R+1]) const |
Function to take a 2-d matrix represented by A and decompose it into LU form. | |
Quaternion class for attitude representation.
This file defines a simple Quaternion attitude representation for cartesian coordinate systems. It is largely the same as the base vector, with the following exceptions:
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.
|
protectedinherited |
Function to take a 2-d matrix represented by A and decompose it into LU form.
A | A 2-d matrix represented as a double pointer After ops A contains a copy of both matrices L-E and U as A=(L-E)+U such that P*A=L*U. |
P | The permutation matrix to hold info on matrix changes |
|
inherited |
Getter specific to the vector class.
idx | The index to return |
|
inlineinherited |
Getter specific to the vector class.
idx | The index to return |
value | PBR return of the value in the vector |
|
inherited |
Function to get a single value in the matrix.
row | The row index |
col | The column index |
|
inherited |
Function to get a single value in the matrix.
row | The row index |
col | The column index |
value | PBR return of the value in the matrix |
|
inherited |
Function to get the values of the matrix row-wise.
start_ptr | The data address at which write should begin. |
Function to get a copy of the matrix.
result | PBR return of a copy of this matrix |
|
inherited |
Function to set matrix to identity, if it is a square matrix.
Function to return the inverse of the matrix.
result | PBR return of matrix inverse |
|
inherited |
Function to return the maximum value in the matrix.
result | PBR return of maximum value |
|
inherited |
Function to return the minimum value in the matrix.
result | PBR return of minimum value |
|
inlineinherited |
Function to take the norm of a vector.
|
inherited |
Function to take the norm of a vector.
result | PBR return of the norm operation |
|
inherited |
Function to unitize the current vector.
|
inlineinherited |
Function to take the squared norm of a vector.
|
inherited |
Function to take the squared norm of a vector.
result | PBR return of the norm^2 operation |
|
inherited |
Function to return a vector value.
idx | The index to return |
void clockwerk::Quaternion< T >::rate | ( | const CartesianVector< T, 3 > & | omega_f1_f2__f1, |
Matrix< T, 4, 1 > & | quatdot_f1_f2 | ||
) | const |
Function to calculate the rate of change in the current representation based on the omega vector.
omega_f1_f2__f1 | Angular velocity vector for the attitude representation - omega of frame 1 wrt frame 2 expressed in frame 1 |
quatdot_f1_f2 | Rate of change in the current Quaternion |
Calculate the rotation angle represented by the quaternion.
val | Implicit return of rotation angle |
|
inlineinherited |
Setter specific to the vector class.
idx | Vector element to set |
value | The value to set the element to |
Function to set the values of the matrix row-wise.
start_ptr | The data address at which read should begin. |
|
inherited |
Function to write out vector as a string.
Function to convert current attitude to DCM.
PBR | return of DCM in PBR case |
Function to convert current attitude to MRP.
PBR | return of MRP in PBR case |
|
inherited |
Function to return the trace of the matrix.
result | PBR return of matrix trace |
Function to return the transpose of the matrix.
result | PBR return of matrix transpose |
|
inherited |
Function to return the unitized version of the vector.
result | PBR return of the unit vector |
|
inherited |
Function to unitize the current vector.