2014 Eurobot fork
Dependencies: mbed-rtos mbed QEI
Processes/Kalman/Kalman.h@19:4b993a9a156e, 2013-04-07 (annotated)
- Committer:
- madcowswe
- Date:
- Sun Apr 07 19:26:07 2013 +0000
- Revision:
- 19:4b993a9a156e
- Parent:
- 16:52250d8d8fce
- Child:
- 20:70d651156779
Kalman init almost ready for testing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
madcowswe | 16:52250d8d8fce | 1 | #ifndef KALMAN_H |
madcowswe | 16:52250d8d8fce | 2 | #define KALMAN_H |
madcowswe | 16:52250d8d8fce | 3 | |
madcowswe | 16:52250d8d8fce | 4 | //#include "globals.h" |
madcowswe | 16:52250d8d8fce | 5 | |
madcowswe | 16:52250d8d8fce | 6 | namespace Kalman |
madcowswe | 16:52250d8d8fce | 7 | { |
madcowswe | 16:52250d8d8fce | 8 | |
madcowswe | 16:52250d8d8fce | 9 | typedef struct state { |
madcowswe | 16:52250d8d8fce | 10 | float x; |
madcowswe | 16:52250d8d8fce | 11 | float y; |
madcowswe | 16:52250d8d8fce | 12 | float theta; |
madcowswe | 16:52250d8d8fce | 13 | } state ; |
madcowswe | 16:52250d8d8fce | 14 | |
madcowswe | 16:52250d8d8fce | 15 | //Accessor function to get the state as one consistent struct |
madcowswe | 16:52250d8d8fce | 16 | state getState(); |
madcowswe | 16:52250d8d8fce | 17 | |
madcowswe | 16:52250d8d8fce | 18 | //Main loops (to be attached as a thread in main) |
madcowswe | 16:52250d8d8fce | 19 | void predictloop(void* dummy); |
madcowswe | 16:52250d8d8fce | 20 | void updateloop(void* dummy); |
madcowswe | 16:52250d8d8fce | 21 | |
madcowswe | 16:52250d8d8fce | 22 | |
madcowswe | 16:52250d8d8fce | 23 | enum measurement_t {SONAR0 = 0, SONAR1, SONAR2, IR0, IR1, IR2}; |
madcowswe | 19:4b993a9a156e | 24 | const measurement_t maxmeasure = IR2; |
madcowswe | 16:52250d8d8fce | 25 | |
madcowswe | 16:52250d8d8fce | 26 | //Call this to run an update |
madcowswe | 16:52250d8d8fce | 27 | void runupdate(measurement_t type, float value, float variance); |
madcowswe | 16:52250d8d8fce | 28 | |
madcowswe | 16:52250d8d8fce | 29 | extern float RawReadings[maxmeasure+1]; |
madcowswe | 19:4b993a9a156e | 30 | extern float IRpahseOffset; |
madcowswe | 16:52250d8d8fce | 31 | |
madcowswe | 16:52250d8d8fce | 32 | extern bool Kalman_init; |
madcowswe | 16:52250d8d8fce | 33 | |
madcowswe | 16:52250d8d8fce | 34 | //Initialises the kalman filter |
madcowswe | 16:52250d8d8fce | 35 | void KalmanInit(); |
madcowswe | 16:52250d8d8fce | 36 | |
madcowswe | 16:52250d8d8fce | 37 | // reset kalman states |
madcowswe | 16:52250d8d8fce | 38 | void KalmanReset(); |
madcowswe | 16:52250d8d8fce | 39 | } |
madcowswe | 16:52250d8d8fce | 40 | |
madcowswe | 16:52250d8d8fce | 41 | #endif //KALMAN_H |