Skip to content

hankkkwu/SDCND-P6-Kidnapped_Vehicle

Repository files navigation

Overview

This repository contains all the code for the Localization course in Udacity's Self-Driving Car Nanodegree.

Project Introduction

My robot has been kidnapped and transported to a new location! Luckily it has a map of this location, a (noisy) GPS estimate of its initial location, and lots of (noisy) sensor and control data.

In this project I implemented a 2 dimensional particle filter in C++. My particle filter was given a map and some initial localization information (analogous to what a GPS would provide). At each time step my filter will also get observation and control data.

You can find the project code in src folder.

Here is how my code works in the simulator:

result video

Running the Code

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.

Here's steps for Ubuntu BASH:

  • Follow this step by step guide for setting up the utility.
  • After setting up Ubuntu BASH, open Ubuntu Bash, and run the following commands inside the Linux Bash Shell:
  1. sudo apt-get update
  2. sudo apt-get install git
  3. sudo apt-get install cmake
  4. sudo apt-get install openssl
  5. sudo apt-get install libssl-dev
  6. sudo apt install zlib1g-dev
  7. git clone https://github.com/hankkkwu/SDCND-P6-Kidnapped_Vehicle
  8. sudo rm /usr/lib/libuWS.so
  9. navigate to SDCND-P6-Kidnapped_Vehicle
  10. ./install-ubuntu.sh
  11. at the top level of the project repository mkdir build && cd build
  12. from /build cmake .. && make
  13. Launch the simulator from Windows and execute ./particle_filter for the project. If you see this message Listening to port 4567 Connected!!!, it is working!!
  • Trouble Shooting

    • .sh files not recognized on run: Try chmod a+x <filename.sh> for example chmod a+x install-ubuntu.sh

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

  1. mkdir build
  2. cd build
  3. cmake ..
  4. make
  5. ./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:

  1. ./clean.sh
  2. ./build.sh
  3. ./run.sh

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

Implementing the Particle Filter

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

Inputs to the Particle Filter

You can find the inputs to the particle filter in the data directory.

The Map*

map_data.txt includes the position of landmarks (in meters) on an arbitrary Cartesian coordinate system. Each row has three columns

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

All other data the simulator provides, such as observations and controls.

  • Map data provided by 3D Mapping Solutions GmbH.

Success Criteria

If your particle filter passes the current grading code in the simulator (you can make sure you have the current version at any time by doing a git pull), then you should pass!

The things the grading code is looking for are:

  1. Accuracy: your particle filter should localize vehicle position and yaw to within the values specified in the parameters max_translation_error and max_yaw_error in src/main.cpp.

  2. Performance: your particle filter should complete execution within the time of 100 seconds.

Releases

No releases published

Packages

No packages published

Languages