Coder Social home page Coder Social logo

carnd-pid-control-project's Introduction

CarND-Controls-PID

Self-Driving Car Engineer Nanodegree Program


Introduction

In this project, I have implemented a PID controller of a self-driving car by manual tuning the hyperparameters and it has been successfully tested in the simulator. There are two controllers, one controls the steering angle while the other controls the throttle. CTE(cross-track error) was used for steering angle control and SPE(speed error) for throttle control. SPE is defined by the error between the current speed and the target speed. Target speed for this simulator is 40mph. Steering angle, speed and CTE is provided by the simulator via local websocket.

Requirements

Results

The final result is shown as below. output

Reflections

  • Effect of P,I,D components
    • Proportional: For both steering angle and throttle controls, the "P" component had the most observable effect on the car's behavior. It caused the car to steer proportional to the car's distance from the lane center, which means if the car is too far away from the lane center, then the steering angle will be large to make the car back to the center. Likewise, for the throttle control, when the current speed is far less than the target speed, the throttle is large.
    • Differential: The "D" component counteracts the "P" component's tendency to ring and overshoot the lane center. A properly tuned "D" component can make the car to approach the lane center more smoothly.
    • Integral: The "I" component counteracts a bias in the CTE to prevent the P-D controller from reaching the center line.
  • How the final hyperparameters were chosen
    • The final hyperparameters were chosen by manual tuning. Firstly, the hyperparameters of throttle controller were tuned to make the car drive at a reasonable speed. Then, the "P" component of steering angle controller was adjusted from 0.05 to 0.16, with a step of 0.01 for each adjustment. The "I" component was then tuned from 0.001 to 0.003, with a step of 0.001 for each adjustment. The "D" component was tuned to 2.01 from 0.1.

Basic Build Instructions

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

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.