avivace / kalman

Interactive and real time 2D simulation of the Kalman Filter in use to reduce statistical input noise.

Home Page:https://avivace.github.io/kalman

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kalman Filter

Final project for the Probabilistic models for decision making course, from my MSc in Computer Science: an interactive and real time 2D simulation of the Kalman Filter in use to reduce input noise.

The Kalman Filter is an algorithm that uses a series of measurements observed over time, containing statistical noise and other inaccuracies, and produces estimates of unknown variables that tend to be more accurate than those based on a single measurement alone, by estimating a joint probability distribution over the variables for each timeframe. The algorithm works in a two-step process. In the prediction step, the Kalman filter produces estimates of the current state variables, along with their uncertainties. Once the outcome of the next measurement (necessarily corrupted with some amount of error, including random noise) is observed, these estimates are updated using a weighted average, with more weight being given to estimates with higher certainty. The algorithm is recursive. It can run in real time, using only the present input measurements and the previously calculated state and its uncertainty matrix; no additional past information is required.

Algorithm pseudocode:

m = [X, Y, deltaX, deltaY]  ← measurement vector
c = [0, 0, 0, 0]            ← control vector (not used here)

Prediction Step:
x = (A * x) + (B * c)
P = (A * P * AT) + Q        ← AT is the matrix transpose of A

Correction Step:
S = (H * P * HT) + R        ← HT is the matrix transpose of H
K = P * HT * S-1            ← S-1 is the matrix inverse of S
y = m - (H * x)
x = x + (K * y)
P = (I - (K * H)) * P       ← I is the Identity matrix


If prediction is enabled, the prediction step is looped for n 
    more frames after the above code is executed:

predX = x
predX = (A * predX) + (B * c)


The estimated position of the cursor is in the x vector:

x ← [xPos, yPos, xVel, yVel] 

Deploy

git clone
npm install
npm run serve

Publish on avivace.github.io/kalman:

npm run deploy

Development is done on the develop branch due to GitHub's restriction on branches for user pages (the build is deployed on the master branch and published to avivace.github.io/kalman from there).

Stack

References and papers

Acknowledgements

Manuele Rota for cleaning up some of my trash code and improving the animation logic

About

Interactive and real time 2D simulation of the Kalman Filter in use to reduce statistical input noise.

https://avivace.github.io/kalman

License:GNU General Public License v3.0


Languages

Language:Vue 94.5%Language:HTML 3.5%Language:JavaScript 2.0%