Coder Social home page Coder Social logo

carnd-pid-control-project's Introduction

CarND-Controls-PID

Self-Driving Car Engineer Nanodegree Program


Implementations

  1. Rewrite python code from classroom to C++.:)
    • Init() initialize P, I, D parameters (PID.cpp line 14-25)
    • UpdateError(), based on PID error calculation formula, get error for each parameters(PID.cpp line 27-35)
    • GetSteerValue(), output steer values (PID.cpp line 46-58)
  2. Manual PID parameters turning
    • Adjust values by modify P, all others to 0; then P,I; then PID.
    • it looks like P= .2, I = 1e-4, D = 3.0 let the car finish the full lap
  3. Using Twiddle Algorithm to Tune PID Paramters
    • I imitated the python code algorithm and rewrite it in C++
    • Added a few conditions to make it better works in the simulation enviroment
    • if cte > 5 , which means the car is out of lane, should rerun simulation
    • if time steps (no of h messages) > 8000 ( about one lap), restart simulation for another iteration
    • However, it seems my implementation doesn't work well. first of all, it takes much longer time to run more iterations in simulator.
    • Besides, PID values are not moving in the right directions and stay at a range then do not change anymore.
    • Due to limited time, I am not be able to figure out the reason and will revisit this after finishing the final project.

Below is a short GIF shows the animation after using manual tuned PID parameters.

Manual Tuned PID results

Below is a short GIF shows the animation after using twiddle for 14 iterations(Failed).

Twiddle

Reflections

Describe the effect each of the P, I, D components had in my implementation.

  1. P (proportional) tries to stter car to the center to minimize cte. However, it easily make the car overshot center of lane and could run out of lane.
  2. I(Intergral) treis to reduce the bias of car control system (like steering drift) accumulated over time. In the simulator, it seems there is no bias.
  3. D(Differential) helps reduce the effect of overshoot created by P, so the car's steering will not oscillate much when only P is added.

Project 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.

Tips for setting up your environment can be found here

carnd-pid-control-project's People

Contributors

domluna avatar xjtuyanshi avatar baumanab avatar mvirgo avatar swwelch avatar davidobando avatar citlaligm avatar htuennermann 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.