spafe.utils.filters¶
-
spafe.utils.filters.
kalman
(x, P, measurement, R, motion, Q, F, H)[source]¶ Parameters: - x – initial state
- P – initial uncertainty convariance matrix
- measurement – observed position (same shape as H*x)
- R – measurement noise (same shape as H)
- motion – external motion added to state vector x
- Q – motion noise (same shape as P)
- F – next state function: x_prime = F*x
- H – measurement function: position = H*x
Returns: the updated and predicted new values for (x, P)
See also http://en.wikipedia.org/wiki/Kalman_filter
This version of kalman can be applied to many different situations by appropriately defining F and H.
-
spafe.utils.filters.
kalman_xy
(x, P, measurement, R, motion=matrix([[0.], [0.], [0.], [0.]]), Q=matrix([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]))[source]¶ Parameters: - x – initial state 4-tuple of location and velocity: (x0, x1, x0_dot, x1_dot)
- P – initial uncertainty convariance matrix
- measurement – observed position
- R – measurement noise
- motion – external motion added to state vector x
- Q – motion noise (same shape as P)