AHRS Library
AHRS.h@3:6811c0ce95f6, 2018-12-04 (annotated)
- Committer:
- altb
- Date:
- Tue Dec 04 15:49:48 2018 +0000
- Revision:
- 3:6811c0ce95f6
AHRS Klasse mit Mahony filter etc
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb | 3:6811c0ce95f6 | 1 | #include "Mahony.h" |
altb | 3:6811c0ce95f6 | 2 | #include "MadgwickAHRS.h" |
altb | 3:6811c0ce95f6 | 3 | #include "LinearCharacteristics.h" |
altb | 3:6811c0ce95f6 | 4 | #include "LSM9DS1.h" |
altb | 3:6811c0ce95f6 | 5 | #include "Signal.h" |
altb | 3:6811c0ce95f6 | 6 | |
altb | 3:6811c0ce95f6 | 7 | class AHRS{ |
altb | 3:6811c0ce95f6 | 8 | public: |
altb | 3:6811c0ce95f6 | 9 | AHRS(uint8_t,float); |
altb | 3:6811c0ce95f6 | 10 | virtual ~AHRS(); |
altb | 3:6811c0ce95f6 | 11 | |
altb | 3:6811c0ce95f6 | 12 | float getRollRadians() { |
altb | 3:6811c0ce95f6 | 13 | if (!RPY_filter.anglesComputed) RPY_filter.computeAngles(); |
altb | 3:6811c0ce95f6 | 14 | return RPY_filter.getRoll(); |
altb | 3:6811c0ce95f6 | 15 | } |
altb | 3:6811c0ce95f6 | 16 | float getPitchRadians() { |
altb | 3:6811c0ce95f6 | 17 | if (!RPY_filter.anglesComputed) RPY_filter.computeAngles(); |
altb | 3:6811c0ce95f6 | 18 | return RPY_filter.getPitch(); |
altb | 3:6811c0ce95f6 | 19 | } |
altb | 3:6811c0ce95f6 | 20 | float getYawRadians() { |
altb | 3:6811c0ce95f6 | 21 | if (!RPY_filter.anglesComputed) RPY_filter.computeAngles(); |
altb | 3:6811c0ce95f6 | 22 | return RPY_filter.getYaw(); |
altb | 3:6811c0ce95f6 | 23 | } |
altb | 3:6811c0ce95f6 | 24 | LSM9DS1 imu; |
altb | 3:6811c0ce95f6 | 25 | Mahony RPY_filter; |
altb | 3:6811c0ce95f6 | 26 | LinearCharacteristics raw_gx2gx; |
altb | 3:6811c0ce95f6 | 27 | LinearCharacteristics raw_gy2gy; |
altb | 3:6811c0ce95f6 | 28 | LinearCharacteristics raw_gz2gz; |
altb | 3:6811c0ce95f6 | 29 | private: |
altb | 3:6811c0ce95f6 | 30 | Signal signal; |
altb | 3:6811c0ce95f6 | 31 | Thread thread; |
altb | 3:6811c0ce95f6 | 32 | Ticker ticker; |
altb | 3:6811c0ce95f6 | 33 | Mutex mutex; // mutex to lock critical sections |
altb | 3:6811c0ce95f6 | 34 | void sendSignal(); |
altb | 3:6811c0ce95f6 | 35 | void update(); |
altb | 3:6811c0ce95f6 | 36 | LinearCharacteristics raw_ax2ax; |
altb | 3:6811c0ce95f6 | 37 | LinearCharacteristics raw_ay2ay; |
altb | 3:6811c0ce95f6 | 38 | LinearCharacteristics raw_az2az; |
altb | 3:6811c0ce95f6 | 39 | LinearCharacteristics int2magx; |
altb | 3:6811c0ce95f6 | 40 | LinearCharacteristics int2magy; |
altb | 3:6811c0ce95f6 | 41 | LinearCharacteristics int2magz; |
altb | 3:6811c0ce95f6 | 42 | SPI spi; |
altb | 3:6811c0ce95f6 | 43 | DigitalOut csAG; // for spi |
altb | 3:6811c0ce95f6 | 44 | DigitalOut csM; // " |
altb | 3:6811c0ce95f6 | 45 | }; |