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