Skip to content

Implementation of a PID controller for vehicle steering and throttle for the Udacity Self-Driving Car Nanodegree

License

Notifications You must be signed in to change notification settings

Vladimir-Lazic/CarND-PID-Control-Project

Repository files navigation

CarND-Controls-PID

Self-Driving Car Engineer Nanodegree Program


alt text

Dependencies

Simulator

You can download the Term3 Simulator which contains the Path Planning Project from the releases tab.

To run the simulator on Mac/Linux, first make the binary file executable with the following command:

sudo chmod u+x {simulator_file_name}

Basic Build Instructions

  1. Clone this repo.
  2. Make a build directory: mkdir build && cd build
  3. Compile: cmake .. && make
  4. Run it: ./pid.

Implementation

In this repo I have implemented a PID controller and make two instances used for steering angle of the vehicle and throttle. The steering angle value was enough to make the car safely make a lap around track, but in order to allow for a bit smoother ride, a second instance of the PID controller was used for throttle value. The implementation minimizes the Cross Track Error (cte).

The effect each of the P, I, D components

The basic idea is to use the PID controller to adjust the the vehicle position on the track. The P, or proportional component of the regulator is the component that makes the greatest adjustments while the CTE is the highest. While we are the furthest from the desired position the P component allows us to get on track. The D component is used to avoid overshooting, caused by the P component. The effects of the D components is while we slowly approach the desired path, we make small adjustments to the controls in order not to go of path once we reach it. The I component is used to correct against the bias of the PI components. If its the situation that after a certain period of time we are still not at the desired location the I component makes corrections in order to get on track.

Tunning Hyperparameters

The parameters were tunned manually. For both instances of the PID controller, steering and throttle the tunning was done as follows. First I tested with only P, then only D, then only I components. The I ran the combinations. The main goal was to get the car to go around the track and stay within lane boundaries. The job was done with only P and I components. P being set to 0.15, I being set to 2.5. However I did notice a great deal of wheels swiftly going left to right. So I decided to engage the D component with a small coefficient value, 0.00005. Upon running the simulator it appears to have reduced the wheels from oscillating left and right.

The idea for the throttle PID controller was to ensure a smoother ride. For instance while approaching turns the car might benefit from a lower velocity in order to safely make a turn and go smoother along a curved path. For that I found I only have use with the I component it being set to 15. For the final throttle value if subtract the output values of the I controller from a constant value of 0.75 in order to normalize the throttle value.

About

Implementation of a PID controller for vehicle steering and throttle for the Udacity Self-Driving Car Nanodegree

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages