CarND-Path-Planning

Goal of this project

In this project the goal is to safely navigate around a virtual highway with other traffic that is driving +-10 MPH of the 50 MPH speed limit. We are 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 6946m 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 that is greater than 10 m/s^3.

Trajectory generation

We use the last two points of the previous trajectory and three points at distances 30m, 60m and 90m to initialize the spline calculation Also to make calculations simple for the spline calculation based on the above mentioned points, the coordinates are transformed (shift and rotation) to local car coordinates. To generate new points in the trajectory first we add the points in the previous path and then we evaluate the spline generated for new points. These new points obtained by evaluation of spline are then transformed to global co-ordinates. Using list of 70 points lets us determine early about changing lanes or about other cars in the lane. This sure penalises the time taken to generate points but helps determine actions early.

Behaviour prediction

Using the sensor fusion data provided for the other cars on the highway, we check for each car the lane it is present in. If we have any cars in the current lane of our car, we check if it's distance is less than 30m. If this is the case we check if there are any other cars in other lanes to try and change the lane. We change the lane only if it's safe to do so which is determined based on the sensor fusion data. If there are no lanes to safely change to then we reduce the speed of our car and stay in current lane.