Giter Club home page Giter Club logo

kalman-filter's Introduction

Kalman Filter

author: Jacky Wang

All code is written in Python, if there is any question please feel free to ask.

How to Compile the program

Please make sure you have installed those packages.

numpy
matplotlib
pickle
  • troubleshooting: pickle is not available if python.version < 3.6

Running: python main.py [-s] [save_img, default:True] The saved image will save into output folder
After running main.py, it will show these infomation below:

  1. The true path of the robot
  2. The output of the Kalman Filter for the path of the robot
  3. In a separate subwindow show the variance of the Kalman Filter against time
  4. In a separate subwindow show the error of the Kalman Filter path against time
  5. Average error
  6. variance of error

Object detection example using Kalman filter

Interesting features and extensions of Kalman filter. After running the code, make sure you have installed this package.

pip install opencv-python

Running: python find_targeting_kalman_filter.py

This example will detect object with color blue.
And green point is predicted value of Kalman filter.
Red point is true point which is centroid of object.

The result shows that the green point will track the red point as much as possible.

Kalman filter notes

F: transition Matrix
X: state matrix
U: control variable matrix
W: noise in the process
t: time for 1 circle
H: measurement Matrix

P: state covariance matrix (error in the estimate)
If P -> 0:
Then measurement updates are mostly ignored

P = [[ var_11, cvar12], [ cvar12, var_22]]
If the estimate error for the one variable position is completely independent of the other variable velocity Then the covariance elements = cvar12 = 0

Q: process noise covariance matrix # processNoiseCov
(keep the P from becoming too small or going to zero)

R: measurement covariance matrix (error in the measurement) #measurementCovMatrix
K: kalman gain
(weight factor based on comparing the error in the estimate to the error in the measurement)

if R -> 0:
then K -> 1 (adjust primarily with the measurement update)

if R -> unlimited:
then K -> 0 (adjust primarily with the predicted state)

Reference

http://www.sherrytowers.com/kalman_filter_method.pdf
http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf
http://web.mit.edu/kirtley/kirtley/binlustuff/literature/control/Kalman%20filter.pdf
https://zhuanlan.zhihu.com/p/40413223
https://dsp.stackexchange.com/questions/50026/using-the-kalman-filter-given-acceleration-to-estimate-position-and-velocity
https://www.youtube.com/watch?v=CaCcOwJPytQ&list=PLX2gX-ftPVXU3oUFNATxGXY90AULiqnWT

kalman-filter's People

Contributors

jacky1107 avatar

Watchers

James Cloos avatar  avatar

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.