/PID_Control

PID contorl

Primary LanguageC++

PID Control

Reflection

PID Componets

Error is that input variable for the controller:

cte = desired_state - measured_state

P or "Proportional" indicates the current cte (Cross Track Error). The car is controlled in proportion to the distance of the car from the center of the lane, and when P error is large, it vibrates greatly and reacts quickly to the input.

I or "Integral" is used to eliminate states that no longer match the target value when approaching the target value. An error that does not match the target value over time is referred to as 'Offset', and the error of the vehicle's controller not reaching the target value can be eliminated.

D or "Differential" brakes on sudden changes in output, while a high coefficient helps reduce overshoot and helps keep the car in the center.

Parameter Tuning

Tuned by the Ziegler-Nichols method. Ki and Kd were set to 0 and gradually increased Kp until the difference was oscillated. Next, Kd increases the value to quickly reach the reference, and Ki is set to a value as small as possible since there is no steering bias.

Final Parameter

steer_pid.Init(.1, .0001, 3.);

Note

  1. Use KP to decrease the rise time.
  2. Use KD to reduce the overshoot and settling time.
  3. Use KI to eliminate the steady-state error.

Jinghua Zhong (Spring 2006). "PID Controller Tuning: A Short Tutorial" (PDF). Retrieved 2011-04-04.

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.

Editor Settings

We've purposefully kept editor configuration files out of this repo in order to keep it as simple and environment agnostic as possible. However, we recommend using the following settings:

  • indent using spaces
  • set tab width to 2 spaces (keeps the matrices in source code aligned)

Code Style

Please (do your best to) stick to Google's C++ style guide.