![](/media/cache/profiles/altb_JGUSAOG.jpg.50x50_q85.jpg)
corrections altb2
Lib_Cntrl/GPA.h@0:d2e117716219, 2021-05-02 (annotated)
- Committer:
- altb2
- Date:
- Sun May 02 19:32:30 2021 +0000
- Revision:
- 0:d2e117716219
1st commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb2 | 0:d2e117716219 | 1 | #ifndef GPA_H_ |
altb2 | 0:d2e117716219 | 2 | #define GPA_H_ |
altb2 | 0:d2e117716219 | 3 | #include "uart_comm_thread.h" |
altb2 | 0:d2e117716219 | 4 | |
altb2 | 0:d2e117716219 | 5 | |
altb2 | 0:d2e117716219 | 6 | |
altb2 | 0:d2e117716219 | 7 | class GPA |
altb2 | 0:d2e117716219 | 8 | { |
altb2 | 0:d2e117716219 | 9 | public: |
altb2 | 0:d2e117716219 | 10 | |
altb2 | 0:d2e117716219 | 11 | typedef struct GPADATA { |
altb2 | 0:d2e117716219 | 12 | float fexc; |
altb2 | 0:d2e117716219 | 13 | float absGyu; |
altb2 | 0:d2e117716219 | 14 | float angGyu; |
altb2 | 0:d2e117716219 | 15 | float absGyr; |
altb2 | 0:d2e117716219 | 16 | float angGyr; |
altb2 | 0:d2e117716219 | 17 | float Umag; |
altb2 | 0:d2e117716219 | 18 | float Ymag; |
altb2 | 0:d2e117716219 | 19 | float Rmag; |
altb2 | 0:d2e117716219 | 20 | bool MeasPointFinished; |
altb2 | 0:d2e117716219 | 21 | bool MeasFinished; |
altb2 | 0:d2e117716219 | 22 | int ind; |
altb2 | 0:d2e117716219 | 23 | } gpadata_t; |
altb2 | 0:d2e117716219 | 24 | |
altb2 | 0:d2e117716219 | 25 | GPA() {}; |
altb2 | 0:d2e117716219 | 26 | GPA(float fMin, float fMax, int NfexcDes, float Aexc0, float Aexc1, float Ts); |
altb2 | 0:d2e117716219 | 27 | GPA(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep); |
altb2 | 0:d2e117716219 | 28 | GPA(float f0, float f1, float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep); |
altb2 | 0:d2e117716219 | 29 | GPA(float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep); |
altb2 | 0:d2e117716219 | 30 | GPA(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep, bool doPrint); |
altb2 | 0:d2e117716219 | 31 | |
altb2 | 0:d2e117716219 | 32 | float operator()(float inp, float out) |
altb2 | 0:d2e117716219 | 33 | { |
altb2 | 0:d2e117716219 | 34 | return update(inp, out); |
altb2 | 0:d2e117716219 | 35 | } |
altb2 | 0:d2e117716219 | 36 | |
altb2 | 0:d2e117716219 | 37 | virtual ~GPA(); |
altb2 | 0:d2e117716219 | 38 | |
altb2 | 0:d2e117716219 | 39 | void setParameters(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep, bool doPrint); |
altb2 | 0:d2e117716219 | 40 | void reset(); |
altb2 | 0:d2e117716219 | 41 | float update(float inp, float out); |
altb2 | 0:d2e117716219 | 42 | |
altb2 | 0:d2e117716219 | 43 | void printGPAfexcDes(); |
altb2 | 0:d2e117716219 | 44 | void printGPAmeasPara(); |
altb2 | 0:d2e117716219 | 45 | void printGPAmeasTime(); |
altb2 | 0:d2e117716219 | 46 | void printNfexcDes(); |
altb2 | 0:d2e117716219 | 47 | void printLine(); |
altb2 | 0:d2e117716219 | 48 | void printLongLine(); |
altb2 | 0:d2e117716219 | 49 | |
altb2 | 0:d2e117716219 | 50 | void getGPAdata(float *); |
altb2 | 0:d2e117716219 | 51 | bool new_data_available; |
altb2 | 0:d2e117716219 | 52 | bool meas_is_finished; |
altb2 | 0:d2e117716219 | 53 | bool start_now; |
altb2 | 0:d2e117716219 | 54 | |
altb2 | 0:d2e117716219 | 55 | private: |
altb2 | 0:d2e117716219 | 56 | |
altb2 | 0:d2e117716219 | 57 | int NfexcDes; |
altb2 | 0:d2e117716219 | 58 | int NperMin; |
altb2 | 0:d2e117716219 | 59 | int NmeasMin; |
altb2 | 0:d2e117716219 | 60 | float Ts; |
altb2 | 0:d2e117716219 | 61 | float *fexcDes; |
altb2 | 0:d2e117716219 | 62 | float aAexcDes; |
altb2 | 0:d2e117716219 | 63 | float bAexcDes; |
altb2 | 0:d2e117716219 | 64 | |
altb2 | 0:d2e117716219 | 65 | float fnyq; |
altb2 | 0:d2e117716219 | 66 | double pi2; |
altb2 | 0:d2e117716219 | 67 | float pi4; |
altb2 | 0:d2e117716219 | 68 | double pi2Ts; |
altb2 | 0:d2e117716219 | 69 | float piDiv2; |
altb2 | 0:d2e117716219 | 70 | float rad2deg; |
altb2 | 0:d2e117716219 | 71 | float div12pi; |
altb2 | 0:d2e117716219 | 72 | float div812pi; |
altb2 | 0:d2e117716219 | 73 | |
altb2 | 0:d2e117716219 | 74 | int Nmeas; |
altb2 | 0:d2e117716219 | 75 | int Nper; |
altb2 | 0:d2e117716219 | 76 | double dfexc; |
altb2 | 0:d2e117716219 | 77 | double fexc; |
altb2 | 0:d2e117716219 | 78 | float fexcPast; |
altb2 | 0:d2e117716219 | 79 | float dfexcj; |
altb2 | 0:d2e117716219 | 80 | int i; |
altb2 | 0:d2e117716219 | 81 | int j; |
altb2 | 0:d2e117716219 | 82 | double scaleG; |
altb2 | 0:d2e117716219 | 83 | double cr; |
altb2 | 0:d2e117716219 | 84 | double ci; |
altb2 | 0:d2e117716219 | 85 | double *sU; |
altb2 | 0:d2e117716219 | 86 | double *sY; |
altb2 | 0:d2e117716219 | 87 | double sinarg; |
altb2 | 0:d2e117716219 | 88 | float sinargR; |
altb2 | 0:d2e117716219 | 89 | int NmeasTotal; |
altb2 | 0:d2e117716219 | 90 | float Aexc; |
altb2 | 0:d2e117716219 | 91 | float AexcPast; |
altb2 | 0:d2e117716219 | 92 | double pi2Tsfexc; |
altb2 | 0:d2e117716219 | 93 | int Nstart; |
altb2 | 0:d2e117716219 | 94 | int Nsweep; |
altb2 | 0:d2e117716219 | 95 | int Nsweep_i; |
altb2 | 0:d2e117716219 | 96 | float AexcOut; |
altb2 | 0:d2e117716219 | 97 | |
altb2 | 0:d2e117716219 | 98 | gpadata_t gpaData; |
altb2 | 0:d2e117716219 | 99 | bool doPrint; |
altb2 | 0:d2e117716219 | 100 | |
altb2 | 0:d2e117716219 | 101 | void assignParameters(int NfexcDes, int NperMin, int NmeasMin, float Ts, int Nstart, int Nsweep); |
altb2 | 0:d2e117716219 | 102 | void calculateDecreasingAmplitudeCoefficients(float Aexc0, float Aexc1); |
altb2 | 0:d2e117716219 | 103 | void initializeConstants(float Ts); |
altb2 | 0:d2e117716219 | 104 | void assignFilterStorage(); |
altb2 | 0:d2e117716219 | 105 | void fexcDesLogspace(float fMin, float fMax, int NfexcDes); |
altb2 | 0:d2e117716219 | 106 | void calcGPAmeasPara(float fexcDes_i); |
altb2 | 0:d2e117716219 | 107 | float wrapAngle(float angle); |
altb2 | 0:d2e117716219 | 108 | |
altb2 | 0:d2e117716219 | 109 | }; |
altb2 | 0:d2e117716219 | 110 | |
altb2 | 0:d2e117716219 | 111 | #endif |