Coder Social home page Coder Social logo

carnd-pid-control-project's Introduction

CarND-Controls-PID

Self-Driving Car Engineer Nanodegree Program


Introduction

Goal:

This project implements a PID controller in C++ to maneuver the vehicle around the track in the simulator! Two PID controllers are to be implemented one for steering control and another for throttle control.

Fundamentals

PID stands for Proportional-Integral-Derivative. It is a controller with three coeffients P, I and D. The effects of these coefficients are discussed below.

Cross Track Error (CTE)

  • It is a distance between the vehicle´s actual trajectory and the groundtruth trajectory. It is best suited to control the vehicle by steering in proportion to CTE.

Systematic Bias

  • This is a term used in Robotics that tells you how much the vehicle´s steerable wheels are aligned.

P- Controller

  • It sets the steering angle in proportion to CTE by virtue of a gain parameter called tau_p.

steering angle = -tau_p * cte

  • This controller steeers the vehicle towords the trajectory but when it reaches the trajectory it overshoots.
  • The following graph demonstrates the overshooting due to P controller.

PD- Controller

  • In this controller the steering angle is not just proportional to CTE by virtue of tau_p but also the temporal derivative of the CTE with a gain parameter called tau_d.

steering angle = -tau_p * cte - tau_d * diff_cte

  • This helps the vehicle to not overshoot the trajectoy as the the derivative component counter steers the vehicle.
  • The following graph demonstrates the behaviour of P controller and PD controller.

PID- Controller

  • Finally this controller overcomes the problem of overshooting and systematic bias by adding one more term.

steering angle = -tau_p * cte - tau_d * diff_cte - tau_i * int_cte

  • This time, addition to PD controller parameters the steering angle is prportional to integral of all CTE over time.
  • The following graph summerizes the P-, PD-, and PID- controllers.

Implementation

Manual tunning of PID coefficients for steering and throttle values.

Tunning P- Controller

The vehicle drives along the trajectory with oscillations.

Tunning PD- Controller

The vehicle follows the trajectory with relatively low oscillations.

Tunning PID- Controller

The vehicle follows the trajectory but due to overspeeding it shakes while taking turns.

PID- Controller for throttle value

The braking while taking turns allows the vehicle to take the turns smoothly.

Basic Build Instructions

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

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.

carnd-pid-control-project's People

Contributors

domluna avatar arunchavan89 avatar baumanab avatar mvirgo avatar swwelch avatar davidobando avatar citlaligm avatar htuennermann avatar

Stargazers

 avatar

Watchers

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