Giter VIP home page Giter VIP logo

carnd-pid-control-project's Introduction

Self-Driving Car Engineer Nanodegree Program

PID Controller

Given a driving simulator which provides the cross track error (CTE) and the velocity (mph), the goal of this project is to develop a PID controller in c++ that successfully drives the vehicle around the track. In order to navigate the car around the track. I have implemented PID controller for steering angle control.

Tuning

The most important part of the project is to tune the hyper-parameters. This can be done by different methods such as manual tuning, Zieglor-Nichols tuning, SGD,or Twiddle. I have initially done manual tuning, followed by the twiddle method. Manual tuning is hard but, the process of tuning help us better understand every single effect of PID parameters. The following table summarizes the effect of each parameter on the system.

Parameter Rise Time Overshoot Settling Time Steady-state error
Kp Decrease Increase Small change Decrease
Ki Decrease Increase Increase Decrease
Kd Small change Decrease Decrease No change

Proportional (P):

This parameter controls the error proportionally. Increasing the proportional gain has the effect of proportionally increasing the control signal for the same level of error. Setting only P control is aggressive and has oscillations.

Integral (I):

This parameter controls the accumulating error. Addition of this term reduces the steady state error. If there is a bias in the system, the integrator builds and builds, thereby increasing the control signal and driving the error down.

Derivative (D):

This parameter controls the rate of change of error. Addition of this term reduces the oscillatory effect in the system. With derivative control, the control signal can become large if the error begins sloping upward, even while the magnitude of the error is still relatively small. This anticipation tends to add damping to the system, thereby decreasing overshoot.

The following approach is a best to tune manually:

  • Set all gains to zero.
  • Increase the P gain until the response to a disturbance is steady oscillation.
  • Increase the D gain until the the oscillations go away (i.e. it's critically damped).
  • Repeat steps 2 and 3 until increasing the D gain does not stop the oscillations.
  • Set P and D to the last stable values.
  • Increase the I gain until it brings you to the setpoint with the number of oscillations desired.

I started initially with (0.1,0.03,2.0) for the steering control. The final parameters for my controllers are:

Parameter Values
Kp 0.13
Ki 0.0001
Kd 1.0

Dependencies

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

Basic Build Instructions

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

Tips for setting up your environment can be found here


carnd-pid-control-project's People

Contributors

sauravkdeo avatar

Watchers

James Cloos avatar  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.