Skip to content

A C++ based implementation of the Particle Filter. The simulator has been developed by Udacity which is used to visualize performance.

License

Notifications You must be signed in to change notification settings

suprateembanerjee/Particle-Filter

Repository files navigation

Particle Filter

Udacity Self-Driving Car Engineer Nanodegree Program

This project involves the a Simulator developed by Udacity which can be downloaded here.

Dependencies

  • g++ 9.3 Installation Instructions: Mac Windows
  • Ubuntu Terminal for running UNIX Terminal on Windows. download
  • uWebSocketIO for smooth data flow between simulator and code. download
    <Navigate to the project folder using Ubuntu terminal>
    chmod u+x install-ubuntu.sh
    ./install-ubuntu.sh
    ./install-linux.sh
    
    If you install from source, checkout to commit e94b6e1, i.e.
    git clone https://github.com/uWebSockets/uWebSockets 
    cd uWebSockets
    git checkout e94b6e1
    
  • cmake 3.5 Installation Instructions
  • make 4.1 (Linux and Mac), 3.81 (Windows) Installation Instructions : Mac Windows

Installation and Usage

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.

Once the install for uWebSocketIO is complete, the main program can be built and ran by doing the following from the project top directory.

mkdir build && cd build
cmake .. && make
./particle_filter

Alternatively some scripts have been included to streamline this process, these can be leveraged by executing the following in the top directory of the project:

./clean.sh
./build.sh
./run.sh

On the Ubuntu Terminal, we can observe that the program is listening to a port. Now, if the Simulator is launched, it should automatically connect and execute.

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

// sense noisy position data from the simulator

["sense_x"]

["sense_y"]

["sense_theta"]

// get the previous velocity and yaw rate to predict the particle's transitioned state

["previous_velocity"]

["previous_yawrate"]

// receive noisy observation data from the simulator, in a respective list of x/y values

["sense_observations_x"]

["sense_observations_y"]

OUTPUT: values provided by the c++ program to the simulator

// best particle values used for calculating the error evaluation

["best_particle_x"]

["best_particle_y"]

["best_particle_theta"]

//Optional message data used for debugging particle's sensing and associations

// for respective (x,y) sensed positions ID label

["best_particle_associations"]

// for respective (x,y) sensed positions

["best_particle_sense_x"] <= list of sensed x positions

["best_particle_sense_y"] <= list of sensed y positions

Data

The data is located in a file titled map_data.txt under the directory titled data.

Format:

Each row has three columns:

  1. x position
  2. y position
  3. landmark id

The directory structure of this repository is as follows:

root
|   build.sh
|   clean.sh
|   CMakeLists.txt
|   README.md
|   run.sh
|
|___data
|   |   
|   |   map_data.txt
|   
|   
|___src
    |   helper_functions.h
    |   main.cpp
    |   map.h
    |   particle_filter.cpp
    |   particle_filter.h

Output

The image below shows three points at each timeframe. There are landmarks (marked with crossed black circles) but only some are within range of the sensors in the car (marked with green lines). Using these landmarks, the car estimates its position on the map (marked with blue circle). We know the Particle Filter works because it more or less coincides with the position of the car. A video of the output titled Output.mp4 can also be found in the repository.

alt text

About

A C++ based implementation of the Particle Filter. The simulator has been developed by Udacity which is used to visualize performance.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages