2nd Library
Dependents: cuboid_balance_ros cuboid_balance mirror_actuator_V1
Diff: GPA.h
- Revision:
- 2:b54eb3e24d2d
- Parent:
- 0:a201a6cd4c0c
--- a/GPA.h Thu Mar 07 07:03:56 2019 +0000 +++ b/GPA.h Thu Feb 25 20:28:27 2021 +0000 @@ -1,48 +1,76 @@ +#ifndef GPA_H_ +#define GPA_H_ + class GPA { public: - + + typedef struct GPADATA { + float fexc; + float absGyu; + float angGyu; + float absGyr; + float angGyr; + float Umag; + float Ymag; + float Rmag; + bool MeasPointFinished; + bool MeasFinished; + int ind; + } gpadata_t; + + GPA() {}; GPA(float fMin, float fMax, int NfexcDes, float Aexc0, float Aexc1, float Ts); - GPA(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int NstartMin, int NsweepMin); - GPA(float f0, float f1, float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int NstartMin, int NsweepMin); - GPA(float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int NstartMin, int NsweepMin); + GPA(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep); + GPA(float f0, float f1, float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep); + GPA(float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep); + GPA(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep, bool doPrint); - float operator()(float inp, float out) { - return update((double)inp, (double)out); + float operator()(float inp, float out) + { + return update(inp, out); } virtual ~GPA(); - void reset(); - float update(double inp, double out); + void setParameters(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep, bool doPrint); + void reset(); + float update(float inp, float out); - void printGPAfexcDes(); - void printGPAmeasPara(); - void printFullGPAmeasPara(); - void printGPAmeasTime(); - void printNfexcDes(); + void printGPAfexcDes(); + void printGPAmeasPara(); + void printGPAmeasTime(); + void printNfexcDes(); + void printLine(); + void printLongLine(); + + gpadata_t getGPAdata(); private: int NfexcDes; int NperMin; int NmeasMin; - double Ts; - double *fexcDes; - double aAexcDes; - double bAexcDes; + float Ts; + float *fexcDes; + float aAexcDes; + float bAexcDes; - double fnyq; + float fnyq; double pi2; + float pi4; double pi2Ts; - double piDiv2; + float piDiv2; float rad2deg; + float div12pi; + float div812pi; int Nmeas; int Nper; double dfexc; double fexc; - double fexcPast; + float fexcPast; + float dfexcj; int i; int j; double scaleG; @@ -51,28 +79,27 @@ double *sU; double *sY; double sinarg; + float sinargR; int NmeasTotal; - double Aexc; - double AexcPast; + float Aexc; + float AexcPast; double pi2Tsfexc; - int NstartMin; - int NsweepMin; + int Nstart; int Nsweep; - double bfexc; - double afexc; - double aAexc; - double bAexc; - double AexcOut; - - void assignParameters(int NfexcDes, int NperMin, int NmeasMin, double Ts, int NstartMin, int NsweepMin); - void calculateDecreasingAmplitudeCoefficients(double Aexc0, double Aexc1); - void initializeConstants(double Ts); + int Nsweep_i; + float AexcOut; + + gpadata_t gpaData; + bool doPrint; + + void assignParameters(int NfexcDes, int NperMin, int NmeasMin, float Ts, int Nstart, int Nsweep); + void calculateDecreasingAmplitudeCoefficients(float Aexc0, float Aexc1); + void initializeConstants(float Ts); void assignFilterStorage(); - void fexcDesLogspace(double fMin, double fMax, int NfexcDes); - void calcGPAmeasPara(double fexcDes_i); - void calcGPAsweepPara(); - double wrapAngle(double angle); - void printLongLine(); - void printLine(); + void fexcDesLogspace(float fMin, float fMax, int NfexcDes); + void calcGPAmeasPara(float fexcDes_i); + float wrapAngle(float angle); }; + +#endif \ No newline at end of file