# Week 4 — Feedback and bounded control

DIS OpenLab · Foundations of Autonomous Systems · v0.1.0-prepilot · 2026-10-15
Track: computational/recorded data; native simulator optional after validation
License proposal: CC BY 4.0 for original text, pending rights review

## Learning objectives

Learners will define target, measurement, and error; compare open-loop and closed-loop behavior; implement proportional and integral terms; identify saturation and integral wind-up; tune using recorded evidence; and keep output within declared actuator limits.

## Core relationship

For heading error `e`:

```text
integral = clamp(integral + e·dt, -limit, +limit)
correction = Kp·e + Ki·integral
left  = clamp(cruise - correction, -wheel_limit, +wheel_limit)
right = clamp(cruise + correction, -wheel_limit, +wheel_limit)
```

This is a PI steering example, not a universal motor-speed controller. A physical velocity loop would require wheel-speed feedback, timing characterization, and actuator tests.

## Safety boundary

Large gains can create rapid command reversal. Software clamps reduce commanded magnitude but do not prove safe current, temperature, stability, or stopping distance. No physical tuning is permitted without an approved low-speed procedure and manual isolation.

## Session A — reason from recorded error

Use heading errors `[0.30, 0.22, 0.14, 0.08, 0.03, -0.02, -0.05]` radians at `dt=0.1 s`.

1. With `Ki=0`, calculate correction for `Kp=0.5`, `1.1`, and `2.0`.
2. Mark every output that would exceed a 6.28 rad/s limit at a 3.0 rad/s cruise command.
3. Add `Ki=0.15` and an integral limit of 1.0. Track the integral explicitly.
4. Explain which setting responds faster and which amplifies measurement noise more.

## Session B — compare deterministic runs

Run the supplied scenario once with the default configuration. Copy the controller to a working file and change one gain at a time. Keep the input trace identical. Record:

| Run ID | Kp | Ki | Max |e| | Saturated samples | Final |e| | Notes |
|---|---:|---:|---:|---:|---:|---|
| A | | | | | | |
| B | | | | | | |
| C | | | | | | |

Do not select gains based only on a visually smooth command. State the objective and trade-off first.

## Disturbance experiment

For a Webots or recorded-data extension, introduce one named disturbance—wheel mismatch, heading measurement bias, or a brief command limit. Keep every other configuration fixed. Compare against the baseline. If Webots is unavailable, label the result `RECORDED/COMPUTATIONAL`, not simulated.

## Student lab sheet

Target definition: ______  Measurement source: ______  Error sign convention: ______

Chosen gains and limits with rationale: ______

Evidence source: computational / recorded / Webots observed / physical observed (circle one only if true)

One instability or poor-tuning symptom: ______

One change and predicted effect: ______

## Evidence to submit

- calculations with explicit units and time step;
- configuration for at least three comparable runs;
- command/error table or plot with saturation identified;
- explanation of proportional action, integral action, and anti-wind-up limit;
- limitation statement separating this steering example from a validated physical velocity controller.

## Instructor notes

Avoid teaching “increase gain until it oscillates” as a safe universal method. Ensure learners hold the input scenario constant. Ask whether improvement in one metric worsened overshoot, command activity, or noise sensitivity. If a learner reports a PID result, require them to identify the derivative term; the supplied core is PI, not PID.

## Low-bandwidth and accessibility option

Use the provided seven-sample error list and a calculator. A table is sufficient; plots are optional. When plots are used, label lines directly and provide the numeric data. Allow written or recorded verbal reasoning under host accessibility procedures.

## Exit ticket

Explain why a wheel command within the software maximum can still be unsafe for a real motor/driver/power system, and name the physical evidence required before increasing it.
