Coder Social home page Coder Social logo

avivace / kalman Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 4.0 15.22 MB

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

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

License: GNU General Public License v3.0

JavaScript 1.99% HTML 3.50% Vue 94.52%
kalman-filter noise estimates simulation 2d-simulation algorithm demo implementation kalman kalman-tracking

kalman's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.