code:kalman_filter
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
code:kalman_filter [2008/09/10 22:31] – laurenceb | code:kalman_filter [2008/10/20 13:38] (current) – laurenceb | ||
---|---|---|---|
Line 18: | Line 18: | ||
The simulated gyro output in red, and filter turn rate output in green. | The simulated gyro output in red, and filter turn rate output in green. | ||
+ | |||
+ | |||
Line 68: | Line 70: | ||
{ | { | ||
vector a=matrix_vector(& | vector a=matrix_vector(& | ||
- | a=vector_subtract(y,& | + | a=vector_subtract(y,& |
+ | if(a.t> | ||
+ | { | ||
+ | a.t-=2*PI; | ||
+ | } | ||
+ | if(a.t< | ||
+ | { | ||
+ | a.t+=2*PI; | ||
+ | } | ||
a=matrix_vector(K,& | a=matrix_vector(K,& | ||
state-> | state-> | ||
Line 83: | Line 93: | ||
} | } | ||
</ | </ | ||
+ | |||
===== Kalman.h ===== | ===== Kalman.h ===== | ||
Line 102: | Line 113: | ||
} kalman_model; | } kalman_model; | ||
- | kalman_state | + | void predict_and_update(kalman_state * Prev, kalman_model * model, vector * u, vector * y); |
- | vector | + | void predict_state(kalman_model * model, kalman_state * state, vector * u); |
- | matrix | + | void predict_P(kalman_model * model, kalman_state * state); |
matrix optimal_gain(kalman_model * model, kalman_state * state); | matrix optimal_gain(kalman_model * model, kalman_state * state); | ||
- | vector | + | void state_update(kalman_state * state, matrix * K, vector * y); |
- | matrix | + | void P_update(matrix *K, kalman_model * model, kalman_state * state); |
</ | </ | ||
code/kalman_filter.1221085876.txt.gz · Last modified: 2008/09/10 22:31 by laurenceb