Skip to content

PraveenKumar-Rajendran/CarND-PID-Control-Project

Repository files navigation

CarND-Controls-PID

This project is part of the Self-Driving Car Engineer Nanodegree Program.


Dependencies

If the environment you set up for the Sensor Fusion projects does not work for this project, fellow students have put together a guide to Windows set-up for this project. There's also an experimental patch for Windows in this PR.

Basic Build Instructions

  1. Clone this repository.
  2. Create a build directory: mkdir build && cd build
  3. Compile: cmake .. && make
  4. Run the program: ./pid

For tips on setting up your environment, refer to the Udacity classroom.

Editor Settings

Editor configuration files have been intentionally kept out of this repository to keep it simple and environment-agnostic. However, we recommend using the following settings:

  • Indent using spaces.
  • Set tab width to 2 spaces to maintain alignment of matrices in the source code.

Code Style

Please adhere (to the best of your ability) to Google's C++ style guide.

Project Instructions and Rubric

Please note that regardless of the changes you make

, your project must be buildable using cmake and make.

Additional information and instructions are available only to students enrolled in Term 2 of the CarND program. If you are enrolled, refer to the project page for instructions and the project rubric.



Addressing Project Rubric

Udacity - Self-Driving Car NanoDegree

Compilation

The code compiles without errors using cmake and make.

Implementation

The base algorithm follows what is presented in the lessons, and hyperparameter tuning/optimization is done manually.

Reflection



Describe the effect of each of the P, I, and D components in your implementation.

A Proportional-Integral-Derivative (PID) controller is a control loop mechanism used in various applications, including industrial control systems. It employs feedback and consists of three terms: proportional (P), integral (I), and derivative (D). The controller continuously calculates an error value by comparing a desired setpoint (SP) to a measured process variable (PV) and applies a correction based on the weighted sum of the three terms. [Source: Wikipedia]

Proportional (P)

The proportional component sets the control input in proportion to the current cross-track error (CTE). However, if the proportional gain is set too high, the system becomes unstable.

Integral (I)

The integral component increases the action in relation to both the error and the duration for which it has persisted. This component is effective in eliminating systematic biases.

Derivative (D)

The derivative component considers the rate of change of the error and aims to bring this rate to zero. It flattens the error trajectory, reducing overshoot.



Describe how the final hyperparameters were chosen.

The parameters were selected through a trial-and-error approach based on an intuitive understanding of the impact of different values. Initially, the gains were set using the values presented in the PID implementation lecture by Sebastian Thrun. These values were then tuned to achieve the desired performance in the simulator environment.

Multiple iterations were performed, and the parameter values were continuously adjusted until the car could successfully and safely complete a lap. The table below shows some of the tested parameter combinations and their results:

Kp Ki Kd Result
0.1 0.001 1.8 Fail
0.15 0.001 1.8 Fail
0.12 0.001 1.8 Fail
0.09 0.001 1.8 Pass
0.1 0.001 1.8 Pass
0.13 0.001 1.8 Good
0.16 0.001 1.8 Better

Note that the throttle value was modified between 0.18 and 0.3 for the above combinations and finally set to a constant value of 0.18 for stability.

Simulation

The vehicle successfully drives a lap around the track.

A simulation video has been recorded and attached in the results directory. The GIF below shows the result for one of the experimented parameter combinations:

About

Self-Driving Car Engineer Nanodegree Program: Project8

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages