• Stars
    star
    265
  • Rank 149,593 (Top 4 %)
  • Language
    C++
  • License
    MIT License
  • Created about 7 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An unscented Kalman Filter implementation for fusing lidar and radar sensor measurements.

๐Ÿณ โ˜•๏ธ ๐Ÿงง

INTRODUCTION

This is an unscented Kalman Filter implementation in C++ for fusing lidar and radar sensor measurements. A Kalman filter can be used anywhere where you have uncertain information about some dynamic system, and you want to make an educated guess about what the system is going to do next.

In this case, we have two 'noisy' sensors:

  • A lidar sensor that measures a tracked object's position in cartesian-coordinates (x, y)
  • A radar sensor that measures a tracked object's position and relative velocity (the velocity within line of sight) in polar coordinates (rho, phi, drho)

We want to predict a tracked object's position, how fast it's going in what direction, and how fast it is turning (yaw rate) at any point in time.

  • In essence we want to get: the position of the system in cartesian coordinates, the velocity magnitude, the yaw angle in radians, and yaw rate in radians per second (x, y, v, yaw, yawrate)
  • We are assuming a constant turn/yaw rate and velocity magnitude model (CRTV) for this particular system

This unscented kalman filter does just that.

  • NOTE: Compared with an Extended Kalman Filter with a constant velocity model, RMSE should be lower for the unscented Kalman filter especially for velocity. The CTRV model is more precise than a constant velocity model. And UKF is also known for handling non-linear equations better than EKF.
  • Harvard Paper about UKF

CONTENTS

  • Basic Usage
  • Notes

BASIC USAGE

  • Dependencies are same as in here
  • Clone this repository
$ git clone https://github.com/mithi/fusion-ukf/
  • Go inside the build folder and compile:
$ cd build
$ CC=gcc-6 cmake .. && make
  • To execute inside the build folder use the following format:
$ ./unscentedKF /PATH/TO/INPUT/FILE /PATH/TO/OUTPUT/FILE
$ ./unscentedKF ../data/data-3.txt ../data/out-3.txt
  • Please use the following format for your input file
L(for lidar) m_x m_y t r_x r_y r_vx r_vy, r_yaw, r_yawrate
R(for radar) m_rho m_phi m_drho t r_px r_py r_vx r_vy, r_yaw, r_yawrate

Where:
(m_x, m_y) - measurements by the lidar
(m_rho, m_phi, m_drho) - measurements by the radar in polar coordinates
(t) - timestamp in unix/epoch time the measurements were taken
(r_x, r_y, r_vx, r_vy, r_yaw, r_yawrate) - the real ground truth state of the system

Example:
L 3.122427e-01  5.803398e-01  1477010443000000  6.000000e-01  6.000000e-01  5.199937e+00  0 0 6.911322e-03
R 1.014892e+00  5.543292e-01  4.892807e+00  1477010443050000  8.599968e-01  6.000449e-01  5.199747e+00  1.796856e-03  3.455661e-04  1.382155e-02
  • The program outputs the predictions in the following format on the output file path you specified:
time_stamp  px_state  py_state  v_state yaw_angle_state yaw_rate_state  sensor_type NIS px_measured py_measured px_ground_truth py_ground_truth vx_ground_truth vy_ground_truth
1477010443000000  0.312243  0.58034 0 0 0 lidar 2.32384e-319  0.312243  0.58034 0.6 0.6 0 0
1477010443050000  0.735335  0.629467  7.20389 9.78669e-18 5.42626e-17 radar 74.6701 0.862916  0.534212  0.859997  0.600045  0.000345533 4.77611e-06
...

NOTES

If you take a look at settings you'll see the following:

//process noise standard deviations
const double STD_SPEED_NOISE = 0.9; // longitudinal acceleration in m/s^2
const double STD_YAWRATE_NOISE = 0.6; // yaw acceleration in rad/s^2

Here's the terminal output from the given data set

terminal output

Here's a visualization of how it's performing

Visualization

Here's a visualization of the Radar's NIS

Radar's NIS

Here's a visualization of the Lidar's NIS

Lidar's NIS

Here's my UKF algorithm overview

UKF Algorithm Overview

And here's an overview of what the instantiated classes are doing

UKF Algorithm Overview 2

๐Ÿณ โ˜•๏ธ ๐Ÿงง

More Repositories

1

react-philosophies

๐Ÿง˜ Things I think about when I write React code ๐Ÿง˜
3,385
star
2

robotics-coursework

๐Ÿค– Places where you can learn robotics (and stuff like that) online ๐Ÿค–
2,461
star
3

hexapod-robot-simulator

A hexapod robot simulator built from first principles
Python
746
star
4

hexapod

Blazing fast hexapod robot simulator for the web.
JavaScript
551
star
5

