Function to calculate the homogenous transformation matrix for base link of collar. More...
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <vector>
#include "lowerleg_struct.h"
#include "lowerleg_func.h"
#include "postprocess.h"
Defines | |
#define | MAX_OPTI_PER_LINK 8 |
Maximum number of optical sensors per link is 8 (since there aren't as many attachment points) | |
Functions | |
int | calc_link_frame_opti (tibia &tib, string linkname, int fr_num, gsl_matrix *M) |
Calculate transformation matrix relating base link frame to global frame using optical marker data. | |
int | calc_trans_mat (double Ploc[], double Pglob[], gsl_matrix *H) |
Given coordinates of 3 points in 2 frames, calculate transformation matrix relating them. | |
int | DHtoFix (vector< double > &firstlink, gsl_matrix *DHF) |
calc first link matrix. | |
int | DH_hayati (double beta, double alpha, double a, double theta, gsl_matrix *DHayati) |
Calculate transformation matrix using Hayati representation of DH parameters. | |
int | calc_transf_matrix (gsl_matrix *Matlink, int linknumber, vector< vector< double > > &Hprev, vector< vector< double > > &Pvals, vector< vector< double > > &qvals, vector< double > &firstlink) |
Calculate overall transformation matrix, from first link (left-most) to the current link (specified by link number). | |
int | gsl_pt_quat_matrix (vector< double > &Pvals, vector< double > &qvals, gsl_matrix *MatOP) |
int | get_link_number (collar &col, string linkname) |
Get the link number. ie plate number from the leftmost plate. |
Function to calculate the homogenous transformation matrix for base link of collar.
#define MAX_OPTI_PER_LINK 8 |
Maximum number of optical sensors per link is 8 (since there aren't as many attachment points)
Referenced by calc_link_frame_opti().
int calc_link_frame_opti | ( | tibia & | tib, |
string | linkname, | ||
int | fr_num, | ||
gsl_matrix * | M | ||
) |
Calculate transformation matrix relating base link frame to global frame using optical marker data.
This function reads data from the config file and 3d tracking data obtained from optical markers to calculate the 4x4 transformation matrix that relates the link fixed frame to the global frame. The function takes in the structure tibia, which contains config data and the measured data, and the name of the link which is to be considered the base.
Since the OptiTrack system records data at a frame rate of 100Hz and stores it referencing the frame number, the frame number is also taken in as input.
[in] | tib | The tibia structure holding all info |
[in] | linkname | The name of the link that is to be treated as the base link |
[in] | fr_num | The frame number for which the measured data is taken for calculations |
[out] | M | The 4x4 transformation matrix such that Ploc = M*pglob where, plocal are the coordinates of a point in the link frame, and pglob are the coordinates of the point in global frame. |
number of sensors on the plate linkname
References calc_trans_mat(), sensor::LINK_label, MAX_OPTI_PER_LINK, sensor::mdata, tibia::opti_count, tibia::optical, sensor::xa, sensor::ya, and sensor::za.
int calc_trans_mat | ( | double | Ploc[], |
double | Pglob[], | ||
gsl_matrix * | H | ||
) |
Given coordinates of 3 points in 2 frames, calculate transformation matrix relating them.
[in] | Ploc | 9x1 array with coordinates of 3 points in local frame, concatanated together. |
[in] | Pglob | 9x1 array with coordinates of 3 points in global frame, concatanated together. |
[out] | H | 4x4 transformation matrix such that plocal = H*pglobal, where plocal and pglobal are the co-ordinates expressed as homogenous 4x1 vectors |
References gramSchmidt().
Referenced by calc_link_frame_opti(), and calc_mario_frame_opti().
int calc_transf_matrix | ( | gsl_matrix * | Matlink, |
int | linknumber, | ||
vector< vector< double > > & | Hprev, | ||
vector< vector< double > > & | Pvals, | ||
vector< vector< double > > & | qvals, | ||
vector< double > & | firstlink | ||
) |
Calculate overall transformation matrix, from first link (left-most) to the current link (specified by link number).
Calculate the matrix to transform local co-ordinates in link/plate frame i (from left) to co-ordinates expressed in the left-most frame of the collar.
References DH_hayati(), DHtoFix(), and gsl_pt_quat_matrix().
Referenced by calc_pts_in_collar_base_frame().
int DH_hayati | ( | double | beta, |
double | alpha, | ||
double | a, | ||
double | theta, | ||
gsl_matrix * | DHayati | ||
) |
Calculate transformation matrix using Hayati representation of DH parameters.
References gsl_hom_matrix(), rotX(), rotY(), and rotZ().
Referenced by calc_transf_matrix().
int DHtoFix | ( | vector< double > & | firstlink, |
gsl_matrix * | DHF | ||
) |
calc first link matrix.
References gsl_hom_matrix(), rotX(), and rotZ().
Referenced by calc_collar_angles(), and calc_transf_matrix().
int get_link_number | ( | collar & | col, |
string | linkname | ||
) |
Get the link number. ie plate number from the leftmost plate.
References NB_LINKS_MAX, collar::shape_left, and collar::shape_right.
Referenced by calc_pts_in_collar_base_frame().
int gsl_pt_quat_matrix | ( | vector< double > & | Pvals, |
vector< double > & | qvals, | ||
gsl_matrix * | MatOP | ||
) |
References gsl_hom_matrix(), and gsl_rodrigues_to_rot().
Referenced by calc_transf_matrix().