Coder Social home page Coder Social logo

maleicacid / extended-kalman-filter-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antonpavlov/extended-kalman-filter

0.0 1.0 0.0 3.52 MB

2D object tracking with Extended Kalman filter

License: MIT License

CMake 0.22% Makefile 0.22% C++ 98.35% C 1.21%

extended-kalman-filter-1's Introduction

Extended-Kalman-Filter

This repository contains an implementation of the Extanded Kalman filter for 2D object tracking based on two different types of observations.

Error in VY

Introduction

For a linear state-space model driven by temporally uncorrelated Gaussian noise, R. E. Kalman derived a recursive algorithm that computes the exact optimal minimum mean square estimate of the hidden state sk at instant k given a sequence of observations z1:k = {z1, z2, . . . , zk} from instant 1 up to instant k. However, in many real-world scenarios, the assumptions of linearity and Gaussianity may not be realistic. For these nonlinear, non-Gaussian systems, the recursive estimation problem requires the recursive propagation of the full posterior probability distribution of the hidden state conditioned on the observations. Unfortunately, in a general nonlinear, non-Gaussian setting, there is no analytically tractable solution for exact computation of the optimal MMSE estimate. Approximations become therefore necessary.

There are several different approaches to approximate the posterior distribution of the hidden state vector in general nonlinear estimation problems. The most popular of them are numerical and parametric approximations. A good example of parametric approximation is the well-known Extended Kalman Filter introduced by B. D. O. Anderson and J.B. MOORE in 1979. The EKF approximates the posterior probability density function of the hidden state vector at each instant k, p(sk|z1:k), by a single multivariate Gaussian function whose mean, s'k|k, and corresponding covariance matrix, Pk|k are then updated in the instant k + 1 using the standard Kalman filter recursions associated with the linearized state and observation models.

As an alternative to parametric methods like the EKF, numerical methods such as grid filters attempt to represent the continuous state space by discrete, finite lattices. But these grid filters and Sequential Monte Carlo methods are a whole different story/repo.

Dependencies, compilation and running

In order to successfully run this project, the Term 2 Simulator term2_sim should be downloaded. Here is the link to download it for different platforms.

From the tools perspective, the following packages are necessary:

  • cmake >= 3.5
  • make >= 4.1 (Linux, Mac), 3.81 (Windows)
  • gcc/g++ >= 5.4

The filter communicates with simulator via uWebSocketIO.

Clone this repo into your computer, install all dependencies into default folders or update Makefile with your local paths. Compile the program with make command.

Run the ExtendedKF and term2_sim on the same computer. Both applications will connect to each other via port 4567. They will exchange JSON objects containing object trajectory parameters on the simulator side and their estimation on the Extended Kalman filter side.

This program was tested in Mac OS X 10.13.2 / Xcode 9.2 environment, but it should run in Linux as well.

Extended Kalman Filter

Under the hood, the Extended Kalman filetr utilizes first order terms in the Taylor series expansion of the nonlinear state and measurement equations and approximates the posterior pdf of the hidden state conditioned on the observations by a multivariate normal function.

The filter algorithm is initilized with the first measurments. See, FusionEKF::ProcessMeasurement method in the FusionEKF.cpp. In the consecutive timestamps the following steps are executed:

  • Prediction step, where we predict a next positon of the object and its covariance matrix. See, KalmanFilter::Predict() and FusionEKF::ProcessMeasurement methods in kalman_filter.cpp and FusionEKF.cpp respectively.
  • Update step, where depending on the source of the measurements, we update the tracking object position with a lidar HLidar and RLidar matrices or HJacobian and RRadar.

Simulation Results

In order to test an EKF trackingapproach a simulation was performed. In that simulation two sensors (lidar and radar) were tracking the object (a blue car) on 2D plane. These results are shown in a figures below.

Error in X Error in Y
Error in VX Error in VY

For each component of the state vector, the Extanded Kalman filter performs better when provided with both measurments, from a radar and a lidar sensors.

License

Contents of this repository are licensed under MIT License agreement.

extended-kalman-filter-1's People

Contributors

antonpavlov 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.