mpdivecha / Path-Planning

Path planning to safely navigate a car around a simulated highway

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CarND-Path-Planning-Project

Self-Driving Car Engineer Nanodegree Program

Goals

The goal of the project is to safely navigate around a virtual highway with other traffic that is driving +- 10 MPH of the 50 MPH speed limit. The car should try to go as close as possible to the 50 MPH speed limit, which means passing slower traffic when possible. The car should avoid hitting other cars at all cost as well as drive inside of the marked road lane lines at all times, unless changing lanes. The car should be able to make one complete loop around the 6946m highway. Also the car should not experience total acceleration over 10 m/s^2 and jerk that is greater than 10 m/s^3.

The following paragraphs explain the approach taken to solve the problems posed in the project. For the original README and setup instructions, please see setup.md

Trajectory planning

Trajectory prediction

An important part of autonomous navigation in the complex world of highway driving is to determine the location of other vehicles and try to predict what trajectories they may take in the immediate future. This then becomes an important factor in planning the future behavior of the ego vehicle.

In the project this is done in main.cpp#L255-306. This is accomplished by determining if there are other vehicles in the immediate vicinity of our vehicle. The inputs that we consider are telemetry and the sensor fusion data that we receive from the simulator. The flags car_front_lane, car_left_lane and car_right_lane designate if there is a vehicle ahead, left or right of us respectively, within the 30m buffer_dist.

Behavior planning

Once we have determined the positions and trajectories of other vehicles on the road, we can plan for the behavior of the ego vehicle. We have taken a simple approach in this project. If there is a car ahead of us that is driving slowly and there's room on the left or right lanes to merge safely, we merge. If there's no room, then we deaccelerate to keep safe distance from the vehicle ahead of us.

On the other hand, if the there's no car ahead of us, but we are not in the center lane, then we merge into the center lane safely. Alternately, if we are at a speed below the maximum speed limit, then we accelerate. The code for behavior planning is in main.cpp#L308-332.

Trajectory generation

Based on the desired behavior, we generate new waypoints for the vehicle to follow. We use the cubic spline interpolation library to derive a smooth trajectory. To make sure that trajectory follows smoothly from previous waypoints, we select the last two points from the left-over previous trajectory. We then add new three new waypoints (main.cpp#L370-372). These points are corrected so that the origin and heading is congruent to the vehicles center and heading. To generate the new points, we copy over the points remaining from the previous trajectory and append new points from the spline that are 30m apart in the x-coordinate. (main.cpp#404-429).

##Demo

A demo of the project can be found here

IMAGE ALT TEXT

About

Path planning to safely navigate a car around a simulated highway

License:MIT License


Languages

Language:C++ 83.1%Language:Fortran 11.5%Language:C 2.0%Language:CMake 1.8%Language:Cuda 1.1%Language:Shell 0.2%Language:Python 0.1%Language:JavaScript 0.1%Language:CSS 0.0%