Lab 2 — USV PID Tuning
Week 7 · Spring 2026
Objectives
Test and evaluate the closed-loop performance of the USV’s speed and yaw-rate controllers in the following scenarios:
| Experiment | Purpose |
|---|---|
| Base | Baseline setup with ArduRover default PID gains, no rate limiters, and no feedforward. Reference against which the other two experiments are compared; inspect the default closed-loop behavior in both the speed and yaw-rate channels. |
| FeedForward | Add the feedforward gain (using values from our open-loop system identification lab) to both control loops, keeping the PID gains at the Base values. Observe contribution of feedforward to performance. |
| Tuned | Tune the PID gains for the “best” response, keeping the feedforward from the previous case. |
For each experiment, both the speed (surge / throttle) loop and the yaw-rate (steering / rudder) loop are exercised with manual step inputs and the responses logged.
For each of the six cases (three experiments × two channels), you will
- Plot the closed-loop step response timeseries to visualize the transient and steady-state behavior.
- Plot the PID internals (target vs actual, per-term breakdown) to understand how the controller is operating and generating the actuator commands. This includes the controller effort (P/I/D/FF) breakdown, which is critical for understanding the relative contribution of each term to the overall response and diagnosing issues like excessive overshoot (too much P), long settling time (too little D), or integrator windup (excessive I). Controller effort is also a key aspect of the “best” response characterization, since we want to achieve good performance with minimal control effort.
- Quantify the transient and steady-state performance metrics, then compare across the three experiments for each channel.
- Review the example results: timeseries and PID signals for each of the six cases (plus an integrator-windup demonstration) and a summary of performance metrics.
Schedule
This week: clean step-response logs for all three experiments × two channels = six datasets, with a brief quality-check.
Next week: process the data to quantify rise time, settling time, overshoot, and steady-state error, then compare across the three experiments.
Reading
Before the field session, review the Autopilot → Stabilization Layer reference. It documents the two control loops you’ll be tuning (speed and yaw-rate).
Procedure
Procedure — pre-lab checklist, field workflow, step-input technique, and the at-the-field quality-check criteria.
Materials
For Students
- Shared data repository: ME2801_USV_Shared. This is where to upload your raw (
*.BIN) autopilot logs for processing. Add a subfolder for your team (e.g.TeamX) and upload there. The instructors will convert the logs to MATLAB (*.mat) format. - Analysis script —
closedloop_assess_example.m.
Loads a single.mat, plots the timeseries and PID internals, and reports the step-response metrics.- Modifying this script for your datasets is the main deliverable for the lab.
- Download the entire directory from
book/w07_lab_usv_pid/code/and open the example in MATLAB from that directory. The example depends on other helper files in the same folder.
For Instructors
Students are welcome to use these, but explaining them is beyond the scope of the class.
closedloop_assess_main.m— extension of the same logic asclosedloop_assess_example.mto process the full dataset.- Log conversion —
bin2mat.py