Giter Club home page Giter Club logo

kalmanfilter's Introduction

Kalman Filter

Kalman Filters are used for state estimation in control systems when noisy measurements are present. This repository includes an implementation of the algorithm in Python and also a Jupyter Notebook for testing in real data for altitude estimation of a quadrotor. The algorithm was applied in the quad using a sensor-fusion technique by blending the measurements from the barometric pressure sensor and the accelerometer to provide altitude (relative height of the quad) estimation.

Kalman Algorithm

Initialization

  1. Start

  2. Initialize the state estimate: $\hat{x}_{0|0}$ and the error covariance estimate: $P_{0|0}$

Prediction Step

  1. Predict the state for the next time step:
    $\hat{x}_{k|k-1} = A_k \hat{x}_{k-1|k-1} + B_k u_k$

  2. Predict the error covariance for the next time step:
    $P_{k|k-1} = A_k P_{k-1|k-1} A_k^T + Q_k$

Correct Step

  1. Compute the Kalman Gain:
    $K_k = P_{k|k-1} H_k^T (H_k P_{k|k-1} H_k^T + R_k)^{-1}$

  2. Update the state estimate:
    $\hat{x}_{k|k} = \hat{x}_{k|k-1} + K_k(z_k - H_k \hat{x}_{k|k-1})$

  3. Update the error covariance estimate:
    $P_{k|k} = (I - K_k H_k)P_{k|k-1}$

    Go to 2

The matrices and vectors in the above equations are defined as follows:

  • $A_k$: State transition matrix for time step $k$
  • $B_k$: Input control matrix for time step $k$
  • $u_k$: Control input at time step $k$
  • $Q_k$: Process noise covariance matrix at time step $k$
  • $H_k$: Measurement matrix at time step $k$
  • $R_k$: Measurement noise covariance matrix at time step $k$
  • $z_k$: Measurement vector at time step $k$
  • $I$: Identity matrix

kalmanfilter's People

Contributors

sppap avatar

Stargazers

 avatar

Watchers

 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.