Feedback control · University · about 30 min
Removing the error that P leaves behind, and the windup that comes with it.
[1 mark]A PI controller has settled exactly on target. Which term is supplying the command?
[1 mark]A constant 4 cm error is held for five ticks. What does this print?
KP, KI, DT = 1.6, 0.5, 0.1
integral = 0.0
for tick in range(5):
error = 4.0
integral += error * DT
print(round(KP * error + KI * integral, 2))6.6 6.8 7.0 7.2 7.4
The P term stays at 6.4 while the integral grows by 0.4 per tick, adding 0.2 each time: 6.6, 6.8, 7.0, 7.2, 7.4. A stubborn error keeps pushing harder.
[1 mark]Using the lesson's rule of thumb, how many seconds does the integral take to contribute as much as the proportional term when Kp = 1.6 and Ki = 0.5? Give one decimal place.
[1 mark]Which of these are the standard defences against integral windup given in the lesson?
Tick every answer that is true.
[1 mark]An obstacle holds the robot at 40 cm while the target is 25 cm. Ten seconds later it is removed and the robot charges far past the target. Why?
[1 mark]The error is in cm, the command in percent, and time in seconds. What are the units of Ki?
[1 mark]The robot sails slowly past the target, turns round, and sails past again with large, slow swings. Which gain is the likely cause?
Settle exactly 25 cm from the wall, within 3 cm, from fourteen seconds onwards. Proportional control alone at a gentle gain will not do it: at Kp = 1.5 it stops about 8 cm short, because this drive does nothing below about 15 percent. Plot error and i term.
from bugbot import * connect() KP, KI = 1.5, 0.8 TARGET = 25.0 DT = 0.1 integral = 0.0
The hint students can ask for: 25 cm from the wall is y = 65 from the start, and the tolerance is 3 cm, which proportional control at a gentle gain will not manage: below about 15 percent this drive does not move at all, so a small error produces a command that does nothing. Add up the error over time and let that push as well.
from bugbot import *
connect()
KP, KI = 1.6, 0.9
TARGET = 25.0
DT = 0.1
integral = 0.0
for tick in range(480):
error = distance() - TARGET
integral += error * DT
integral = max(-60.0, min(60.0, integral))
cmd = KP * error + KI * integral
plot("error", error)
plot("i term", KI * integral)
drive(max(-60.0, min(60.0, cmd)), 0, 0)
wait(DT)
stop()
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.