The answersDownload the PDF
Worksheet

U10.5 Feedforward and feedback

Following a trajectory · University · about 30 min

BugBotLab
NameClassDate

What this lesson is about

A ramp leaves a proportional controller permanently behind, and the model knows how to fix it.

Questions 6 marks in all

  1. [1 mark]A proportional controller with K = 1.5 per second chases a reference moving at 10 cm/s. How far behind does it settle, in cm to 2 decimal places?

  2. [1 mark]The reference speed is now fed forward, but the model is 10 percent out. With the same v = 10 cm/s and K = 1.5, what steady error is left, in cm to 2 decimal places?

  3. [1 mark]Why can a proportional controller never catch a reference moving at constant speed?

    1. AIt only produces a command when there is an error, and the command must stay non-zero to keep moving
    2. BIts gain is always too low
    3. CThe drive's dead band stops it moving at constant speed
    4. DThe reference is sampled too slowly
  4. [1 mark]This simulates a robot whose real speed is 90 percent of the model's, chasing a 10 cm/s ramp, first with gain alone and then with the reference fed forward. What does it print?

    V, K, DT = 10.0, 1.5, 0.1
    for ff in (0.0, 1.0):
        pos = 0.0
        for tick in range(300):
            ref = V * tick * DT
            err = ref - pos
            pos += 0.9 * (ff * V + K * err) * DT
        print(ff, round(err, 2))
  5. [1 mark]Which statements about feedforward and feedback are right?

    Tick every answer that is true.

    1. AFeedforward has no stability cost because it is not in the loop
    2. BFeedforward alone drifts, because nothing measures the result
    3. CFeedback handles what the model does not know, such as a slope or a flat battery
    4. DWith good feedforward the feedback loop can be removed
    5. EFeedforward reduces the steady error by raising the loop gain
  6. [1 mark]A robot running feedforward plus feedback is stuck against a chair leg. What does the feedforward term do?

    1. AIt keeps commanding cruise speed, because it never sees what actually happened
    2. BIt drops to zero, because the error has grown
    3. CIt reverses, because the model predicts a collision
    4. DIt doubles, to push past the obstacle

The task: how far behind a ramp

Drive the same 10 cm/s ramp twice: once with proportional control alone, once with the reference speed fed forward as well. Average the size of the error over the last few seconds of each leg, and print p only: and with ff:. Plot ref, actual and error.

from bugbot import *
import math
connect()

DT = 0.1
V_REF, K = 10.0, 1.5

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/u10-5-feedforward/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Check v / K against your measured p only number. How close is the prediction?
  2. Run the proportional leg at K = 5. Does the error fall by the factor the formula says, and what does the motion look like?
  3. Deliberately break the feedforward by using 30 cm/s instead of 20 in the model. Where does that show up?