Giter VIP home page Giter VIP logo

carnd-pid-control-p8'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 2 PID controllers, one for steering angle control and the other for speed control.

Tuning

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

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.

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. This anticipation tends to add damping to the system, thereby decreasing overshoot, but the negative effect would cause slowly reaching the target(CTE = 0).

##Conditional analysis

In the Steady state:

(P) : almost no work.

(I) : Mainly work for the bias/offset/stably turning.

(D) : no work.

being the perturbation

(ex: changing the state from going straight to turn left or from turning back to going straight)

(P) : mainly work.

(I) : almost no work.

(D) : anti-work to (P).

Tuning method

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

##Judgement method

Initially, I only set the "total_cte" as the judgement of the pid-parameters. However, I found when I get a smallest cte but the car would have small oscillations. There is no sense for the final result. So, I add another judgement of the "total_angle". It means that the current_angle - previous car_angle. So if have smallest oscillations in the round, I would get the smallest "total_angle".

####case 1 :

Steering Speed
Kp 0.25 0.18
Ki 0.0022 0.007
Kd 5.0 0.0

In this case, I have the smallest total_cte <600, but the total_angle is >60000 that is a relative value. ####case 2:

Steering Speed
Kp 0.08 0.18
Ki 0.003 0.007
Kd 3.0 0.0

In this case, I have the not smallest total_cte <1000, but the total_angle reduce to <30000 (-50%+)

it means that the car get the proper curve when driving, though not driving on the perfect line(cte=0). I think the setting would more fit the driving behavior in the reality.

Here is the video that I implemented the project in the two cases. Which one would you prefer to? ./ https://youtu.be/_-sLaUVVxpI

Notice:

The performance of the controller would be different when using different computer or different setting of the simulator even in the same parameters. I wrote the project in my local computer. I found that there is different peformance when I run simulator in the udacity computer, but the car still drive safely to pass the track fitting the criterions.

carnd-pid-control-p8's People

Contributors

ccasas777 avatar

Stargazers

 avatar

Watchers

 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.