-
Notifications
You must be signed in to change notification settings - Fork 3
PIDs Explanation
PID stands for Proportional, Integral, and Derivative.
A complicated-sounding combination of words that aren’t actually too bad once you look into it. This tutorial will teach you the basics of each controller and their role in adjusting the system’s output to reach a desired goal by minimizing the error between the current state and the target.
The P term represents the current error, which is simply the difference between the desired setpoint and the actual value. Ideally, an error of 0 is what we aim for, but this is unrealistic because it's impossible to account for all the noise and disturbances in real-world systems.
The P term adjusts proportionally to the size of the error.
We have P_output = K_p * e(t)
Where:
- K_p represents the proportional gain constant
- e(t) represents the error at time t.
If the error e(t) is too large, that would mean that that the P component would make a large adjustment
Effect of increasing and reducing P on AUVs movements:
Increasing K_p:
- Makes the system respond more aggressively to errors, but it can cause overshooting or oscillations if it’s too high.
Decreasing K_p:
- Slows down the system’s response to errors, but it might not be fast enough to correct the error in time, leading to a slower system.
The I part refers to the accumulation of all past errors. The reason we sum up all past errors is to avoid residual steady state error, , which is a persistent small error that remains even when the system has mostly settled.
The formula is given by:
Where:
- K_i represents the integral gain constant
- e(t) sums the error from the start (t=0) to current time t.
Now conceptually this makes sense, as an integral is just a sum. If there is a persistent small error over time, the I term will increase the correction to drive the error to zero. Effect of increasing and reducing I on AUVs movements:
Increasing K_I :
- Helps eliminate steady-state error faster but can lead to overshooting if it builds up too much correction.
Decreasing K_I:
- Slows the elimination of steady-state error, and the system may struggle to fully correct itself.
The D part reacts to the rate of change of the error (how fast the error is changing). It predicts future errors based on how quickly the error is growing or shrinking, effectively damping the system's response.
Where:
- K_d is the derivative gain constant
- d/dt (e(t)) represents the rate of change of the error
Effect of increasing D term:
- Increasing the D term in a PID controller makes the AUV's movements more stable by reducing overshoot and dampening rapid changes in error, but too much can slow down responsiveness.
Effect of decreasing D term
- Decreasing the D term allows faster response but can lead to oscillations and instability.
The overall control output at any given time is the sum of the P, I, and D contributions:
Control Output = P_output + I_output + D_output
By adjusting each of the three components, we can fine tune our controller to receive the perfect balance between stability and responsiveness.