FarHorizonsTest / SensorKalmanFilter

0 stars 0 forks source link

Kalman routine reverses predict and update phases #2

Open lnigra opened 10 years ago

lnigra commented 10 years ago

The Kalman(...) procedure has the "predict" equations following the "update" ("correct") equations. It should be the other way around. Kalman filter is a "predictor-corrector", in that order.

lnigra commented 10 years ago

I fixed this in the 3StateKalman.py code in the LouThreeState branch. The TwoSensor branch code needs to be fixed in a similar manner. Follow that example with the following changes. There's no need to convert it to matrices, just fix the Kalman procedure and start using it on the second sample instead of the first:

  1. Move the "PREDICT" equations of Kalman(...) procedure to before the "UPDATE" equations.
  2. Set the first result value to the initial value of x instead of letting the Kalman filter set it. The Kalman routine can then be called on the second sample. It will use the initial value of the first sample as it's previous estimate. So the "for" statement should start at index 1 instead of zero.