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