Week 4: PID Control#
What you see#
The example shows a PID controller applied to the locomotive environment. In this case the control signal is
Where \(e_k\) is the error, i.e., distance to the platform indicated by the red triangle.
Intuitively, the first term is large when the distance is big meaning the train moves towards the platform. The second term is an approximation of the velocity, i.e., \(e'(t)\). This means that the train breaks when the velocity is big which has a dampening effect.
PID with an integral term#
In this variant of the locomotive environment the track is inclined. This means that the PID controller above cannot bring the train to the correct location since it will always slide down (slightly) – this effect is called droop.
It is fixed by adding a term to the PID controller proportional to:
if the train is on one side of the goal this term will keep growing thereby eventually overcoming gravity and hence allowing the train to reach the goal.
you can find the code in irlc/lectures/lec04/lecture_04_pid_iB.py