epic-react-exercises

Practical React exercises with detailed solutions.
JavaScript
158
star
6

mpc

A software pipeline using the Model Predictive Control method to drive a car around a virtual track.
C++
142
star
7

rusty-genes

Genetic algorithm implementation in Rust with animated visualizations in Python
Rust
138
star
8

cpp-resources

A small collection of notes about basic C++
C++
131
star
9

fusion-ekf

An extended Kalman Filter implementation in C++ for fusing lidar and radar sensor measurements.
C++
131
star
10

hexy

Code for a hexapod robot
Python
85
star
11

vehicle-tracking-2

A vehicle detection and tracking pipeline with OpenCV, histogram of oriented gradients (HOG), and support vector machines (SVM).
Jupyter Notebook
83
star
12

advanced-lane-detection

An advanced lane-finding algorithm using distortion correction, image rectification, color transforms, and gradient thresholding.
Jupyter Notebook
80
star
13

algorithm-playground

An (old) and unstructured (messy tbh) collection of programming exercises.
Jupyter Notebook
79
star
14

hexapod-irl

A "fork" of Bare-Minimum Hexapod Robot Simulator 2 modified to be able to control a real physical hexapod robot.
JavaScript
71
star
15

fusion-ekf-python

An extended Kalman Filter implementation in Python for fusing lidar and radar sensor measurements
Jupyter Notebook
63
star
16

simple-cryptography

Scripts that illustrate basic cryptography concepts based on Coursera Standford Cryptography I course and more.
Python
57
star
17

hello-3d-world

Plot 3d points, lines, and polygon on an svg. A demonstration of what you can do with the BareMinimum3d package
TypeScript
57
star
18

point-cloud-clusters

A catkin workspace in ROS which uses DBSCAN to identify which points in a point cloud belong to the same object.
Python
56
star
19

arm-ik

An Inverse Kinematics 6DOF Robot Arm Pick and Place Project in ROS.
Jupyter Notebook
55
star
20

point-cloud-filter

Scripts showcasing filtering techniques applied to point cloud data.
Python
48
star
21

particle-filter-prototype

Particle Filter Implementations in Python and C++, with lecture notes and visualizations
Jupyter Notebook
41
star
22

highway-path-planning

My path-planning pipeline to navigate a car safely around a virtual highway with other traffic.
C++
40
star
23

hexapod-kinematics-library

Code you can use to solve forward / inverse kinematics and generate walk sequences of hexapod robots
JavaScript
35
star
24

bare-minimum-3d

A small package to transform declared 3d data (points, polygons, lines) to 2d data.
TypeScript
33
star
25

arduino-basic

Code for an Arduino Boot Camp with emphasis on ditching delay(), basic object-oriented programming, and clean readable code.
C++
30
star
26

semantic-segmentation

A Fully Convolutional Network (FCN) script to label the pixels of a road in images
Jupyter Notebook
27
star
27

deep-blueberry

If you've always wanted to learn about deep-learning but don't know where to start, then you might have stumbled upon the right place!
23
star
28

crypto

Is Bitcoin cloud mining profitable? Check the notebook to find out! (Not Clickbait)
Jupyter Notebook
23
star
29

bare-minimum-2d

An extremely lightweight React component to declaratively (and elegantly) plot shapes on an inline SVG
JavaScript
22
star
30

hellobot-raspberry

Code for various mobile robotics projects
C++
18
star
31

hello-tiny-box

๐Ÿ“ฆ Manipulate a three dimensional box ๐Ÿ“ฆ
JavaScript
17
star
32

digital-garden

๐ŸŒฑ๐ŸŒทMithi's digital garden built with NextJS
TypeScript
16
star
33

traffic-signs-classification

A deep neural network to classify traffic signs, using TensorFlow.
Jupyter Notebook
15
star
34

some-udacity-projects

Some of my projects as a former mentor, reviewer, and beta-tester of Robotics and Self-Driving Car ND
Jupyter Notebook
14
star
35

bossy

๐ŸŽฎ Contains the code that can be used with Bossy controllers and derivatives ๐ŸŽฎ
C++
10
star
36

coding-exercises

Coding exercises for fun and profit
JavaScript
8
star
37

kingdom-rush-graphql

Simply get Kingdom Rush Tower information through queries in GraphQL
TypeScript
8
star
38

sdc-talk

A workshop about a problem-solving philosophy, machine learning intuitions, and behavioral cloning in the context of DIY self-driving / self-racing cars.
6
star
39

mithi

My github profile readme
5
star
40

robotics-blog

My robotics blog
HTML
5
star
41

portal-clone

TypeScript
2
star
42

wordpress-archive

Articles I wrote about hexapod robots and the lego technic 4x4 crawler
2
star