zhujun98 / behavior-and-path-planning

Self-Driving Car Nanodegree
GNU General Public License v3.0
15 stars 5 forks source link
self-driving-car-engineer

Behavior and Path Planning

Udacity - Self-Driving Car NanoDegree Build Status

In this project, the goal is to safely navigate around a virtual highway with other vehicles that are driving +-10 MPH of the 50 MPH speed limit. You will be provided the car's localization and sensor fusion data, there is also a sparse map list of waypoints around the highway. The car should try to go as close as possible to the 50 MPH speed limit, which means passing slower traffic when possible, note that other cars will try to change lanes too. The car should avoid hitting other cars at all cost as well as driving inside of the marked road lanes at all times, unless going from one lane to another. The car should be able to make one complete loop around the 6946 m highway. Since the car is trying to go 50 MPH, it should take a little over 5 minutes to complete 1 loop. Also the car should not experience total acceleration over 10 m/s^2 and jerk over 10 m/s^3.

Dependencies

Download

$ git clone https://github.com/zhujun98/behavior-and-path-planning.git

Update submodules (Eigen3)

$ git submodule init
$ git submodule update

Build, install and run

With CMake

$ mkdir build && cd build
$ cmake .. && make -j4
$ cd apps
$ ./run_app MAP_FILE # the default MAP_FILE is "data/highway_map.csv"

To use boost.log in this project:

$ ./scripts/install_boost.sh
$ mkdir build && cd build
$ cmake -DWITH_BOOST .. && make -j4

To build and run the test:

$ mkdir build && cd build
$ cmake -DBUILD_TESTS .. && make -j4
$ make unittest

With Bazel

Install Bazel following the official instruction and then type

$ bazel build ...
$ bazel run apps:run_app MAP_FILE

Highway map

The map data of the highway is listed in highway_map.csv. Each row of the data contains [x, y, s, dx, dy] values for a waypoint, where x and y are the coordinates in the global coordinate system, s is the longitudinal coordinate along the reference trajectory, dx and dy define the x and y components of the unit vector d which is normal (pointing to the right of the traffic direction) to the reference trajectory.

highway map

Simulator output

Behavior planning

Behavior planning is achieved by using the FSM pattern:

Start Up -> Keep Lane <-> Change Lane

Path planning

The following strategy is applied in searching the optimized path:

Videos (to be updated...)

alt text

Increase the speed to 85 MPH. More exciting!

alt text