Giter Club home page Giter Club logo

behavior-and-path-planning's Introduction

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

$ ./scripts/install_uWS_ubuntu.sh

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

  • Localization data (without noise)

    • ["x"] x in the Cartesian coordinate system, m
    • ["y"] y in the Cartesian coordinate system, m
    • ["s"] s in the Frenet coordinate system, m
    • ["d"] d in the Frenet coordinate system, m
    • ["yaw"] yaw angle, degree
    • ["speed"] speed, MPH
  • Sensor fusion data (without noise)

    • ["sensor_fusion"] A list other cars' data on the same side of the road in the format [[ID, x (m), y (m), vx (m/s), vy (m/s), s (m), d (m)]]
  • Unprocessed previous path data passed to the simulator (not used)

    • ["previous_path_x"] lists of unprocessed x coordinates, m
    • ["previous_path_y"] lists of unprocessed y coordinates, m
  • End point of the previous path (not used)

    • ["end_path_s"] s in the Frenet coordinate system, m
    • ["end_path_d"] d in the Frenet coordinate system, m

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:

  • Estimate the feasible final dynamics (s, d, speed, etc.) of the car in a given state;
  • Greedily search the jerk minimizing trajectories which takes the shortest time and has the shortest distance;
  • Collision check is applied in the Change Lane state. If a collision could happen for the planned path, the car will keep going in the current lane. If a valid path can not be found after a certain time, it will switch back to the Keep Lane state.

Videos (to be updated...)

alt text

Increase the speed to 85 MPH. More exciting!

alt text

behavior-and-path-planning's People

Contributors

zhujun98 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

behavior-and-path-planning's Issues

Debug using VS code

Hi,

Could you please let me know if this code can be debugged using VS code. If so, kindly let me know the procedure as well.

I tried creating a launch.json file and started debugging. However it fails due to Segmentation Fault Error.

Thank you,
KK

fatal error: uWS/uWS.h: No such file or directory

Hi,

Thanks for the useful repository on Path and behavioral planning.

I am getting the below error when I try to build the project using the given steps.

user@computer:~/Github_Repos/behavior-and-path-planning/build$ cmake .. && make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/Github_Repos/behavior-and-path-planning/build
[  4%] Building CXX object CMakeFiles/path_planning.dir/src/main.cpp.o
/home/user/Github_Repos/behavior-and-path-planning/src/main.cpp:6:21: fatal error: uWS/uWS.h: No such file or directory
 #include <uWS/uWS.h>
                     ^
compilation terminated.
CMakeFiles/path_planning.dir/build.make:62: recipe for target 'CMakeFiles/path_planning.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/path_planning.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/path_planning.dir/all' failed
make[1]: *** [CMakeFiles/path_planning.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

After doing some googling, I found that below solution would fix the error.

cd uWebSockets
# git checkout e94b6e1
mkdir build
cd build
cmake ..
make 
sudo make install

However when I try to implement the above solution, I am getting error as given as I dont see any CMakeLists.txt in the directory.

user@computer:~/Github_Repos/uWebSockets/build$ cmake ..
CMake Error: The source directory "/home/user/Github_Repos/uWebSockets" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

Could you please help me get this fixed.

Thank you,
KK

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.