The most important thing in developing a Kalman filter is not data, it's error estimates. The matrices in this example seem to be randomly selected, but you must select them using specific knowledge of your system. In particular:
- Error covariance has units. This is the standard deviation squared. So your position error is in the "squared length" and speed in the "squared time". The values in these matrices will differ depending on whether you work in m or mm.
- You implement the "constant speed" model, but the "processNoiseCov" from the example sets the same values for both process noise and speed. This means that you can be wrong in your position due to the incorrectness of your speed, and you can be wrong because the object is teleported in a way that is independent of speed. In the CV model, you expect the noise of the position process to be very low (mostly non-zero only for numerical reasons and the coverage of the modeling error), and the true unknown system motion will be associated with an unknown speed. This problem also impedes KF’s ability to get speed out of position because the “teleportation error” is not related to speed changes.
- If you put +/- 20 mm errors (you really have to introduce Gaussian noise if you want to simulate perfect behavior), you have an approximate standard deviation of 11.5 mm or variance (11.5 mm) ^ 2, Not knowing what your units are (mm or m), I cannot say what should be the numerical value of "measureNoiseCov", but it is not 0.1 (as in the example).
And finally, even so, everything is correct, remember that KF is ultimately a linear filter. No matter what noise you enter, it will be displayed at the output, it is simply scaled by some coefficient (Kalman gain).
source share