/Extended-Kalman-Filter

In this project, we will use an extended kalman filter relying on a Radar and a Lidar to predict the next position and velocity of a vehicule on a 2D map.

Primary LanguageC++

Extended-Kalman-Filter

Introduction

In this project, we will use an extended kalman filter relying on a noisy Radar and a Lidar measurements to estimate the state of a moving object on a 2D map. We can see the results in the image bellow:

Driving Example

Lidar measurements are red circles, radar measurements are blue circles with an arrow pointing in the direction of the observed angle, and estimation markers are green triangles. On the bellow image we can see them better:

Zoom In Example

Files description

  • Kalman.cpp is the script file containing the Kalman class use to predict and update the state of our car.

  • FusionEKF.cpp is the script file use to initialise the variables and decide which kalman function to use in which order.

  • Tools.cpp is the script use to implement the RMSE (Root Main Square Error) of our kalman filter and also use to implement the jacobian function which is needed for the extended kalman filter update function.

Getting Started

This project involves the Term 2 Simulator from Udacity which can be downloaded here.

Download the Udacity project on extended kalman filter and then replace the kalman.cpp, FusionEKF.cpp and Tools.cpp files in the src folder by the ones from this repository.

The Udacity repository includes two files that can be used to set up and install uWebSocketIO for either Linux or Mac systems. For windows you can use either Docker, VMware, or even Windows 10 Bash on Ubuntu to install uWebSocketIO.

Once the install for uWebSocketIO is complete, the main program can be built and run by doing the following from the project top directory.

  1. mkdir build
  2. cd build
  3. cmake ..
  4. make
  5. ./ExtendedKF

Then you only need to open the executable file in the simulation folder to see your algorithm evolving.

Here is the main protocol that main.cpp uses for uWebSocketIO in communicating with the simulator.

INPUT: values provided by the simulator to the c++ program

["sensor_measurement"] => the measurement that the simulator observed (either lidar or radar)

OUTPUT: values provided by the c++ program to the simulator

["estimate_x"] <= kalman filter estimated position x

["estimate_y"] <= kalman filter estimated position y

["rmse_x"]

["rmse_y"]

["rmse_vx"]

["rmse_vy"]

Other Important Dependencies

Basic Build Instructions

  1. Clone this repo.
  2. Make a build directory: mkdir build && cd build
  3. Compile: cmake .. && make
    • On windows, you may need to run: cmake .. -G "Unix Makefiles" && make
  4. Run it: ./ExtendedKF

Generating Additional Data

If you'd like to generate your own radar and lidar data, see the utilities repo for Matlab scripts that can generate additional data.