2nd Library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GPA.h Source File

GPA.h

00001 #ifndef GPA_H_
00002 #define GPA_H_
00003 #include "uart_comm_thread.h"
00004 
00005 
00006 
00007 class GPA
00008 {
00009 public:
00010 
00011     typedef struct GPADATA {
00012         float   fexc;
00013         float   absGyu;
00014         float   angGyu;
00015         float   absGyr;
00016         float   angGyr;
00017         float   Umag;
00018         float   Ymag;
00019         float   Rmag;
00020         bool    MeasPointFinished;
00021         bool    MeasFinished;
00022         int     ind;
00023     } gpadata_t;
00024 
00025     GPA() {};
00026     GPA(float fMin, float fMax, int NfexcDes, float Aexc0, float Aexc1, float Ts);
00027     GPA(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep);
00028     GPA(float f0, float f1, float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep);
00029     GPA(float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep);
00030     GPA(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep, bool doPrint);
00031 
00032     float operator()(float inp, float out)
00033     {
00034         return update(inp, out);
00035     }
00036 
00037     virtual ~GPA();
00038 
00039     void    setParameters(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep, bool doPrint);
00040     void    reset();
00041     float   update(float inp, float out);
00042 
00043     void    printGPAfexcDes();
00044     void    printGPAmeasPara();
00045     void    printGPAmeasTime();
00046     void    printNfexcDes();
00047     void    printLine();
00048     void    printLongLine();
00049 
00050     void    getGPAdata(float *);
00051     bool    new_data_available;
00052     bool    meas_is_finished;
00053     bool    start_now;
00054 
00055 private:
00056 
00057     int     NfexcDes;
00058     int     NperMin;
00059     int     NmeasMin;
00060     float   Ts;
00061     float  *fexcDes;
00062     float   aAexcDes;
00063     float   bAexcDes;
00064 
00065     float   fnyq;
00066     double  pi2;
00067     float   pi4;
00068     double  pi2Ts;
00069     float   piDiv2;
00070     float   rad2deg;
00071     float   div12pi;
00072     float   div812pi;
00073 
00074     int     Nmeas;
00075     int     Nper;
00076     double  dfexc;
00077     double  fexc;
00078     float   fexcPast;
00079     float   dfexcj;
00080     int     i;
00081     int     j;
00082     double  scaleG;
00083     double  cr;
00084     double  ci;
00085     double *sU;
00086     double *sY;
00087     double  sinarg;
00088     float   sinargR;
00089     int     NmeasTotal;
00090     float   Aexc;
00091     float   AexcPast;
00092     double  pi2Tsfexc;
00093     int     Nstart;
00094     int     Nsweep;
00095     int     Nsweep_i;
00096     float   AexcOut;
00097 
00098     gpadata_t gpaData;
00099     bool    doPrint;
00100 
00101     void    assignParameters(int NfexcDes, int NperMin, int NmeasMin, float Ts, int Nstart, int Nsweep);
00102     void    calculateDecreasingAmplitudeCoefficients(float Aexc0, float Aexc1);
00103     void    initializeConstants(float Ts);
00104     void    assignFilterStorage();
00105     void    fexcDesLogspace(float fMin, float fMax, int NfexcDes);
00106     void    calcGPAmeasPara(float fexcDes_i);
00107     float   wrapAngle(float angle);
00108 
00109 };
00110 
00111 #endif