Skip to content

Implementation of an Unscented Kalman Filter fusing Lidar and Radar data to estimate the state of an object.

Notifications You must be signed in to change notification settings

justinbellucci/Unscented-Kalman-Filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unscented Kalman Filter

This project implements an Unscented Kalman Filter to estimate the state of multiple cars on a highway environment using noisy lidar and sensor data. Data is fused to estimate the state of each car, represented by their position and velocity in the x and y directions. A UKF object, which implements the Constant Turn Rate Constant Velocity (CTRV) motion model, is updated at each time step to estimate the state of each car. Accuracy is evaluated by comparing the state of each car to the ground truth using Root Mean Square Error (RMSE).

Dependencies for Running Locally

The following dependencies are required to run the program locally.

Build Instructions

  1. Clone the repository and navigate to the downloaded folder.
git clone https://github.com/justinbellucci/Unscented-Kalman-Filter.git  

cd Unscented-Kalman-Filter
  1. Make a build directory in the top level directory:
mkdir build && cd build
  1. Compile
cmake .. 
make
  1. Run the program
./ukf_highway

UKF Architecture

The UKF is implemented as a class containing the following methods:

void ProcessMeasurement(MeasurementPackage &meas_package);

  • Initializes the state and covariance matrices according to the CTRV motion model, if not already initialized. If initialized, the state and covariance matrices are updated.

void Prediction(double &delta_t);

  • Sigma points are generated and predicted according to the CTRV model. The predicted sigma points are used to predict the state and covariance matrices.

void UpdateLidar(MeasurementPackage &meas_package);

  • Updates the state and covariance matrices using a lidar measurement.

void UpdateRadar(MeasurementPackage &meas_package);

  • Updates the state and covariance matrices using a radar measurement assuming the CTRV motion model.

Simulation

The simulation can be manipulated by changing parameters in the highway.h file.


The image below shows the predicted state of each car two seconds into the future illustrated by the green spheres.

double projectedTime = 2;
int projectedSteps = 6;


Radar is not visualized in this image. The red spheres illustrate the center of the lidar point cloud, while green spheres and arrows represent the predicted direction and velocity of the cars.

bool visualize_radar = false;


The radar is visualized by the purple arrows.

bool visualize_radar = true;

Consistancy Check

Normalization Innovation Squared (NIS) is calculated for each sensor and plotted following a chi-squared distribution at each UKF update time step. NIS is the difference between the predicted measurement and the actual measurement normalized in relation to the covariance matrix S. The ./jupyer/NIS.ipynb notebook contains the code for plotting the NIS values. In 5% of all cases the NIS is higher then 7.815 as plotted by the green dashed line below.

Code Style

This project follows Google's C++ style guide.

About

Implementation of an Unscented Kalman Filter fusing Lidar and Radar data to estimate the state of an object.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published