Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

dc217863/CarND-Extended-Kalman-Filter-Project

 
 

Repository files navigation

Extended Kalman Filter Project

Self-Driving Car Engineer Nanodegree Program

In this project a kalman filter is used to estimate the state of a moving object of interest with noisy lidar and radar measurements. Passing the project requires obtaining RMSE values that are lower that the tolerance outlined in the project rubric.

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 this concept in the classroom 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

The code consists of the following files:

  • src
    • FusionEKF.cpp
    • FusionEKF.h
    • kalman_filter.cpp
    • kalman_filter.h
    • tools.cpp
    • tools.h
  • .clang-format

Measurement Flow

  • first measurement: the filter will receive initial measurements of an object's position relative to the car. These measurements will come from a radar or lidar sensor.
  • initialize state and covariance matrices: the filter will initialize the object's position based on the first measurement then the car will receive another sensor measurement after a time period Δt.
  • predict: the algorithm will predict where the bicycle will be after time Δt. One basic way to predict the bicycle location after Δt is to assume the object's velocity is constant; thus the object will have moved velocity * Δt.
  • update: the filter compares the "predicted" location with what the sensor measurement says. The predicted location and the measured location are combined to give an updated location. The Kalman filter will put more weight on either the predicted location or the measured location depending on the uncertainty of each value then the car will receive another sensor measurement after a time period Δt. The algorithm then does another predict and update step.

Compare EKF and KF

The extended Kalman filter is almost the same as a basic Kalman filter except the H, and F are different. However, in this case, since I‘m assuming a constant velocity model which is linear, the F is the same.

Results

Dataset 1

RMSE Values:

  • X: 0.09
  • Y: 0.09
  • Vx: 0.47
  • Vy: 0.44

Dataset 2

RMSE Values:

  • X: 0.08
  • Y: 0.09
  • Vx: 0.46
  • Vy: 0.49

main.cpp file Explaination

Here is the main protcol 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"]


Important Dependencies

Code Style

A modified version of the Google's C++ style guide has been used. Clang format was used to make sure of the style format.

Generating Additional Data

No additional data was generated for this project.

To generate extra radar and lidar data, see the utilities repo for Matlab scripts that can generate additional data.

References

Blog

About

Term 2 Project 1: Extended Kalman Filter Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.6%
  • C 1.2%
  • Other 0.2%