![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
....
Dependencies: Library_Cntrl Library_Misc_cuboid
Fork of cuboid_balance_ros by
angle_estimator.h@0:acf871f26563, 2019-03-08 (annotated)
- Committer:
- altb2
- Date:
- Fri Mar 08 13:34:59 2019 +0000
- Revision:
- 0:acf871f26563
...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb2 | 0:acf871f26563 | 1 | #include "mbed.h" |
altb2 | 0:acf871f26563 | 2 | #include "LinearCharacteristics.h" |
altb2 | 0:acf871f26563 | 3 | #include "IIR_filter.h" |
altb2 | 0:acf871f26563 | 4 | class angle_estimator |
altb2 | 0:acf871f26563 | 5 | { |
altb2 | 0:acf871f26563 | 6 | public: |
altb2 | 0:acf871f26563 | 7 | |
altb2 | 0:acf871f26563 | 8 | angle_estimator(float); |
altb2 | 0:acf871f26563 | 9 | virtual ~angle_estimator(); |
altb2 | 0:acf871f26563 | 10 | float get_phi1(void); |
altb2 | 0:acf871f26563 | 11 | float get_gyro(void); |
altb2 | 0:acf871f26563 | 12 | void calc_angle_phi1(int); |
altb2 | 0:acf871f26563 | 13 | |
altb2 | 0:acf871f26563 | 14 | private: |
altb2 | 0:acf871f26563 | 15 | //------------------------------------------ |
altb2 | 0:acf871f26563 | 16 | // ... here define variables like gains etc. |
altb2 | 0:acf871f26563 | 17 | //------------------------------------------ |
altb2 | 0:acf871f26563 | 18 | LinearCharacteristics u2ax; // use normalized input |
altb2 | 0:acf871f26563 | 19 | LinearCharacteristics u2ay; // use normalized input |
altb2 | 0:acf871f26563 | 20 | LinearCharacteristics u2gz; // use normalized input |
altb2 | 0:acf871f26563 | 21 | // 4.6517f = 1/3.752e-3 [V / °/s] * pi/180 |
altb2 | 0:acf871f26563 | 22 | |
altb2 | 0:acf871f26563 | 23 | //-------------DEFINE FILTERS---------------- |
altb2 | 0:acf871f26563 | 24 | IIR_filter f_ax; // filter ax signals |
altb2 | 0:acf871f26563 | 25 | IIR_filter f_ay; // filter ay signals |
altb2 | 0:acf871f26563 | 26 | IIR_filter f_gz; // filter gz signals |
altb2 | 0:acf871f26563 | 27 | |
altb2 | 0:acf871f26563 | 28 | AnalogIn ax; // Analog IN (acc x) on PA_0 |
altb2 | 0:acf871f26563 | 29 | AnalogIn ay; // Analog IN (acc y) on PA_1 |
altb2 | 0:acf871f26563 | 30 | AnalogIn gz; // Analog IN (gyr z) on PA_4 |
altb2 | 0:acf871f26563 | 31 | |
altb2 | 0:acf871f26563 | 32 | float gyro; |
altb2 | 0:acf871f26563 | 33 | float phi1; |
altb2 | 0:acf871f26563 | 34 | }; |