Skip to content
Using C++ to implement an unscented kalman filter for object tracking
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Unscented Kalman Filter

In this project, we use an unscented kalman filter to predict the location and velocity of a simulated bicycle that is traveling around the vehicle. The measurement data comes from lidar and radar sensors with the main algorithm implemented in C++.

Example of Predicted location

In the screenshots below, the green triangles represent the predicted location, the red circles are from the laser sensor, and the blue markers are from the radar sensor. We measure the accuracy of the algorithm by calculating the RMSE of the x, y positions and the velocity along the x, y axis.

alt text

  • The original dataset starting with lidar measurement

If we just use one or the other of the sensor measurements to update the algorithm we can start to see that when taken separately the filter performs worse. This makese sense because with both types of sensors, which are each good at a particular type of sensing, we get more information with which to update our understanding.

alt text

  • The original dataset starting with lidar measurement and only using the lidar measurements to update to algorithm. We can see that compared to using both sources of sensor data the overall algorithm performs worse, especially with regard to the velocity predictions.

alt text

  • The original dataset starting with lidar measurement and only using the radar measurements to update to algorithm. Compared to using only the lidar data, the radar only updated algorithm is worse at localizing the positon (higher RMSE for x and y).

Normalized Innovation Squared (NIS)

To check the consistency of our filter and more specifically to tune our noise parameters, we measured the NIS. The NIS metric gives an approximate idea of whether or not the parameters were initialized in the correct range. Specifically, the NIS follows a Chi-squared distribution and given the number of dimensions we can figure out what the value should be if we expect that only in 5% of the cases the NIS will exceed the value. In our case, for the radar measurement example we have 3 dimensions and the value that we expect to exceed 5% of the time is 7.815. For the lidar, since there are 2 dimensions (the x and y position) the value we expect to exceed ~5% of the time is 5.991.

alt text

  • For the lidar NIS, we see that only in about ~5% of the cases does the value of the NIS exceed the 5.991 value.

alt text

  • Similarly, for the radar NIS, about ~5% of the time the NIS exceeds 7.815

Compile and Build

In order to compile and build this project, make sure that the following dependencies are met.

  • cmake:
    • For Mac make sure that cmake is at least version 3.5
  • make:
    • For Mac make sure that make is at least version 4.1
  • gcc/g++:
    • For Mac make sure that gcc/g++ is at least version 5.4
  • uWebSocketIO
    • From the project directory run, which should be linked to the necessary cmakepatch.txt file
    • In order to run the above shell script, homebrew should also be installed

Once the above dependencies are installed:

  1. Clone this repository
  2. Create a build directory and navigate into it
  • mkdir build && cd build
  1. Compile
  • cmake .. && make
  1. Run the program
You can’t perform that action at this time.