ENGR10006 Chap.9 Feedback Control, Line Following and Gripping
Feedback Control, Line Following and Gripping
Closing the loop is what lets the robot follow an unknown track. This chapter sets out the closed-loop structure from Workshop 5: process, controller, feedback and a summing junction with a reference, and explains why timed open-loop moves fail on a real track.
It follows the line-following error, the right IR reading minus the left, whose sign gives the direction to turn and whose size gives how far the robot is off centre, then compares coarse threshold control with proportional control, the gain Kp and the Saturation block that keeps pulse widths valid.
It adds PID terms, moving-average smoothing of noisy errors, gripper calibration with a standard servo, and the demonstration task, rules and 15-mark rubric that the final run is judged against. The worked example takes one IR reading pair through a full proportional update, and practice items apply the demonstration rubric to a sample run.
What this chapter covers
- 01
Closed-loop structure
- 02
Why open-loop timing fails
- 03
IR difference error signal
- 04
Coarse threshold control
- 05
Proportional gain and saturation
- 06
PID terms and tuning
- 07
Moving-average smoothing
- 08
Demonstration task and rubric
Worked example · free
One proportional control update with saturation
- +1Error = IRRight - IRLeft = 350 - 610 = -260.
- +1A negative error means turn right according to the behaviour sheet.
- +1Requested turn = 0.4 × 260 = 104 µs, above the 100 µs limit, so the Saturation block holds it at 100 µs.
- +1Turning right slows the right wheel towards 1500 µs: right = 1400 + 100 = 1500 µs; left stays at 1600 µs, the pivot-right style command.
Key terms
- Closed-loop control
- Control in which sensor feedback is compared with a reference to choose each new command.
- Error signal
- The right IR reading minus the left, whose sign and size steer the robot.
- Proportional gain
- The constant Kp that sets how strongly the turn responds to the error.
- Saturation block
- A Simulink block that limits a signal between set upper and lower values.
- Integral term
- The part of a PID controller that grows with how long an error has persisted.
- Derivative term
- The part of a PID controller that responds to how quickly the error is changing.
- Moving average
- A filter that replaces each value with the mean of the last N samples.
Feedback Control, Line Following and Gripping FAQ
What is wrong with coarse line-following control?
Coarse control turns at one fixed speed whenever the error passes a threshold, so small deviations are ignored and large ones are over-corrected. Workshop 7 replaces it with proportional control, where the turn grows with the error and motor speeds update continuously, giving smoother tracking.
Why is a Saturation block needed?
With a large error or a large gain, the proportional term can request pulse widths outside the range the wheels accept. The Saturation block bounds the signal between set upper and lower limits, so every command sent to the servos stays valid.
What ends a demonstration run early?
A run ends when the task is complete, when a rule is broken, when the robot behaves unusually, or after 300 seconds including initialisation. Each robot has two attempts with no changes in between, and a model using an unlisted toolbox will not compile and scores zero.
How should we choose the PID gains?
The Workshop 8 slides recommend tuning by experiment and documenting the tests for the report rather than using advanced design methods. Any term can be switched off by setting its gain to zero, and changing one gain can change behaviour a lot, so adjust one at a time.
Assessment move
Start by drawing the closed loop for your robot and labelling each block with the actual part: the chart as controller, the robot as process, the IR and ultrasonic readings as feedback. Then practise the sign convention until it is automatic, using pairs of IR readings and deciding the turn direction before calculating anything.
Tune in a fixed order: get coarse control working, switch to proportional control with a conservative gain, add saturation limits taken from your calibrated wheel commands, then add smoothing and only then consider integral or derivative terms. Change one parameter at a time and log the gain, filter length and observed behaviour on each track section.
Calibrate the gripper's open, closed and closed-and-lifted settings on your own robot, since the standard servo gives no angle feedback. Finally, rehearse the demonstration rules, including the 300-second limit and the allowed toolboxes, and test on all three kinds of track section. Keep a short tuning diary in Microsoft Teams so the report can show how each change affected the run.
Record each demonstration-style practice run against the 15-mark rubric so you know which marks are still at risk.