closed loop system
set point
is the desired or command value for the process variable. at any given moment, the difference between the process variable and the set point is used by the control system algorithm to determine the desired actuator output to drive the system.
closed loop system
, the process of reading sensors to provide constant feedback and calculating the desired actuator output is repeated continuously and at a fixed loop rate.
control system performance
is measured by applying a step fuction as the set point command variable, and then measuring the response of the process variable.
rise time
is the amount of time that the system takes to go from 10% to 90% of the steady-state/final.
percent overshoot
is the amout that the process variable overshoots the final value, expressed as a percentage of the final value.
settling time
is the time required for the process variable to settle to within a certain percentage(5%) of the finla value
steady state error
is the final difference between the process variable and set point
disturbance rejection
is the measure of how well the control system is able to overcome the effects of disturbances. often there is a disturbance in the system that affects the process variables or the measurements of these variables, it’s important to design a control system that performs satisfactorily during the worst case conditions.
nonlinear system
, in which the control parameters that produe a desired response at one operating point might not produce a satisfactory response at another operating point.
deadtime
is the delay between when a process variable changes, and when that change can be observed.
loop cycle
the interval of time between calls to a control system, system that change quickly or have complex behavior requires faster control loop rates.
PID theory
proportional response
error
the difference between the set point and the process variable. the proportional gain(K_g) determins the ratio of the output response to the error signal.
e.g. the error term has a magnitude of 10, and the K_g is 5, then the proportional response is 50.
increasing K_g will increase the speed of the control system response, but if K_g is too large, the process variable will oscillate(why?)
integral response
the integral component sums the error term over time. the result is that even a small error term will cause the integral component to increase slowly. the integral response will continually increase unless the error is zero, so the effect is to driven the steady-state-zero to zero.
integral windup
when integral action saturates, still without the controller driving the error signal toward zero
derivative response
the response is portortional to the rate of change of the process variable. increasing the derivative time
will cause the control sytem to react more strongly to changes in the error, and react more quickly.
in practice, most control system use very small derivative time, since the derivative response is highly sensitive to noise.
turning
which is the process of setting the optimal gains of P, I, D to get an ideal response.
trial and error
set I, D as zero, and increas P gain. Once P has been set to obtain a desired fast response, I starts to increase to stop the oscillatins to achieve a minimal steady state error. once P and I have been set, the D is increased untill the loop is acceptably quick to its set point.
filtering
assume a sinusoidla noise with frequency w, the direvative is:
so in practice it’s necessary to limit the high frequency gain of the derivative term, either by adding a low pass filtering of the control signal, or implement the derivative term in a cut-off way.
Udacity Self driving Car project 9
int main()
{
uWS::Hub h ;
PID pid ;
pid.Init(pinit, iinit, dinit);
h.onMessage( // cte, the error
{
double diff = fabs(pid.p_error - cte) ;
if( diff > 0.1 && diff < 0.2)
thr = 0.0;
else if( diff > 0.2 && speed > 30)
thr = -0.2;
pid.UpdateError(cte, dt);
steer_value = -pid.TotalError(speed);
}
}
void PID::UpdateError(double cte, double dt)
{
d_error = (cte - p_error) /dt ;
p_error = cte ;
i_error = integral(cte * dt);
}
double PID::TotalError(double speed)
{
return (Kp - 0.0032 * speed) * p_error + Ki * i_error + (Kd + 0.002 * speed) * d_error ;
}
in real self driving control system, usually divide as latitual and longitual control. and in different scenarios, there are plenty of PID controls. in the future will expose: highway autopilot, auto parking, urban L4