Feedback control · University · about 25 min
Setpoint, error, controller, plant, measurement: the block diagram and the names.
[1 mark]The first loop is run on a list of distances instead of the sensor. What does it print?
TARGET = 20.0
for d in (60, 45, 30, 22, 18):
error = d - TARGET
print(error, max(-50, min(50, 2.0 * error)))40.0 50 25.0 50 10.0 20.0 2.0 4.0 -2.0 -4.0
The errors are 40, 25, 10, 2 and -2 cm. At gain 2 the first asks for 80 and is clipped to 50; then 50, 20, 4 and -4. The command shrinks as the robot approaches.
[1 mark]With error = distance() - TARGET, positive drive() forwards, and the gain made negative by mistake, what happens?
[1 mark]When does open loop control work?
[1 mark]Follow a signal once round the feedback loop, starting at the comparison.
Number the lines 1 to 5 to put them in the right order.
plantsensorerror = setpoint compared with measurementcontrolleractuatorerror = setpoint compared with measurement controller actuator plant sensor
The error goes through the controller to the actuator, which moves the plant; the sensor measures the output and feeds it back to the comparison.
[1 mark]Raising the gain of this loop typically buys which two qualities?
Tick every answer that is true.
[1 mark]In the lesson's table, what is the name for the robot and the mat, the thing being controlled?
Settle 20 cm from the wall, plotting the error as you go. The wall's face is 150 cm up the mat and the robot starts at 60.
from bugbot import * connect() TARGET = 20.0
The hint students can ask for: The wall's face is 150 cm up the mat and the robot starts at 60, so 20 cm from the wall is 70 cm of travel. Error is where you want to be minus where you are; drive in proportion to it.
from bugbot import *
connect()
TARGET = 20.0 # cm from the wall
for tick in range(300):
gap = distance()
error = gap - TARGET
plot("error", error)
drive(max(-50.0, min(50.0, 2.0 * error)), 0, 0)
wait(0.1)
stop()
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.