COSMOS core
1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
|
Classes | |
class | LsFit |
Functions | |
double | gaussian_random (double mean, double stdev) |
Normal Distribution random number. More... | |
quaternion | q_drotate_between_rv (rvector from, rvector to) |
Create rotation quaternion from 2 row vectors. More... | |
quaternion | q_change_around_rv (rvector around, double angle) |
Create rotation quaternion from row vector axis and angle. More... | |
quaternion | q_irotate_for (rvector sourcea, rvector sourceb, rvector targeta, rvector targetb) |
Create irotate quaternion from two orthogonal vectors. More... | |
rvector | rv_quaternion2axis (quaternion q) |
Quaternion to row vector axis and angle. More... | |
rmatrix | rm_quaternion2dcm (quaternion q) |
Quaternion to row matrix Direction Cosine Matrix. More... | |
quaternion | q_axis2quaternion_rv (rvector v) |
Row vector axis and angle to Quaternion. More... | |
double | distance_rv (rvector p0, rvector p1, rvector p2) |
Distance from a line. More... | |
double | area_rv (rvector p0, rvector p1, rvector p2) |
Area of a triangle. More... | |
rvector | rv_normalto (rvector p0, rvector p1, rvector p2) |
Normal to a polygon. More... | |
ByteOrder | local_byte_order () |
Determine local byte order. More... | |
uint16_t | uint16from (uint8_t *pointer, ByteOrder order) |
Memory to 16 bit unsigned integer. More... | |
int16_t | int16from (uint8_t *pointer, ByteOrder order) |
Memory to 16 bit signed integer. More... | |
uint32_t | uint32from (uint8_t *pointer, ByteOrder order) |
Memory to 32 bit unsigned integer. More... | |
int32_t | int32from (uint8_t *pointer, ByteOrder order) |
Memory to 32 bit signed integer. More... | |
float | floatfrom (uint8_t *pointer, ByteOrder order) |
Memory to 32 bit float. More... | |
double | doublefrom (uint8_t *pointer, ByteOrder order) |
Memory to 64 bit float. More... | |
void | uint32to (uint32_t value, uint8_t *pointer, ByteOrder order) |
32 bit unsigned integer to memory More... | |
void | int32to (int32_t value, uint8_t *pointer, ByteOrder order) |
32 bit signed integer to memory More... | |
void | uint16to (uint16_t value, uint8_t *pointer, ByteOrder order) |
16 bit unsigned integer to memory More... | |
void | int16to (int16_t value, uint8_t *pointer, ByteOrder order) |
16 bit signed integer to memory More... | |
void | floatto (float value, uint8_t *pointer, ByteOrder order) |
32 bit floating point to memory More... | |
void | doubleto (double value, uint8_t *pointer, ByteOrder order) |
64 bit floating point to memory More... | |
void | open_estimate (estimatorhandle *estimate, uint32_t size, uint32_t degree) |
Initialize estimator. More... | |
int16_t | set_estimate (estimatorhandle *estimate, double independent, double dependent) |
Set estimator. More... | |
estimatorstruc | get_estimate (estimatorhandle *estimate, double x) |
Get estimate. More... | |
void | multisolve (vector< vector< double > > x, vector< double > y, vector< double > &a) |
Perform N equation solution. More... | |
double | evaluate_poly (double x, vector< double > parms) |
Evaluate polynomial. More... | |
double | evaluate_poly_slope (double x, vector< double > parms) |
Evaluate polynomial slope. More... | |
double | evaluate_poly_accel (double x, vector< double > parms) |
Evaluate polynomial acceleration. More... | |
double | evaluate_poly_jerk (double x, vector< double > parms) |
Evaluate polynomial jerk. More... | |
rvector | rv_evaluate_poly (double x, vector< vector< double > > parms) |
Evaluate vector polynomial. More... | |
rvector | rv_evaluate_poly_slope (double x, vector< vector< double > > parms) |
Evaluate vector polynomial slope. More... | |
rvector | rv_evaluate_poly_accel (double x, vector< vector< double > > parms) |
Evaluate vector polynomial acceleration. More... | |
rvector | rv_evaluate_poly_jerk (double x, vector< vector< double > > parms) |
Evaluate vector polynomial jerk. More... | |
gvector | gv_evaluate_poly (double x, vector< vector< double > > parms) |
Evaluate vector polynomial. More... | |
gvector | gv_evaluate_poly_slope (double x, vector< vector< double > > parms) |
Evaluate vector polynomial slope. More... | |
gvector | gv_evaluate_poly_accel (double x, vector< vector< double > > parms) |
Evaluate vector polynomial acceleration. More... | |
gvector | gv_evaluate_poly_jerk (double x, vector< vector< double > > parms) |
Evaluate vector polynomial jerk. More... | |
quaternion | q_evaluate_poly (double x, vector< vector< double > > parms) |
Evaluate quaternion polynomial. More... | |
quaternion | q_evaluate_poly_slope (double x, vector< vector< double > > parms) |
Evaluate quaternion polynomial slope. More... | |
quaternion | q_evaluate_poly_accel (double x, vector< vector< double > > parms) |
Evaluate quaternion polynomial acceleration. More... | |
quaternion | q_evaluate_poly_jerk (double x, vector< vector< double > > parms) |
Evaluate quaternion polynomial jerk. More... | |
vector< double > | polyfit (vector< double > &x, vector< double > &y) |
Perform general order polynomial fit. More... | |
uvector | rv_fitpoly (uvector x, uvector y, uint32_t order) |
Perform nth order polynomial fit. More... | |
gj_kernel * | gauss_jackson_kernel (int32_t order, double dvi) |
Create Gauss-Jackson Integration Kernel. More... | |
void | gauss_jackson_dekernel (gj_kernel *gjk) |
Free Gauss-Jackson Integration Kernel. More... | |
gj_instance * | gauss_jackson_instance (gj_kernel *kern, int32_t axes, void(*calc_vd2)(double vi, double *vd0, double *vd2, int32_t axes)) |
Initialize an Instance of a Gauss-Jackson Integrator. More... | |
gj_step * | gauss_jackson_step (gj_kernel *kern) |
Initialize a Step of a Gauss-Jackson integrator. More... | |
void | gauss_jackson_destep (gj_kernel *kern, gj_step *step) |
Destroy a Step of a Gauss-Jackson integrator. More... | |
int | gauss_jackson_setstep (gj_instance *gji, double vi, double *vd0, double *vd1, double *vd2, int32_t istep) |
Set Independent and Dependent variables for Gauss-Jackson step. More... | |
int | gauss_jackson_getstep (gj_instance *gji, double *vi, double *vd0, double *vd1, double *vd2, int32_t istep) |
Get Independent and Dependent variables for Gauss-Jackson step. More... | |
void | gauss_jackson_preset (gj_instance *gji) |
Converge all axes of a Gauss-Jackson integrator prior to propagation. More... | |
void | gauss_jackson_extrapolate (gj_instance *gji, double target) |
Propagate Gauss-Jackson integration. More... | |
double | fixangle (double angle) |
Limit angle to range 0-2PI. More... | |
double | actan (double y, double x) |
ArcTan, limited to range 0-2PI. More... | |
double | fixprecision (double number, double prec) |
Limit precision. More... | |
uint16_t | calc_crc16ccitt (uint8_t *buf, int size, bool lsb) |
Calculate CRC-16-CCITT. More... | |
rvector | drotate (quaternion q, rvector v) |
Rotate a row vector using a quaternion. More... | |
rvector | rotate_q (quaternion q, rvector v) |
cvector | drotate (quaternion q, cvector v) |
Rotate a cartesian vector using a quaternion. More... | |
cvector | rotate_q (quaternion q, cvector v) |
rvector | irotate (quaternion q, rvector v) |
Indirectly rotate a row vector using a quaternion. More... | |
rvector | transform_q (quaternion q, rvector v) |
cvector | irotate (quaternion q, cvector v) |
Indirectly rotate a cartesian vector using a quaternion. More... | |
quaternion | q_change_between_cv (cvector from, cvector to) |
Create rotation quaternion from 2 vectors. More... | |
quaternion | q_change_between_rv (rvector from, rvector to) |
cmatrix | cm_change_between_cv (cvector from, cvector to) |
Create rotation matrix from 2 vectors. More... | |
double | evaluate_poly (double x, rvector parms) |
double | evaluate_poly_slope (double x, rvector parms) |
double | evaluate_poly_accel (double x, rvector parms) |
double | evaluate_poly_jerk (double x, rvector parms) |
uint16_t | calc_crc16ccitt_lsb (vector< uint8_t >buf) |
uint16_t | calc_crc16ccitt_msb (vector< uint8_t >buf) |
rvector | rv_mmult (rmatrix m, rvector v) |
Multiply rmatrix by rvector. More... | |
rvector | operator* (rmatrix m, rvector v) |
rvector | rv_diag (rmatrix a) |
Matrix diagonal. More... | |
cvector | cv_mmult (cmatrix m, cvector v) |
Multiply cartesian vector by cartesian matrix. More... | |
rmatrix | rm_diag (rvector a) |
Diagonal rmatrix Creates an rmatrix whose diagonal is filled with the supplied rvector. More... | |
rmatrix | rm_eye () |
Identity rmatrix. More... | |
rmatrix | rm_zero () |
Zero filled rmatrix. More... | |
double | norm_rm (rmatrix mat) |
rmatrix norm. Calculates the Norm of the supplied rmatrix More... | |
double | trace_rm (rmatrix mat) |
rmatrix Trace Calculates the trace of the supplied rmatrix. More... | |
rmatrix | rm_transpose (rmatrix a) |
rmatrix Transpose. Calculate the transpose of the supplied rmatrix. More... | |
rmatrix | rm_mmult (rmatrix a, rmatrix b) |
rmatrix Matrix Product More... | |
rmatrix | rm_mult (rmatrix a, rmatrix b) |
Element-wise rmatrix multiplication. More... | |
rmatrix | rm_smult (double a, rmatrix b) |
Scalar rmatrix multiplication. More... | |
rmatrix | rm_add (rmatrix a, rmatrix b) |
rmatrix addition. Sum of two rmatrix values. More... | |
rmatrix | rm_sub (rmatrix a, rmatrix b) |
rmatrix subtraction. Subtract two rmatrix values. More... | |
rmatrix | rm_square (rmatrix a) |
Square rmatrix. More... | |
rmatrix | rm_change_around_x (double angle) |
Rotation matrix for X axis. More... | |
rmatrix | rm_change_around_y (double angle) |
Rotation matrix for Y axis. More... | |
rmatrix | rm_change_around_z (double angle) |
Rotation matrix for Z axis. More... | |
rmatrix | rm_change_around (int axis, double angle) |
Rotation matrix for indicated axis. More... | |
cmatrix | cm_from_rm (rmatrix matrix) |
cmatrix from rmatrix More... | |
cmatrix | cm_diag (cvector a) |
Diagonal cmatrix Creates an cmatrix whose diagonal is filled with the supplied cvector. More... | |
cmatrix | cm_eye () |
Identity cmatrix. More... | |
cmatrix | cm_zero () |
Zero filled cmatrix. More... | |
double | norm_cm (cmatrix mat) |
cmatrix norm. Calculates the Norm of the supplied cmatrix More... | |
double | trace_cm (cmatrix mat) |
cmatrix Trace Calculates the trace of the supplied cmatrix. More... | |
cmatrix | cm_transpose (cmatrix a) |
cmatrix Transpose. Calculate the transpose of the supplied cmatrix. More... | |
cvector | cv_diag (cmatrix a) |
Matrix diagonal. More... | |
cmatrix | cm_mmult (cmatrix a, cmatrix b) |
cmatrix Matrix Product More... | |
cmatrix | cm_mult (cmatrix a, cmatrix b) |
Element-wise cmatrix multiplication. More... | |
cmatrix | cm_smult (double a, cmatrix b) |
Scalar cmatrix multiplication. More... | |
cmatrix | cm_add (cmatrix a, cmatrix b) |
cmatrix addition. Sum of two cmatrix values. More... | |
cmatrix | cm_sub (cmatrix a, cmatrix b) |
cmatrix subtraction. Subtract two cmatrix values. More... | |
cmatrix | cm_square (cmatrix a) |
Square cmatrix. More... | |
cmatrix | cm_change_around_x (double angle) |
Rotation matrix for X axis. More... | |
cmatrix | cm_change_around_y (double angle) |
Rotation matrix for Y axis. More... | |
cmatrix | cm_change_around_z (double angle) |
Rotation matrix for Z axis. More... | |
cmatrix | cm_change_around (int axis, double angle) |
Rotation matrix for indicated axis. More... | |
rmatrix | rm_from_cm (cmatrix matrix) |
rmatrix from cmatrix More... | |
rmatrix | rm_from_rv (rvector vector, int direction) |
rvector to rmatrix. More... | |
rmatrix | rm_skew (rvector row) |
Create skew symmetric rmatrix from rvector. More... | |
rvector | rv_unskew (rmatrix matrix) |
Unskew 3x3 row matrix. More... | |
rmatrix | rm_inverse (rmatrix m) |
Inverse of rmatrix. More... | |
rmatrix | rm_from_m2 (matrix2d matrix) |
rmatrix from matrix2d More... | |
double | determinant_rm (rmatrix m) |
Determinant of row column matrix. More... | |
matrix1d | m1_zero (uint16_t cols) |
Fill 1D matrix with zeros. More... | |
matrix1d | m1_smult (double number, matrix1d row) |
Multiply 1D matrix by a scalar. More... | |
matrix1d | m1_add (matrix1d row1, matrix1d row2) |
Add one 1D matrix to another. More... | |
matrix1d | m1_sub (matrix1d row1, matrix1d row2) |
Subtract one 1D matrix from another. More... | |
matrix1d | m1_mmult (matrix2d Matrix, matrix1d Vector) |
Multiply matrix1d by matrix2d. More... | |
matrix1d | m1_cross (matrix1d Vector1, matrix1d Vector2) |
matrix1d cross product More... | |
double | m1_dot (matrix1d a, matrix1d b) |
matrix1d dot product More... | |
matrix2d | m2_skew (matrix1d row) |
Create skew symmetric matrix2d from matrix1d. More... | |
matrix2d | m2_diag (matrix1d row) |
Create diagonal matrix2d from matrix1d. More... | |
matrix2d | m2_inverse (matrix2d m) |
Inverse of matrix2d. More... | |
double | m2_determinant (matrix2d m) |
Determinant of a 2D matrix. More... | |
double | m1_norm (matrix1d row) |
Compute the Euclidean norm of a 1D matrix. More... | |
matrix2d | m2_zero (uint16_t rows, uint16_t cols) |
Create 2D zero matrix. More... | |
matrix2d | m2_eye (uint16_t rows) |
Create 2D identity matrix. More... | |
matrix2d | m2_smult (double number, matrix2d matrix) |
Multiply 2D matrix by a scalar. More... | |
matrix2d | m2_add (matrix2d matrix1, matrix2d matrix2) |
Add one matrix2d to another. More... | |
matrix2d | m2_sub (matrix2d matrix1, matrix2d matrix2) |
Subtract one matrix2d from another. More... | |
matrix2d | m2_transpose (matrix2d matrix) |
Return transpose of a 2D matrix. More... | |
matrix1d | m2_unskew (matrix2d matrix) |
Unskew 3x3 2D matrix. More... | |
double | m2_trace (matrix2d matrix) |
Calculate the trace of a 2D matrix. More... | |
matrix2d | m2_mmult (matrix2d matrix1, matrix2d matrix2) |
Matrix product. More... | |
matrix2d | m2_from_rm (rmatrix matrix) |
rmatrix from rmatrix More... | |
matrix2d | cm3x3_to_m2 (cmatrix matrix) |
matrix1d | cv_to_m1 (cvector vector) |
matrix2d | cv_to_m2 (cvector vector, int direction) |
matrix2d | m1_to_m2 (matrix1d vector, int direction) |
Matrix1d to matrix2d. More... | |
matrix1d | m2_eig2x2 (matrix2d matrix) |
Eigen values of a 2x2 square matrix. More... | |
double | m2_snorm2x2 (matrix2d matrix) |
Spectral norm of a 2x2 matrix. More... | |
cmatrix | cm_quaternion2dcm (quaternion q) |
quaternion | q_dcm2quaternion_cm (cmatrix dcm) |
Direction Cosine Matrix to Quaternion. More... | |
rmatrix | rm_change_between_rv (rvector from, rvector to) |
Create rotation matrix from 2 row vectors. More... | |
quaternion | q_dcm2quaternion_rm (rmatrix m) |
Row matrix DCM to Quaternion. More... | |
double | sep_rv (rvector v1, rvector v2) |
Angular separation between row vectors. More... | |
svector | s_convert (rvector from) |
Convert rvector to svector. More... | |
rvector | rv_convert (svector from) |
Convert svector to rvector. More... | |
rvector | rv_zero () |
Zero row order vector. More... | |
rvector | rv_unitx (double scale) |
Scaled x row vector. More... | |
rvector | rv_unity (double scale) |
Scaled y row vector. More... | |
rvector | rv_unitz (double scale) |
Scaled z row vector. More... | |
rvector | rv_one () |
Row vector of ones. More... | |
rvector | rv_one (double x, double y, double z) |
Row vector of values. More... | |
rvector | rv_shortest (rvector v) |
Shortest vector. More... | |
rvector | rv_shortest2 (rvector v) |
rvector | rv_normal (rvector v) |
Normalize row order vector. More... | |
void | normalize_rv (rvector &v) |
Normalize row order vector in place. More... | |
double | normVector3 (double x, double y, double z) |
basic function to compute the L2 norm of a 3d generic vector with separate entries More... | |
void | normalizeVector3 (double &x, double &y, double &z) |
basic function to normalize any 3d vector with separate entries More... | |
rvector | rv_smult (double a, rvector b) |
Multiply row vector by scalar. More... | |
rvector | rv_sadd (double a, rvector b) |
Add scalar to each element of vector. More... | |
rvector | rv_add (rvector a, rvector b) |
Add two row vectors. More... | |
rvector | rv_sub (rvector a, rvector b) |
Subtract two vectors. More... | |
rvector | rv_div (rvector a, rvector b) |
Divide two row vectors. More... | |
rvector | rv_mult (rvector a, rvector b) |
Multiply two row vectors. More... | |
rvector | rv_cross (rvector a, rvector b) |
Take cross product of two row vectors. More... | |
double | dot_rv (rvector a, rvector b) |
Dot product of two row vectors. More... | |
double | sep_cv (cvector v1, cvector v2) |
Angular separation between vectors. More... | |
cvector | cv_zero () |
Zero cartesian vector. More... | |
cvector | cv_unitx () |
Unit x vector. More... | |
cvector | cv_unity () |
Unit y vector. More... | |
cvector | cv_unitz () |
Unit z vector. More... | |
cvector | cv_one () |
Vector of ones. More... | |
cvector | cv_normal (cvector v) |
Normalize cartesian vector. More... | |
void | normalize_cv (cvector &v) |
Normalize cartesian vector in place, i.e. divides it by its own norm. More... | |
cvector | cv_smult (double a, cvector b) |
Multiply vector by scalar. More... | |
cvector | cv_sadd (double a, cvector b) |
Add scalar to each element of vector. More... | |
cvector | cv_add (cvector a, cvector b) |
Add two vectors. More... | |
cvector | cv_sub (cvector a, cvector b) |
Subtract two vectors. More... | |
cvector | cv_div (cvector a, cvector b) |
Divide two vectors. More... | |
cvector | cv_mult (cvector a, cvector b) |
Multiply two vectors. More... | |
cvector | cv_cross (cvector a, cvector b) |
Take cross product of two vectors. More... | |
double | dot_cv (cvector a, cvector b) |
double | length_cv (cvector v) |
double | cv_norm (cvector v) |
double | norm_cv (cvector v) |
double | sum_cv (cvector vec) |
cvector | cv_sqrt (cvector a) |
bool | equal_rv (rvector v1, rvector v2) |
Boolean equate of row vetor. More... | |
double | length_rv (rvector v) |
Length of row vector. More... | |
double | norm_rv (rvector vec) |
Infinite norm of row vector. More... | |
double | sum_rv (rvector vec) |
Sum elements of a row vector. More... | |
rvector | rv_sqrt (rvector vec) |
Row vector square root. More... | |
LsFit::LsFit (uint16_t cnt=10, uint16_t ord=2) | |
Multi element, variable order least squares fit. More... | |
void | LsFit::initialize (uint16_t cnt=10, uint16_t ord=2) |
Initialize Least Squares Fit. More... | |
void | LsFit::update (double x, double y) |
Update scalar Least Squares Fit. More... | |
void | LsFit::update (double x, rvector y) |
Update rvector Least Squares Fit. More... | |
void | LsFit::update (double x, gvector y) |
Update gvector Least Squares Fit. More... | |
void | LsFit::update (double x, quaternion y) |
Update quaternion Least Squares Fit. More... | |
void | LsFit::update (fitelement cfit, uint16_t dep) |
Update generic Least Squares Fit. More... | |
void | LsFit::fit () |
Calculate least squares fit. More... | |
double | LsFit::lastx () |
Least squares last independent value. More... | |
double | LsFit::firstx () |
Least squares first independent value. More... | |
size_t | LsFit::size () |
Least squares number of values. More... | |
double | LsFit::eval (double x) |
Least squares dependent scalar value. More... | |
rvector | LsFit::evalrvector (double x) |
Least squares dependent rvector value. More... | |
gvector | LsFit::evalgvector (double x) |
Least squares dependent gvector value. More... | |
quaternion | LsFit::evalquaternion (double x) |
Least squares dependent quaternion value. More... | |
double | LsFit::slope (double x) |
Least squares dependent scalar 1st derivative. More... | |
rvector | LsFit::slopervector (double x) |
Least squares dependent rvector 1st derivative. More... | |
gvector | LsFit::slopegvector (double x) |
Least squares dependent gvector 1st derivative. More... | |
quaternion | LsFit::slopequaternion (double x) |
Least squares dependent quaternion 1st derivative. More... | |
double | LsFit::accel (double x) |
Least squares dependent scalar 2nd derivative. More... | |
rvector | LsFit::accelrvector (double x) |
Least squares dependent rvector 2nd derivative. More... | |
gvector | LsFit::accelgvector (double x) |
Least squares dependent gvector 2nd derivative. More... | |
quaternion | LsFit::accelquaternion (double x) |
Least squares dependent quaternion 2nd derivative. More... | |
double | LsFit::jerk (double x) |
Least squares dependent scalar 3rd derivative. More... | |
rvector | LsFit::jerkrvector (double x) |
Least squares dependent rvector 3rd derivative. More... | |
gvector | LsFit::jerkgvector (double x) |
Least squares dependent gvector 3rd derivative. More... | |
quaternion | LsFit::jerkquaternion (double x) |
Least squares dependent quaternion 3rd derivative. More... | |
vector< vector< double > > | LsFit::getparms () |
Least Squares parameters. More... | |
double | LsFit::getbasex () |
Least Squares base. More... | |
double | DCM::dotProduct (cvector a, cvector b) |
cmatrix | DCM::transposeMatrix (cmatrix a) |
cmatrix | DCM::base2_from_base1 (basisOrthonormal base2, basisOrthonormal base1) |
cmatrix | DCM::base1_from_base2 (basisOrthonormal base1, basisOrthonormal base2) |
void | basisOrthonormal::normalize () |
void | cvector::normalize (double scale=1.) |
Normalize cartesian vector in place, i.e. divides it by its own norm. More... | |
cvector | cvector::normalized (double scale=1.) |
Normalize cartesian vector. More... | |
double | cvector::norm2 () |
double | cvector::norm () |
double | cvector::length () |
double & | cvector::operator[] (const int index) |
Index into cvector. More... | |
double gaussian_random | ( | double | mean, |
double | stdev | ||
) |
Normal Distribution random number.
Random number generated using the Central Value Theorem to approximate a Gaussian distribution. Twelve random numbers between -1 and 1 are averaged to approximate the final random number. This will come from a distribution whose mean is 0 and variance is .5. The desired input parameters are then used to scale the output.
mean | Desired central value of the gaussian. |
stdev | Desired Standard Deviation of the gaussian. |
quaternion q_drotate_between_rv | ( | rvector | from, |
rvector | to | ||
) |
Create rotation quaternion from 2 row vectors.
Generate the quaternion that represents a direct rotation from one row order vector to a second row order vector.
from | initial row order vector |
to | final row order vector |
quaternion q_change_around_rv | ( | rvector | around, |
double | angle | ||
) |
Create rotation quaternion from row vector axis and angle.
Generate the quaternion that represents a rotation of the specified angle around the specified row vector axis.
around | row order vector around which the rotation will occur |
angle | amount of rotation in radians |
quaternion q_irotate_for | ( | rvector | sourcea, |
rvector | sourceb, | ||
rvector | targeta, | ||
rvector | targetb | ||
) |
Create irotate quaternion from two orthogonal vectors.
Using two vectors, represented in both the original and target frames, calculate the quaternion that will irotate any vector from the original to the target frame.
sourcea | First vector in source frame |
sourceb | Second vector in source frame |
targeta | First vector in target frame |
targetb | Second vector in target frame |
rvector rv_quaternion2axis | ( | quaternion | q | ) |
Quaternion to row vector axis and angle.
Convert rotation quaternion to a directional vector in row order form the length of which represents the angle of rotation in radians.
q | Quaternion to be converted. |
rmatrix rm_quaternion2dcm | ( | quaternion | q | ) |
Quaternion to row matrix Direction Cosine Matrix.
Convert rotation quaternion to an equivalent direction cosine matrix in row matrix form.
q | Quaternion representing rotation. |
quaternion q_axis2quaternion_rv | ( | rvector | v | ) |
Row vector axis and angle to Quaternion.
Convert axis and angle orientation represented as row vector to a rotation Quaternion.
v | Row vector axis and angle. |
Distance from a line.
Calculates the distance of a third point from a line defined be two points.
p0 | Point not on line. |
p1 | First point defining line. |
p2 | Second point defining line. |
Area of a triangle.
Calculates the area of a triangle defined by three points.
p0 | First point defining triangle. |
p1 | Second point defining triangle. |
p2 | Third point defining triangle. |
Normal to a polygon.
Calculate the normal vector to a polygon that contains at least three sequential vertices.
p0 | First point defining polygon. |
p1 | Second point defining polygon. |
p2 | Third point defining polygon. |
ByteOrder local_byte_order | ( | ) |
Determine local byte order.
Investigate a locally stored number to determine the byte order of the local machine.
uint16_t uint16from | ( | uint8_t * | pointer, |
ByteOrder | order | ||
) |
Memory to 16 bit unsigned integer.
Return the 16 bit unsigned integer equivalent of a location in memory, corrected for the local byte order.
pointer | location in memory to be cast |
order | byte order of the data in memory. Taken from ByteOrder. |
int16_t int16from | ( | uint8_t * | pointer, |
ByteOrder | order | ||
) |
Memory to 16 bit signed integer.
Return the 16 bit signed integer equivalent of a location in memory, corrected for the local byte order.
pointer | location in memory to be cast |
order | byte order of the data in memory. Taken from ByteOrder. |
uint32_t uint32from | ( | uint8_t * | pointer, |
ByteOrder | order | ||
) |
Memory to 32 bit unsigned integer.
Return the 32 bit unsigned integer equivalent of a location in memory, corrected for the local byte order.
pointer | location in memory to be cast |
order | byte order of the data in memory. Taken from ByteOrder. |
int32_t int32from | ( | uint8_t * | pointer, |
ByteOrder | order | ||
) |
Memory to 32 bit signed integer.
Return the 32 bit signed integer equivalent of a location in memory, corrected for the local byte order.
pointer | location in memory to be cast |
order | byte order of the data in memory. Taken from ByteOrder. |
float floatfrom | ( | uint8_t * | pointer, |
ByteOrder | order | ||
) |
Memory to 32 bit float.
Return the 32 bit float equivalent of a location in memory, corrected for the local byte order.
pointer | location in memory to be cast |
order | byte order of the data in memory. Taken from ByteOrder. |
double doublefrom | ( | uint8_t * | pointer, |
ByteOrder | order | ||
) |
Memory to 64 bit float.
Return the 64 bit float equivalent of a location in memory, corrected for the local byte order.
pointer | location in memory to be cast |
order | byte order of the data in memory. Taken from ByteOrder. |
void uint32to | ( | uint32_t | value, |
uint8_t * | pointer, | ||
ByteOrder | order | ||
) |
32 bit unsigned integer to memory
Cast a 32 bit unsigned integer equivalent into a location in memory, corrected for the local byte order.
value | integer to be cast |
pointer | location in memory |
order | desired byte order of the data in memory. Taken from ByteOrder. |
void int32to | ( | int32_t | value, |
uint8_t * | pointer, | ||
ByteOrder | order | ||
) |
32 bit signed integer to memory
Cast a 32 bit signed integer equivalent into a location in memory, corrected for the local byte order.
value | integer to be cast |
pointer | location in memory |
order | desired byte order of the data in memory. Taken from ByteOrder. |
void uint16to | ( | uint16_t | value, |
uint8_t * | pointer, | ||
ByteOrder | order | ||
) |
16 bit unsigned integer to memory
Cast a 16 bit unsigned integer equivalent into a location in memory, corrected for the local byte order.
value | integer to be cast |
pointer | location in memory |
order | desired byte order of the data in memory. Taken from ByteOrder. |
void int16to | ( | int16_t | value, |
uint8_t * | pointer, | ||
ByteOrder | order | ||
) |
16 bit signed integer to memory
Cast a 16 bit signed integer equivalent into a location in memory, corrected for the local byte order.
value | integer to be cast |
pointer | location in memory |
order | desired byte order of the data in memory. Taken from ByteOrder. |
void floatto | ( | float | value, |
uint8_t * | pointer, | ||
ByteOrder | order | ||
) |
32 bit floating point to memory
Cast a 32 bit floating point equivalent into a location in memory, corrected for the local byte order.
value | float to be cast |
pointer | location in memory |
order | desired byte order of the data in memory. Taken from ByteOrder. |
void doubleto | ( | double | value, |
uint8_t * | pointer, | ||
ByteOrder | order | ||
) |
64 bit floating point to memory
Cast a 64 bit floating point equivalent into a location in memory, corrected for the local byte order.
value | float to be cast |
pointer | location in memory |
order | desired byte order of the data in memory. Taken from ByteOrder. |
void open_estimate | ( | estimatorhandle * | estimate, |
uint32_t | size, | ||
uint32_t | degree | ||
) |
Initialize estimator.
Setup the provided estimatorhandle so that it can be fed values and provide estimates.
estimate | Pointer to an estimatorhandle. |
size | The number of estimates to be averaged for the total estimate. |
degree | The degree of the polynomial fit for the estimator. |
int16_t set_estimate | ( | estimatorhandle * | estimate, |
double | independent, | ||
double | dependent | ||
) |
Set estimator.
Add a pair of independent and dependent values to the supplied estimatorhandle. If more than degree+1 values have been accumulated, a fit will be done for the new value. If more than size values have been added, the oldest will be dropped.
estimate | Pointer to an estimatorhandle. |
independent | Independent value. |
dependent | Dependent value. |
estimatorstruc get_estimate | ( | estimatorhandle * | estimate, |
double | x | ||
) |
Get estimate.
Return the best estimate for the supplied independent value. Estimate will be returned as an estimatorstruc, containing the value and likely error for the 0th, 1st and 2nd derivative of the dependent value.
estimate | Pointer to an estimatorhandle. |
x | Value of independent variable for estimate. |
void multisolve | ( | vector< vector< double > > | x, |
vector< double > | y, | ||
vector< double > & | a | ||
) |
Perform N equation solution.
Solve a system of N equations in N unknowns. The input data is N vectors of N-1 points ( N independent and 1 dependent variable).
x | N vectors of N-1 dependent variables. |
y | N independent variables. |
a | N returned parameters |
double evaluate_poly | ( | double | x, |
vector< double > | parms | ||
) |
Evaluate polynomial.
Return the value of the given Nth order polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order polynomial to be evaluated. |
double evaluate_poly_slope | ( | double | x, |
vector< double > | parms | ||
) |
Evaluate polynomial slope.
Return the value of the 1st derivative of the given Nth order polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order polynomial to be evaluated. |
double evaluate_poly_accel | ( | double | x, |
vector< double > | parms | ||
) |
Evaluate polynomial acceleration.
Return the value of the 2nd derivative of the given Nth order polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order polynomial to be evaluated. |
double evaluate_poly_jerk | ( | double | x, |
vector< double > | parms | ||
) |
Evaluate polynomial jerk.
Return the value of the 3rd derivative of the given Nth order polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order polynomial to be evaluated. |
rvector rv_evaluate_poly | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate vector polynomial.
Return the value of the given Nth order vector polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order vector polynomial to be evaluated. |
rvector rv_evaluate_poly_slope | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate vector polynomial slope.
Return the value of the 1st derivative of the given Nth order vector polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order vector polynomial to be evaluated. |
rvector rv_evaluate_poly_accel | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate vector polynomial acceleration.
Return the value of the 2nd derivative of the given Nth order vector polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order vector polynomial to be evaluated. |
rvector rv_evaluate_poly_jerk | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate vector polynomial jerk.
Return the value of the 3rd derivative of the given Nth order vector polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order vector polynomial to be evaluated. |
gvector gv_evaluate_poly | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate vector polynomial.
Return the value of the given Nth order vector polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order vector polynomial to be evaluated. |
gvector gv_evaluate_poly_slope | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate vector polynomial slope.
Return the value of the 1st derivative of the given Nth order vector polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order vector polynomial to be evaluated. |
gvector gv_evaluate_poly_accel | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate vector polynomial acceleration.
Return the value of the 2nd derivative of the given Nth order vector polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order vector polynomial to be evaluated. |
gvector gv_evaluate_poly_jerk | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate vector polynomial jerk.
Return the value of the 3rd derivative of the given Nth order vector polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order vector polynomial to be evaluated. |
quaternion q_evaluate_poly | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate quaternion polynomial.
Return the value of the 1st derivative of the given Nth order quaternion polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order quaternion polynomial to be evaluated. |
quaternion q_evaluate_poly_slope | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate quaternion polynomial slope.
Return the value of the 1st derivative of the given Nth order quaternion polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order quaternion polynomial to be evaluated. |
quaternion q_evaluate_poly_accel | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate quaternion polynomial acceleration.
Return the value of the 1st derivative of the given Nth order quaternion polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order quaternion polynomial to be evaluated. |
quaternion q_evaluate_poly_jerk | ( | double | x, |
vector< vector< double > > | parms | ||
) |
Evaluate quaternion polynomial jerk.
Return the value of the 1st derivative of the given Nth order quaternion polynomial, evaluated at the given location.
x | Independent variable where polynomial should be evaluated. |
parms | Vector of parameters for Nth order quaternion polynomial to be evaluated. |
vector< double > polyfit | ( | vector< double > & | x, |
vector< double > & | y | ||
) |
Perform general order polynomial fit.
Fit a polynomial of type: y(x) = An*x^n + An-1*x^(n-1) + ... + * A2*x^2 + A1*x + A0 where n-1 is the order of the polynomial. The input data is n points in x and n matching points in y. The fit is achieved using a Vandermonde interpolating polynomial.
x | Order+1 number of x values |
y | Order+1 number of y values |
Perform nth order polynomial fit.
Using the n equations: y = A0 + A1*x + A2*x^2 + ... +An*x^n, solve for the coefficients A0...An.
x | The n values of x |
y | The n corresponding values of y |
order | The order of the polynomial (< 5) |
gj_kernel * gauss_jackson_kernel | ( | int32_t | order, |
double | dvi | ||
) |
Create Gauss-Jackson Integration Kernel.
Allocate space for, and initialize all the parameters common to a Gauss-Jackson integration of the requested order and step change in the independent variable.
order | Order at which integration will be performed. |
dvi | Step size of independent variable. |
void gauss_jackson_dekernel | ( | gj_kernel * | gjk | ) |
Free Gauss-Jackson Integration Kernel.
Free the space fully or partially allocated represented by the supplied kernel pointer.
gjk | Pointer to Gauss-Jackson Kernel |
gj_instance * gauss_jackson_instance | ( | gj_kernel * | kern, |
int32_t | axes, | ||
void(*)(double vi, double *vd0, double *vd2, int32_t axes) | calc_vd2 | ||
) |
Initialize an Instance of a Gauss-Jackson Integrator.
Set up the integration specific variables for an integration using the provided kernel. The integration will be performed simultaneously for the indicated number of axes. The 2nd derivative for a specific set of independent and dependent variables is calculated using the provided function.
kern | Pointer to Gauss-Jackson Kernel previously initialized for order and step size. |
axes | Number of axes to integrate simultaneously. |
calc_vd2 | Function that will calculate 2nd derivative for all dependent variables at once. |
Initialize a Step of a Gauss-Jackson integrator.
Allocate the space, and set up the steps for a single axis of a Gauss-Jackson integrator of specified order.
kern | Kernel for this Gauss-Jackson integrator. |
Destroy a Step of a Gauss-Jackson integrator.
Deallocate the space a single axis of a Gauss-Jackson integrator of specified order.
kern | Kernel for this Gauss-Jackson integrator. |
step | Pointer to the step to be destroyed. |
int gauss_jackson_setstep | ( | gj_instance * | gji, |
double | vi, | ||
double * | vd0, | ||
double * | vd1, | ||
double * | vd2, | ||
int32_t | istep | ||
) |
Set Independent and Dependent variables for Gauss-Jackson step.
Set the Independent and Dependent variables for a particular step of a particular Gauss-Jackson integration Instance.
gji | Pointer to Gauss-Jackson Instance. |
vi | Pointer to Independent variable. |
vd0 | Pointer to array of Dependent variable for all axes at given step. |
vd1 | Pointer to array of First derivative of Dependent variable for all axes at given step. |
vd2 | Pointer to array of Second derivative of Dependent variable for all axes at given step. |
istep | Integer number of step. |
int gauss_jackson_getstep | ( | gj_instance * | gji, |
double * | vi, | ||
double * | vd0, | ||
double * | vd1, | ||
double * | vd2, | ||
int32_t | istep | ||
) |
Get Independent and Dependent variables for Gauss-Jackson step.
Get the Independent and Dependent variables for a particular step of a particular Gauss-Jackson integration Instance.
gji | Pointer to Gauss-Jackson Instance |
vi | Pointer to Independent variable |
vd0 | Pointer to array of Dependent variable for all axes at given step |
vd1 | Pointer to array of First derivative of Dependent variable for all axes at given step |
vd2 | Pointer to array of Second derivative of Dependent variable for all axes at given step |
istep | Index of step to get. |
void gauss_jackson_preset | ( | gj_instance * | gji | ) |
Converge all axes of a Gauss-Jackson integrator prior to propagation.
Converge all axes of a Gauss-Jackson integrator prior to propagation.
gji | Pointer to a Gauss-Jackson Integration Instance that has valid values |
void gauss_jackson_extrapolate | ( | gj_instance * | gji, |
double | target | ||
) |
Propagate Gauss-Jackson integration.
Propagate the Gauss-Jackson integration Instance for all axes. Will iterate a step at a time until target value of indpendent variable has been reached.
gji | Gauss-Jackson instance |
target | Target value of the independent variable |
double fixangle | ( | double | angle | ) |
Limit angle to range 0-2PI.
Ensure that angle represents equivalent value within a range of 0 to 2*PI.
angle | Input angle in radians. |
double actan | ( | double | y, |
double | x | ||
) |
ArcTan, limited to range 0-2PI.
Calculate Arc Tangent of y/x, ennsuring that angle represents equivalent value within a range of 0 to 2*PI.
y | Numerator. |
x | Denominator. |
double fixprecision | ( | double | number, |
double | prec | ||
) |
uint16_t calc_crc16ccitt | ( | uint8_t * | buf, |
int | size, | ||
bool | lsb | ||
) |
Calculate CRC-16-CCITT.
Calculate 16-bit CCITT CRC for the indicated buffer and number of bytes. For the lsb variant, the initial shift register value is 0xffff, and the calculation starts with the LSB, so the Polynomial is 0x8408. For the msb, the initial value is 0 and the Polynomial is 0x1021.
buf | bytes to calculate on |
size | number of bytes |
rvector drotate | ( | quaternion | q, |
rvector | v | ||
) |
Rotate a row vector using a quaternion.
Rotate a row vector within one coordinate system using the provided left quaternion.
q | Quaternion representing the rotation. |
v | Row vector to be rotated. |
rvector rotate_q | ( | quaternion | q, |
rvector | v | ||
) |
cvector drotate | ( | quaternion | q, |
cvector | v | ||
) |
Rotate a cartesian vector using a quaternion.
Rotate a cartesian vector from one coordinate system to another using the provided quaternion.
q | quaternion representing the rotation |
v | cartesian vector to be rotated |
cvector rotate_q | ( | quaternion | q, |
cvector | v | ||
) |
rvector irotate | ( | quaternion | q, |
rvector | v | ||
) |
Indirectly rotate a row vector using a quaternion.
Indirectly rotate a row vector from one coordinate system to another using the provided left quaternion.
q | quaternion representing the intrinsic rotation |
v | row vector to be rotated |
rvector transform_q | ( | quaternion | q, |
rvector | v | ||
) |
cvector irotate | ( | quaternion | q, |
cvector | v | ||
) |
Indirectly rotate a cartesian vector using a quaternion.
Indirectly rotate a cartesian vector from one coordinate system to another using the provided left quaternion.
q | quaternion representing the intrinsic rotation |
v | cartesian vector to be rotated |
quaternion q_change_between_cv | ( | cvector | from, |
cvector | to | ||
) |
Create rotation quaternion from 2 vectors.
Generate the quaternion that represents a rotation of from one cartesian vector to a second cartesian vector.
from | initial cartesian vector |
to | final cartesian vector |
quaternion q_change_between_rv | ( | rvector | from, |
rvector | to | ||
) |
Create rotation matrix from 2 vectors.
Generate the direction cosine matrix that represents a rotation from one cartesian vector to a second cartesian vector.
from | initial cartesian vector |
to | final cartesian vector |
double evaluate_poly | ( | double | x, |
rvector | parms | ||
) |
double evaluate_poly_slope | ( | double | x, |
rvector | parms | ||
) |
double evaluate_poly_accel | ( | double | x, |
rvector | parms | ||
) |
double evaluate_poly_jerk | ( | double | x, |
rvector | parms | ||
) |
uint16_t calc_crc16ccitt_lsb | ( | vector< uint8_t > | buf | ) |
uint16_t calc_crc16ccitt_msb | ( | vector< uint8_t > | buf | ) |
Multiply cartesian vector by cartesian matrix.
Multiply 3 element cartesian vector by 3x3 cartesian matrix
rmatrix rm_eye | ( | ) |
rmatrix rm_zero | ( | ) |
double norm_rm | ( | rmatrix | mat | ) |
double trace_rm | ( | rmatrix | mat | ) |
rmatrix Matrix Product
Multiply two row order matrices together.
Square rmatrix.
Square a rmatrix matrix by matrix multiplying it by itself.
a | matrix to be squared |
rmatrix rm_change_around_x | ( | double | angle | ) |
rmatrix rm_change_around_y | ( | double | angle | ) |
rmatrix rm_change_around_z | ( | double | angle | ) |
rmatrix rm_change_around | ( | int | axis, |
double | angle | ||
) |
cmatrix cm_eye | ( | ) |
cmatrix cm_zero | ( | ) |
double norm_cm | ( | cmatrix | mat | ) |
double trace_cm | ( | cmatrix | mat | ) |
cmatrix Matrix Product
Multiply two cartesian matrices together.
a | first cartesian matrix |
b | second cartesian matrix |
cmatrix cm_change_around_x | ( | double | angle | ) |
Rotation matrix for X axis.
Create the DCM that represents a rotation of the given angle around the X axis.
angle | Angle of rotation in radians |
cmatrix cm_change_around_y | ( | double | angle | ) |
Rotation matrix for Y axis.
Create the DCM that represents a rotation of the given angle around the Y axis.
angle | Angle of rotation in radians |
cmatrix cm_change_around_z | ( | double | angle | ) |
Rotation matrix for Z axis.
Create the DCM that represents a rotation of the given angle around the Z axis.
angle | Angle of rotation in radians |
cmatrix cm_change_around | ( | int | axis, |
double | angle | ||
) |
Converts 3x3 matrix in cartesian form to row major form.
matrix | Cartesian matrix to convert |
Inverse of rmatrix.
Inverse of 3x3 rmatrix using algorithm at http://mathworld.wolfram.com/MatrixInverse.html
m | rmatrix to take inverse of |
double determinant_rm | ( | rmatrix | m | ) |
Determinant of row column matrix.
Return the determinant for a 3x3 rmatrix
m | ;;rmatrix to calculate detrminant of |
matrix1d m1_zero | ( | uint16_t | cols | ) |
Fill 1D matrix with zeros.
Fill the provided vector with zeros, and set its size to the provided number of columns
cols | Number of columns |
Multiply 1D matrix by a scalar.
Multiply each element of indicated 1D matrix by a scalar and return as a new 1D matrix.
number | scalar to multiply by |
row | 1D matrix to be multiplied |
Add one 1D matrix to another.
Add each element in the second matrix to each element in the first matrix, returning the answer as a new matrix.
row1 | matrix to be added to |
row2 | matrix to add |
Subtract one 1D matrix from another.
Subtract each element in the second matrix from each element in the first matrix, returning the answer as a new matrix.
row1 | matrix to be subtracted from |
row2 | matrix to subtract |
matrix1d dot product
Computes the vector dot product (A x B) of two 1d vectors.
a | vector A |
b | vector B |
Inverse of matrix2d.
Inverse of 2x2 or 3x3 Matrix2D using algorithm at http://mathworld.wolfram.com/MatrixInverse.html
m | Matrix2d to take inverse of |
double m2_determinant | ( | matrix2d | m | ) |
Determinant of a 2D matrix.
Return the determinant for a 2x2 or 3x3 2D Matrix
m | Square 2D matrix to calculate detrminant of |
double m1_norm | ( | matrix1d | row | ) |
Compute the Euclidean norm of a 1D matrix.
Calculate and return the Euclidean norm of the provided 1D matrix.
row | 1D matrix to be normed |
matrix2d m2_zero | ( | uint16_t | rows, |
uint16_t | cols | ||
) |
Create 2D zero matrix.
Create a matrix of the requested sized, set to zero.
rows | Number of rows in the matrix |
cols | Number of columns in the matrix |
matrix2d m2_eye | ( | uint16_t | rows | ) |
Create 2D identity matrix.
Create a square identity matrix of the requested size and return as a new matrix.
rows | the size, in rows and columns, of the new matrix |
Multiply 2D matrix by a scalar.
Multiply each element of indicated 2D matrix by a scalar and return as a new 2D matrix.
number | scalar to multiply by |
matrix | 2D matrix to be multiplied |
Add one matrix2d to another.
Add each element in the second matrix to each element in the first matrix, returning the answer as a new matrix.
matrix1 | matrix to be added from |
matrix2 | matrix to add |
Subtract one matrix2d from another.
Subtract each element in the second matrix from each element in the first matrix, returning the answer as a new matrix.
matrix1 | matrix to be subtracted from |
matrix2 | matrix to subtract |
Unskew 3x3 2D matrix.
Create the 3 element 1D matrix correponding to a 3x3 skew symmetric matrix
matrix | 3x3 2D skew symmetric matrix |
double m2_trace | ( | matrix2d | matrix | ) |
Calculate the trace of a 2D matrix.
Add the diagonal elements of an nxn 2D matrix.
matrix | nxn matrix to take the elements from |
Matrix product.
Calculate the matrix product of two 2D matrices and return a new 2D matrix
matrix1 | mxn matrix |
matrix2 | nxm matrix |
rmatrix from rmatrix
Converts 3x3 matrix in row order form to cartesian form.
matrix | Row major matrix to convert |
Convert a Cartesian vector to either a row or column matrix2d.
vector | cvector to convert |
direction | column if 1 (DIRECTION_COLUMN), otherwise row |
Eigen values of a 2x2 square matrix.
Calculate the 2 element 1D matrix that is the set of eigenvalues of a 2x2 2D matrix
matrix | 2x2 2D matrix |
double m2_snorm2x2 | ( | matrix2d | matrix | ) |
Spectral norm of a 2x2 matrix.
Calculate the spectral norm of the provided 2x2 matrix.
matrix | 2x2 matrix |
cmatrix cm_quaternion2dcm | ( | quaternion | q | ) |
Quaternion to Direction Cosine Matrix This function expects a quaternion that represents the coordinate frame transformation not the rotation. If the quaternion represents the rotation from the inertial reference frame into the frame of the sensor/body then this DCM will represent the rotation from the sensor body frame (B) to the inertial frame (I) TODO: later this should be changed to be more consistent
Convert supplied quaternion to an equivalent direction cosine matrix
q | quaternion |
quaternion q_dcm2quaternion_cm | ( | cmatrix | dcm | ) |
Direction Cosine Matrix to Quaternion.
Convert the given DCM to an equivalent quaternion
dcm | direction cosine matrix |
Create rotation matrix from 2 row vectors.
Generate the direction cosine matrix that represents a rotation from one row order vector to a second row order vector.
from | initial row order vector |
to | final row order vector |
quaternion q_dcm2quaternion_rm | ( | rmatrix | m | ) |
Row matrix DCM to Quaternion.
Convert Direction Cosine Matrix in row matrix form to a Quaternion.
m | Direction Cosine Matrix in rmatrix form |
Angular separation between row vectors.
Calculates the separation angle between two row order vectors, in radians.
Convert vector in cartesian coordinates to vector in spherical coordinates.
from | Vector in cartesian coordinates to be converted. |
Convert vector in spherical coordinates to vector in cartesian coordinates.
from | Vector in spherical coordinates to be converted. |
rvector rv_zero | ( | ) |
rvector rv_unitx | ( | double | scale | ) |
Scaled x row vector.
Creates a row order vector with the X value set to scale.
rvector rv_unity | ( | double | scale | ) |
Scaled y row vector.
Creates a row order vector with the Y value set to scale.
rvector rv_unitz | ( | double | scale | ) |
Scaled z row vector.
Creates a row order vector with the Z value set to scale.
rvector rv_one | ( | ) |
rvector rv_one | ( | double | x, |
double | y, | ||
double | z | ||
) |
Row vector of values.
Creates a row order vector with values set to x, y, and z.
void normalize_rv | ( | rvector & | v | ) |
Normalize row order vector in place.
Normalizes requested row order vector.
v | a pointer to the rvector to be normalized |
double normVector3 | ( | double | x, |
double | y, | ||
double | z | ||
) |
basic function to compute the L2 norm of a 3d generic vector with separate entries
void normalizeVector3 | ( | double & | x, |
double & | y, | ||
double & | z | ||
) |
basic function to normalize any 3d vector with separate entries
Dot product of two row vectors.
Take the vector dot product of two vectors in rvector form.
a | First vector in product |
b | Second vector in product, treated as column vector |
Angular separation between vectors.
Calculates the separation angle between two vectors, in radians.
< Normalize first vector
cvector cv_zero | ( | ) |
cvector cv_unitx | ( | ) |
cvector cv_unity | ( | ) |
cvector cv_unitz | ( | ) |
cvector cv_one | ( | ) |
Normalize cartesian vector.
Returns a normalized version of the requested cartesian vector.
v | the cvector to be normalized |
void normalize_cv | ( | cvector & | v | ) |
Normalize cartesian vector in place, i.e. divides it by its own norm.
Normalizes requested cartesian vector.
v | a pointer to the cvector to be normalized |
Take cross product of two vectors.
double length_cv | ( | cvector | v | ) |
double cv_norm | ( | cvector | v | ) |
double norm_cv | ( | cvector | v | ) |
double sum_cv | ( | cvector | vec | ) |
Boolean equate of row vetor.
Determine whether all the elements of an rvector are equal and return either true or false.
double length_rv | ( | rvector | v | ) |
Length of row vector.
Calculate the length of a vector in row vector format.
v | Vector to find the length of. |
double norm_rv | ( | rvector | vec | ) |
Infinite norm of row vector.
Find the largest value in a row vector.
vec | Row vector to take infinte norm of |
double sum_rv | ( | rvector | vec | ) |
Sum elements of a row vector.
Add up the elements of a row vector and return the sum.
vec | Row vector to take sum of. |
LsFit::LsFit | ( | uint16_t | cnt = 10 , |
uint16_t | ord = 2 |
||
) |
Multi element, variable order least squares fit.
Constructor for cnt element, ord order least squares fit.
cnt | Number of elements to be fit. |
ord | Order of fit. |
void LsFit::initialize | ( | uint16_t | cnt = 10 , |
uint16_t | ord = 2 |
||
) |
Initialize Least Squares Fit.
Perform setting of variables in LsFit so that it can be ready for use.
cnt | Number of elements to be fit. |
ord | Order of fit. |
void LsFit::update | ( | double | x, |
double | y | ||
) |
Update scalar Least Squares Fit.
Add independent and dependent value pair to existing LsFit, updating the fit. If the number of elements in the fit has been reached, the oldest element is dropped before fitting.
x | Dependent value. |
y | Independent value. |
void LsFit::update | ( | double | x, |
rvector | y | ||
) |
Update rvector Least Squares Fit.
Add independent and dependent value pair to existing LsFit, updating the fit. If the number of elements in the fit has been reached, the oldest element is dropped before fitting.
x | Dependent value. |
y | Independent values. |
void LsFit::update | ( | double | x, |
gvector | y | ||
) |
Update gvector Least Squares Fit.
Add independent and dependent value pair to existing LsFit, updating the fit. If the number of elements in the fit has been reached, the oldest element is dropped before fitting.
x | Dependent value. |
y | Independent values. |
void LsFit::update | ( | double | x, |
quaternion | y | ||
) |
Update quaternion Least Squares Fit.
Add independent and dependent value pair to existing LsFit, updating the fit. If the number of elements in the fit has been reached, the oldest element is dropped before fitting.
x | Dependent value. |
y | Independent values. |
void LsFit::update | ( | fitelement | cfit, |
uint16_t | dep | ||
) |
Update generic Least Squares Fit.
Add LsFit::fitelement containing independent and dependent value pair to existing LsFit, updating the fit. If the number of elements in the fit has been reached, the oldest element is dropped before fitting.
cfit | Independent and dependent values. |
dep | Depth of fit. |
|
private |
Calculate least squares fit.
Calculate least squares fit for each axis of exsiting LsFit. Parameters are updated to reflect new fit.
double LsFit::lastx | ( | ) |
Least squares last independent value.
Return the value of the independent value added at the most recent LsFit::update.
double LsFit::firstx | ( | ) |
Least squares first independent value.
Return the value of the independent value added at the least recent LsFit::update.
size_t LsFit::size | ( | ) |
Least squares number of values.
Return the number of data values in the fit as of the last LsFit::update.
double LsFit::eval | ( | double | x | ) |
Least squares dependent scalar value.
Return the value of the dependent scalar, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
rvector LsFit::evalrvector | ( | double | x | ) |
Least squares dependent rvector value.
Return the value of the dependent rvector, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
gvector LsFit::evalgvector | ( | double | x | ) |
Least squares dependent gvector value.
Return the value of the dependent gvector, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
quaternion LsFit::evalquaternion | ( | double | x | ) |
Least squares dependent quaternion value.
Return the value of the dependent quaternion, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
double LsFit::slope | ( | double | x | ) |
Least squares dependent scalar 1st derivative.
Return the value of the dependent scalar 1st derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
rvector LsFit::slopervector | ( | double | x | ) |
Least squares dependent rvector 1st derivative.
Return the value of the dependent rvector 1st derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
gvector LsFit::slopegvector | ( | double | x | ) |
Least squares dependent gvector 1st derivative.
Return the value of the dependent gvector 1st derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
quaternion LsFit::slopequaternion | ( | double | x | ) |
Least squares dependent quaternion 1st derivative.
Return the value of the dependent quaternion 1st derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
double LsFit::accel | ( | double | x | ) |
Least squares dependent scalar 2nd derivative.
Return the value of the dependent scalar 2nd derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
rvector LsFit::accelrvector | ( | double | x | ) |
Least squares dependent rvector 2nd derivative.
Return the value of the dependent rvector 2nd derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
gvector LsFit::accelgvector | ( | double | x | ) |
Least squares dependent gvector 2nd derivative.
Return the value of the dependent gvector 2nd derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
quaternion LsFit::accelquaternion | ( | double | x | ) |
Least squares dependent quaternion 2nd derivative.
Return the value of the dependent quaternion 2nd derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
double LsFit::jerk | ( | double | x | ) |
Least squares dependent scalar 3rd derivative.
Return the value of the dependent scalar 3rd derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
rvector LsFit::jerkrvector | ( | double | x | ) |
Least squares dependent rvector 3rd derivative.
Return the value of the dependent rvector 3rd derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
gvector LsFit::jerkgvector | ( | double | x | ) |
Least squares dependent gvector 3rd derivative.
Return the value of the dependent gvector 3rd derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
quaternion LsFit::jerkquaternion | ( | double | x | ) |
Least squares dependent quaternion 3rd derivative.
Return the value of the dependent quaternion 3rd derivative, calculated for the provided independent value, using the parameters from the latest LsFit::update.
x | Independent value. |
vector< vector< double > > LsFit::getparms | ( | ) |
Least Squares parameters.
Return the values of the parameters for all axes of generated from the latest LsFit::update.
double LsFit::getbasex | ( | ) |
Least Squares base.
Return the values of the base independent variable for the latest LsFit::update.
cmatrix DCM::base2_from_base1 | ( | basisOrthonormal | base2, |
basisOrthonormal | base1 | ||
) |
cmatrix DCM::base1_from_base2 | ( | basisOrthonormal | base1, |
basisOrthonormal | base2 | ||
) |
void basisOrthonormal::normalize | ( | ) |
void cvector::normalize | ( | double | scale = 1. | ) |
Normalize cartesian vector in place, i.e. divides it by its own norm.
cvector cvector::normalized | ( | double | scale = 1. | ) |
Normalize cartesian vector.
Returns a normalized version of the requested cartesian vector.
scale | the weight to be applied after normalizing |
double cvector::norm2 | ( | ) |
double cvector::norm | ( | ) |
double cvector::length | ( | ) |
double & cvector::operator[] | ( | const int | index | ) |
Index into cvector.