Giter Site home page Giter Site logo

danielsun-ni / carnd-path_planning Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guanyangluo/carnd-path_planning

0.0 0.0 0.0 2.62 MB

Create a path planner that is able to navigate a car safely around a virtual highway

License: MIT License

Shell 0.18% JavaScript 0.07% C++ 83.28% Python 0.08% C 2.01% Fortran 11.39% CSS 0.05% Cuda 1.13% CMake 1.82%

carnd-path_planning's Introduction

Code Model for Generating Paths

Setup for this project can be found here


Path Planning

The goals / steps of this project are the following:

  • Design a path planner that is able to create smooth, safe paths for the car to follow along a 3 lane highway with traffic
  • A successful path planner will be able to keep inside its lane, avoid hitting other cars, and pass slower moving traffic all by using localization, sensor fusion, and map data
  • Reflect on your work in a write-up that details how the project was completed / how to generate paths

main.cpp

The path planning is done in the following steps:

  1. Keep some of the waypoints from the previous path so as to handle latency, and setup the starting point for adding new path
  2. Generate predictions from sensor_fusion data, assuming other cars are traveling at constant velocity and staying in their lanes
  3. Set up a finite state machine (ego) using the Vehicle class, according to the car's position, velocity, etc at the new path starting point
  4. Use the FSM to find a trajectory that gives minimum cost from a set of cost functions in cost.h and cost.cpp
  5. The trajectory is defined by two Vehicle: one describing the ego at the start of the trajectory and the other describing the ego at the end of the trajectory (ego_end)
  6. Use cubic spline to fit a smooth path connecting the positions of the two Vehicle defining the trajectory, with additional "control points" to shape the path to be a smooth continuation of the previous path
  7. Calculate the Frenet s value for each time step in the transition between the start and end points of the trajectory
  8. Obtain the actual waypoints for the path by finding a point in the spline corresponding to the s value

Vehicle Class:

Modified from the Vehicle class in the "Behavior Planning" lesson, this class provides the following:

  1. A finite state machine that tell us what states ego can be in (keep lane, prepare lane change right, lane change left, etc)
  2. Methods to compute a trajectory for each state using physics as well as predictions about other cars around ego
  3. A method to select the next state for ego, based on the cost of the trajectory for each possible successor state
  4. A method to "generate predictions" for the other cars around ego, be calculating each car's physics (position, velocity, etc) at a number of time steps into the future

cost.h and cost.cpp

Modified from the cost.h and cost.cpp in the "Behavior Planning" lesson, these files contain the following:

  1. A cost function for how close the trajectory leads to a goal position and lane. This is not super important for this project, but does help with getting ego to the more maneuverable center lane when there are no other cars
  2. A cost function for how fast ego can travel along the trajectory
  3. A method to add up the costs from each cost function to a weighted cost

carnd-path_planning's People

Contributors

awbrown90 avatar baumanab avatar mvirgo avatar guanyangluo avatar cseas avatar domluna avatar citlaligm avatar jorcus avatar dinoboy197 avatar

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.