Giter Site home page Giter Site logo

carnd-pid-control-project's Introduction

CarND-Controls-PID

Self-Driving Car Engineer Nanodegree Program


Achievement

A PID controller is implemented. A message-driven twiddle procedure for PID parameters is implemented. I also did a prototype of message-driven twiddle process in Python first for proof of concept. It may serve as a reference for implementation in C++.

The PID controller with manually selected parameters such as {0.2, 3.0, 0.004} for P, D, I respectively with constant throttle 0.4 can achieve stable driving the full track with top speed of 45 mph.

With adaptive throttle rule of $0.7 - \sqrt{fabs(angle)\cdot speed\cdot fabs(cte)}$, through twiddle process a set of paramters were found that can enable mostly safe driving with top speed of 70 mph, and most of the time the speed is above 40 mph. There are two incidents where that the car drove over to the lanes markings usually forbidden.

Painstaking effort were made to search for parameters for safer driving. But I was only able to minimize the number of incidents of traffic violations.

In the future, I might try to use another PID to control the throttle.

I did attempted on the effort, so far with my current found formula for ideal speed: $MAX_SPEED \cot (1 - \frac {\sqrt{angle}} {5})$ where $ 5 = \sqrt{25}$ and 25 is considered to be the maximum angle, I feel the error signal being the difference between the idea speed given steering angle and the current speed may not capture the requirement that the speed at the extreme angle 25 should be very small regardless to the current speed. But I had not found good expression for the ideal speed thus I have not further attempted.

Here is a capture of the running at high speed after twiddle process:

The following shows the typical twiddle process.

The follow shows only P component in the controller:

It will only work when there is not much change in the speed of cte change.

The follow shows only the D component in the controller:

It performs even worse, as it does not account for the presence of cte directly, only will account of the change of cte.

This shows only the I component in the controller:

It performs the worst, as it only response to the accumulation of cte.

Dependencies

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.