Functions for quaternion operations. More...
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <signal.h>
#include <curses.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_eigen.h>
#include <vector>
Functions | |
void | quat_multiply (gsl_vector *M1, gsl_vector *M2, gsl_vector *ans0) |
Multiply quaternions. | |
void | quat_rotate (gsl_vector *quat1, gsl_vector *vect, gsl_vector *ans1) |
Rotate vector by quaternion. | |
void | quat_invert (gsl_vector *quat) |
void | free_acc (double *accl, double *quat) |
Subtract gravitational acceleration from accl readings. | |
void | rodrigues_to_quat (gsl_vector *quat_rod, gsl_vector *quat) |
Convert quaterion in rodrigues formulation to normal quaternion. | |
void | get_quaternion_avg (vector< vector< double > > quat_datas, gsl_vector *quat_avg) |
Get the average quaternion. |
Functions for quaternion operations.
void free_acc | ( | double * | accl, |
double * | quat | ||
) |
Subtract gravitational acceleration from accl readings.
[in,out] | accl | Acceleration vector. The gravity-free component is stored back |
[in] | quat | Quaternion describing orientation of acclerometer w.r.t earth fixed system |
References quat_rotate().
Referenced by load_accl_data().
void get_quaternion_avg | ( | vector< vector< double > > | quat_datas, |
gsl_vector * | quat_avg | ||
) |
Get the average quaternion.
Since quaternions are not regular vectors, but rather representations of orientation, an average quaternion cannot just be obtained by taking a weighted mean. This function implements the work done by paper by F. Landis Merkley (DOI: 10.2514/1.28949) to calculate the average quaternion
void quat_invert | ( | gsl_vector * | quat | ) |
void quat_multiply | ( | gsl_vector * | M1, |
gsl_vector * | M2, | ||
gsl_vector * | ans0 | ||
) |
Multiply quaternions.
Referenced by accl_mario_orient(), main(), and quat_rotate().
void quat_rotate | ( | gsl_vector * | quat1, |
gsl_vector * | vect, | ||
gsl_vector * | ans1 | ||
) |
Rotate vector by quaternion.
References quat_multiply().
Referenced by free_acc().
void rodrigues_to_quat | ( | gsl_vector * | quat_rod, |
gsl_vector * | quat | ||
) |
Convert quaterion in rodrigues formulation to normal quaternion.