/CarND-Extended-Kalman-Filter-Project

Self-Driving Car Nanodegree Program Starter Code for the Extended Kalman Filter Project

Primary LanguageC++MIT LicenseMIT

Extended Kalman Filter Project

Self-Driving Car Engineer Nanodegree Program


Overview

In this project a kalman filter was implemented to estimate the state of a moving object of interest with noisy lidar and radar measurements. The kalman filter is evaluated using RMSE values.

Results

The following gif shows the results of the kalman filter. Laser measurements are represented by red dots, radar measurements by blue dots with arrows inside. The green triangles show the predicted position values. The required goal of an RMSE less than [.11, .11, 0.52, 0.52] was achieved with the values [0.096, 0.085, 0.436, 0.428].

gif

Kalman Filter Scheme

The following figure from the udacity lessons shows the general flow of the kalman filter.

  • After initializing the matrices F and P and the state x based on the first measurement values, x' and P' are predicted, based on the current timestep delta_t.
  • Depending on from which sensor type a value was received, matrices are either set up directly (laser) or after a linearization with a jacobian matrix (radar).
  • Finally, the update is executed using the standard kalman filter equations for laser or the extended equations including the jacobian matrix and a conversion from cartesian to polar coordinates for radar.
  • Prediction and update step are executed alternating afterwards.

png png


Ressources

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

This 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. Please see the uWebSocketIO Starter Guide page in the classroom within the EKF Project lesson for the required version and installation scripts.

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

Tips for setting up your environment can be found in the classroom lesson for this project.

Note that the programs that need to be written to accomplish the project are src/FusionEKF.cpp, src/FusionEKF.h, kalman_filter.cpp, kalman_filter.h, tools.cpp, and tools.h

The program main.cpp has already been filled out, but feel free to modify it.

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