Teaching pack · UAT 206
A 15-week teaching plan, 5 worksheets, a scoring rubric and a map from the course description to the lessons, for instructors to evaluate and adapt before teaching.
Coverage of the course description
The lessons fully teach 10 of 10 description topics. Each topic lists the modules and lesson sections that teach it, and incomplete topics say what is missing.
| Description topic | Modules | Where it is taught | Status |
|---|---|---|---|
| System modeling | M1 | Module 1: a first-order motor model, vertical dynamics and linearisation, second-order transfer functions | Covered |
| Feedback control principles | M1 | Module 1: the closed-loop block diagram | Covered |
| Stability | M2 | Module 2: stability and poles, and time delay eats phase | Covered |
| System response | M2 | Module 2: step-response metrics and the simulation-versus-formula example | Covered |
| PID control | M3 | Module 3: two forms of PID, integral windup, derivative on measurement and filtering | Covered |
| Attitude and altitude stabilization | M3M4 | Module 3: altitude control with saturated thrust · Module 4: cascaded control, attitude and rate loops | Covered |
| Autopilot architecture | M4 | Module 4: cascaded control, and flight modes and active loops | Covered |
| Configuration | M4 | Module 4: managing parameter files and the example comparing two parameter files | Covered |
| Tuning | M3M5 | Module 3: tuning order · Module 5: comparing two tuning sets from a rate log | Covered |
| Flight-control simulation | M2M5 | Module 2: simulation versus formula · Module 5: experiment architecture, step responses from logs and tracking error with wind in SITL | Covered |
Weekly teaching plan
| Week | Topic | Pre-class | Lecture | Lab | Evidence |
|---|---|---|---|---|---|
| 1 M1 | Control systems and the closed-loop block diagram | Read module 1 up to 'The closed-loop block diagram' | Setpoint, error, controller, plant and sensor | Worksheet 1 part A: safety briefing, mount the motor on the thrust stand and find k in T = k u² | Steady thrust against throttle and the value of k |
| 2 M1 | A first-order motor model | Read the first-order model section; run Example 1 | The time constant and finding it from a step response | Worksheet 1 part B: step the throttle, record thrust against time and find τ | Thrust-time plot and the value of τ |
| 3 M1 | Vertical dynamics, linearisation and second-order transfer functions | Read the vertical dynamics and second-order sections; run Example 2; take the module 1 quiz | Hover throttle, local gain, and ζ and ω₀ | Worksheet 1 part C: find hover throttle with and without payload; draw the altitude controller block diagram with units | Hover throttle results, block diagram and quiz result |
| 4 M2 | Step-response metrics | Read module 2 up to the step-response metrics; run Example 1 | Overshoot, rise time, settling time and their link to ζ | Worksheet 2 part A: try three values of ω₀ in Example 1; record overshoot and settling time | Response metrics for three cases |
| 5 M2 | Stability and poles | Read the stability and poles section | Pole locations in the complex plane and response shape | Worksheet 2 part B: plot each case's poles on graph paper and compare with Figure 2 | Pole plots with explanation |
| 6 M2 | Time delay eats phase | Read the time delay section; run Example 2; take the module 2 quiz | Critical delay π/(2K) and phase margin | Worksheet 2 part C: change K to find the critical delay; lower the gyro filter frequency in SITL and watch the oscillation in the log | Conclusion on target ζ and phase margin, and quiz result |
| 7 M3 | Two forms of PID | Read module 3 up to 'Two forms of PID'; run Example 1 | The roles of P, I and D and converting between the two forms | Worksheet 3 part A: change KP, KI and KD one at a time in Example 1; tabulate results | Overshoot and settling time against gains |
| 8 M3 | Integral windup and derivative on measurement | Read the windup and derivative sections; run Example 2 | Thrust saturation, climb-rate limits and control peaks on setpoint change | Worksheet 3 part B: add a 2 m/s climb-rate limit; vary N between 5 and 20 | Before-and-after plots and D-term peaks |
| 9 M3 | Tuning order; midterm | Read the tuning order section; review modules 1–3; take the module 3 quiz | Midterm examination (modules 1–3) | Worksheet 3 part C: identify the rate loop's P, I, D and filter parameters in the PX4 or ArduPilot docs; write the tuning order | Worksheet 3 report and midterm score |
| 10 M4 | Cascaded control | Read module 4 up to 'Cascaded control' | Position, velocity, attitude and rate loops | Worksheet 4 part A: start SITL, save the default parameter file and find the parameters for every loop in Figure 1 | Parameter table with defaults and units |
| 11 M4 | Flight modes and active loops | Read the flight mode section; run Example 1 | Which loops each mode uses and what the sticks mean in each | Worksheet 4 part B: fly every mode in SITL; record what each stick axis means | Table of modes, loops and sticks |
| 12 M4 | Managing parameter files | Read the parameter file section; run Example 2; take the module 4 quiz | Saving, comparing and restoring parameters systematically | Worksheet 4 part C: raise the rate-loop P by 20% steps, compare files with Example 2, then restore | File comparison, proof of restore, and quiz result |
| 13 M5 | Experiment architecture and step responses from logs | Read module 5 up to 'Measuring step responses from logs'; run Example 1 | Recording firmware and simulator versions; comparing two tuning sets | Worksheet 5 part A: command a roll step in SITL, export rate data and apply the metrics function | Metrics table for two tuning sets |
| 14 M5 | Tracking error with wind | Read the tracking error section; run Example 2; take the module 5 quiz | Path-tracking error and the limits of simulation results | Worksheet 5 part B: fly a straight-line mission with and without wind following lab L02 and compute the errors | Error table for both cases and quiz result |
| 15 M5 | Mini-project presentations | Prepare the SITL tuning comparison report | Course wrap-up and project criteria | Present the tuning comparison with plots, parameter files and simulation limits | Mini-project report and presentation, scored with the rubric |
Worksheets and instructor guide
One worksheet per module. Students open it on the web, print it or download the .docx. The instructor guide under each worksheet gives the class timing, expected results, discussion questions and notes for students with different backgrounds.
1Worksheet 1 Motor test stand
Lab · About 6 h of class time · CLO1
Objective: Measure a real motor and propeller to build a first-order model, find hover throttle and draw the altitude controller block diagram
Equipment
- Thrust stand with propeller guard
- Motor, ESC and propeller
- Power supply or battery specified by the lab
- Computer with Python and the module 1 example code
Safety
- Secure the stand and motor and always use the propeller guard
- Stand out of the propeller plane and wear safety glasses as the lab requires
- Connect power last and disconnect it before touching the propeller
Steps
- Mount the motor and propeller on the thrust stand following lab safety rules
- Command several throttle levels, record steady thrust and find k in T = k u²
- Step the throttle, record thrust against time and find τ with Example 1
- Use Example 2 to find hover throttle with and without payload
- Draw the altitude controller block diagram for module 3 with every signal's unit
Deliverables
- Thrust table and k
- Step response plot and τ
- Hover throttle results
- Block diagram with units
Checklist
- Table 1 has at least 5 throttle levels, each with thrust in N and k worked out
- τ is found by both methods, compared in Table 2, and runnable code is attached
- The propeller and power source used are stated, and only the throttle changed between runs
- The lab instructor has signed that the propeller guard was fitted and power was connected last before the first run
- The block diagram shows reference, error, command, output, disturbance and feedback, each with a unit
Instructor guide
Class timing
- Objectives and test-stand safety briefing30 min
- Mount the motor and measure steady thrust for Table 190 min
- Throttle step tests and τ with Example 190 min
- Hover throttle with Example 2, with and without payload45 min
- Draw the altitude controller block diagram with units60 min
- Wrap-up, questions and hand-in checklist45 min
Expected results
- Table 1 (numbers depend on the real motor; if it gives 8 N at full throttle as in the lesson's Example 2): u = 0.2, 0.4, 0.6, 0.8, 1.0 gives T = 0.32, 1.28, 2.88, 5.12, 8.00 N and k = 8.0 N in every row. With a real motor the rows should give similar k; accept rows within about 10% of the mean, and expect larger scatter at very low throttle.
- Table 2 (with the Example 1 data and the 1.5 kg mass of Example 2): final thrust 5.99 N, 63.2% = 3.79 N, τ from the curve 49.9 ms and from the fit 49.6 ms (accept 45 to 55 ms), 95% reached at 3τ, about 150 ms, hover thrust per motor 3.68 N, hover throttle 0.678, local gain 43.4 N per unit throttle, thrust-to-weight ratio 2.18. With an assumed 0.3 kg payload (1.8 kg total): 4.41 N per motor, hover throttle 0.743, ratio 1.81.
- Block diagram: desired altitude r (m) enters a summing circle giving error e = r - z (m), the controller gives command u (throttle 0 to 1, or thrust in N), the aircraft is pushed by wind as a disturbance and gives real altitude z (m), and a sensor or estimator (m) feeds it back with a minus sign. A strong diagram has a unit on every line and separates the measured value from the real one.
- k is similar across mid throttle, so T = k u² fits well, but the linear model around hover only holds near hover: from the 0.678 hover point to u = 0.9, real thrust is 6.48 N while the straight line predicts 6.09 N, about 0.4 N low. A strong answer backs this with the group's own numbers.
- The two methods differ by only about 0.3 ms (49.9 versus 49.6 ms). With a noisy load cell, trust the fit, because it uses the whole range rather than a few samples. A τ of about 50 ms means the motors cannot follow faster than that, so the rate loop should not demand changes faster than the motors can follow.
- Hover throttle rises from 0.678 to 0.743 and the thrust-to-weight ratio falls from 2.18 to 1.81, leaving less throttle for climbing. Acceleration per 0.01 throttle drops from 0.29 to 0.26 m/s², so the tuned gains may no longer fit, and hover throttle must be re-checked whenever weight or battery changes.
- Units give a gain its meaning. If one part uses altitude in metres and another in centimetres, the gain is off by a factor of 100; the same happens with throttle in percent (0 to 100) instead of 0 to 1. A strong answer notes that this error is invisible in the diagram's shape but obvious once units are written on it.
Discussion questions
- If the motors have τ of about 50 ms, what does a flight controller running hundreds of times a second gain from that speed?
- As the battery runs down in flight, which way would hover throttle move, and how would that affect the altitude controller?
- What do we give up by linearising around hover, and when does that matter?
Adapting to student background
- Upper secondary (M.6)
- Have them derive u_h = √(mg/(4k)) by hand before running the code and predict τ from the plot first; give extra time to mount the motor and read the load cell, paired with a hands-on peer.
- Vocational certificate
- Start with mounting and reading real thrust, then give a fill-in table to work out u² and k row by row with a calculator before comparing with the code.
- Diploma
- Extension: repeat the step test from two starting throttle levels to see whether τ changes, and measure thrust with a real payload against the calculated value.
2Worksheet 2 Response metrics and delay
Lab · About 6 h of class time · CLO1
Objective: Link response metrics to pole locations and show the effect of delay on stability in code and in SITL
Equipment
- Python and the module 2 example code
- Graph paper
- PX4 or ArduPilot SITL and a log viewer
Safety
- Simulation only; no real flights
Steps
- Try three values of ω₀ in Example 1; record overshoot and settling time
- Plot each case's poles on graph paper and compare with Figure 2
- Change K in Example 2, find the new critical delay and compare with π/(2K)
- In SITL, gradually add delay or lower the gyro filter frequency and watch oscillation in the log
- Conclude the ζ and phase margin to aim for on the lab drone
Deliverables
- Response metrics table
- Pole plots
- Critical delay table
- Log plots and conclusion
Checklist
- Table 1 has all 6 rows, overshoot in %, settling time in s and poles written as a ± bi
- Every row's poles are plotted to scale, and cases with the same ζ lie on the same angle line
- Each run changes only one value (ω₀, K, delay or filter frequency) and the value is written down
- The SITL log plot is attached with the parameter changed, its values and the firmware version
- The conclusion gives a ζ and phase margin range with reasons from the group's own results
Instructor guide
Class timing
- Objectives and review of response metrics20 min
- Run Example 1 with three ω₀ values for Table 170 min
- Work out and plot the poles on graph paper50 min
- Run Example 2 with three K values for Table 260 min
- Delay or gyro filter experiment in SITL and log reading120 min
- Conclusion, questions and hand-in checklist40 min
Expected results
- Table 1 (if the group picks ω₀ = 2, 4, 8 rad/s and ζ = 0.5, 0.707): overshoot 16.3% and 4.3% at every ω₀ (8 rad/s gives 16.2% and 4.2% because of the 1 ms step; accept ±0.2 points). Settling time at ω₀ = 2: 4.03 and 2.98 s, at 4: 2.02 and 1.49 s, at 8: 1.01 and 0.74 s; the formula gives 4.00, 2.83 / 2.00, 1.41 / 1.00, 0.71 s. Poles at ω₀ = 2: -1.00 ± 1.73i and -1.41 ± 1.41i, at 4: -2.00 ± 3.46i and -2.83 ± 2.83i, at 8: -4.00 ± 6.93i and -5.66 ± 5.66i. If the group picks other ω₀ values, check that settling time scales as 1/ω₀.
- Table 2 (if the group picks K = 10, 20, 40 rad/s): π/(2K) = 157.1, 78.5, 39.3 ms, and phase margin at 20 ms delay = 78.5, 67.1, 44.2 deg. The delay where the code stops settling should be close to π/(2K) (the lesson at K = 20: 75 ms still oscillates, 90 ms grows); accept a few ms either way.
- SITL: as delay is added or the gyro filter frequency is lowered step by step, the rate log first shows a small continuous oscillation and then a larger one. The onset depends on firmware version and model, so there is no fixed number. A strong conclusion proposes ζ of about 0.6 to 0.8 and a phase margin of about 30 to 60 deg, as in the lesson, and names the parameter and values used.
- Overshoot depends only on ζ, which sets the pole angle, while ω₀ sets the pole distance from the origin. Doubling ω₀ moves the poles out along the same angle line, so settling is twice as fast (2.02 to 1.01 s at ζ = 0.5) with the same overshoot.
- In Table 1 the largest gap is at ζ = 0.707 (for example 1.49 versus 1.41 s at ω₀ = 4), and the lesson shows larger gaps at ζ = 0.3 and 1.0 (2.81 versus 3.33 s, and 1.46 versus 1.00 s). The formula is a rough estimate; always measure the real response.
- The critical delay halves (78.5 to 39.3 ms) because the crossover frequency equals K and delay takes phase ωτd, so a higher crossover loses more phase. At K = 40, just 20 ms of delay leaves only 44.2 deg of phase margin.
- A low gyro filter frequency adds delay to the loop, which eats phase margin until little or none is left, so the drone can oscillate with unchanged PID gains. A strong answer points to where the oscillation starts in the log and gives the filter setting at that point.
Discussion questions
- Why is demanding zero overshoot a poor choice for a drone?
- The module 1 motors had τ of about 50 ms. How does that relate to the delay that eats phase margin?
- Why look at a long log rather than a single response?
Adapting to student background
- Upper secondary (M.6)
- Have them find the poles from s² + 2ζω₀s + ω₀² = 0 with the quadratic formula before comparing with the table; give extra time in SITL and log reading with a confident peer.
- Vocational certificate
- Hand out an s-plane grid with the ζ angle lines already drawn and a fill-in table; use a calculator for 4/(ζω₀), and spend more time on the SITL experiment.
- Diploma
- Extension: find the gyro filter setting where oscillation starts in SITL three times, check repeatability, and compare with the critical delay from Example 2.
3Worksheet 3 Altitude PID in simulation
Analysis activity · About 6 h of class time · CLO2
Objective: Explore the effect of P, I, D, climb-rate limits and derivative filtering, and link them to real autopilot parameters
Equipment
- Python and the module 3 example code
- PX4 or ArduPilot documentation
Safety
- Simulation and desk work only; no real flights
Steps
- Run Example 1, changing KP, KI and KD one at a time; tabulate overshoot and settling time
- Use Example 3, switching rate_limit and stop_i, and compare a 2 m/s climb-rate limit with and without stopping I against no limit
- Use Example 4, changing KD and KI together, and see whether overshoot keeps falling
- Use Example 2 with N from 5 to 20 and watch the D-term peak
- Identify the rate loop's P, I, D and filter parameters in the PX4 or ArduPilot docs
- Write the tuning order you will use in SITL in module 5
Deliverables
- Results table against gains
- Plots of climb-rate limit and D-term peaks
- Rate-loop parameter table
- Tuning order
Checklist
- Every row of Table 1 changes only one gain from the base set, with overshoot in m and time in s
- The climb-rate limit is run both with and without stopping I, and compared with the base 1.58 m
- D-term peaks are recorded for N = 5, 10 and 20, both from the error and from the measurement
- Table 3 spells parameter names exactly as in the documentation and states the documentation version used
- The answer to question 1 explains the role of I, not just the number
Instructor guide
Class timing
- Objectives and review of PID and windup20 min
- Run Example 1 one gain at a time for Table 1100 min
- Add the climb-rate limit, compare, and try KD with KI60 min
- Run Example 2 with several N values50 min
- Find the rate-loop parameters in the documentation for Table 370 min
- Tuning order, questions and hand-in checklist60 min
Expected results
- Table 1 (Example 1 base set KP 1.5, KI 0.4, KD 2.0, acceleration limited to ±3 m/s², and if the group changes one gain at a time to KP 1.0/2.5, KI 0/0.8, KD 1.0/3.0 with clamping on): no anti-windup 4.14 m, 11.0 s; clamping 1.58 m, 9.8 s; KP 1.0: 2.96 m, 15.7 s; KP 2.5: 1.66 m, 5.9 s; KI 0: 0.10 m, 3.9 s; KI 0.8: 2.62 m, 11.1 s; KD 1.0: 3.43 m, 11.4 s; KD 3.0: 1.94 m, 13.0 s; KD 3.0 with KI 0.27: 1.48 m, 16.3 s (Example 4). If the group picks other values, check the trends and that only one gain changed per row.
- Table 2 (matching the climb function in Example 3, if the limit is written as climb-rate setpoint = (KP e + KI∫e)/KD clamped to ±2 m/s, then acceleration = KD × (setpoint - v), which equals the original law when not limited): I stopped while limited 0.53 m, 10.6 s (a 10 m climb at 2 m/s needs at least 5.0 s); I not stopped 5.56 m, 16.1 s. D-term peaks: from the error unfiltered 2000; filtered with N = 5, 10, 20 (Tf = 266.7, 133.3, 66.7 ms) 72.3, 139.5, 260.9; from the measurement, filtered, 0.57, 1.10, 2.02. Other ways of writing the limit give different numbers, but overshoot must drop clearly when I is stopped.
- Table 3: PX4 uses MC_ROLLRATE_P, MC_ROLLRATE_I, MC_ROLLRATE_D and MC_ROLLRATE_K (K = 1 gives the parallel form), with a low-pass filter on the D term (record its name from the documentation version used). ArduPilot uses ATC_RAT_RLL_P, ATC_RAT_RLL_I, ATC_RAT_RLL_D and filters ATC_RAT_RLL_FLTT, FLTE and FLTD, with the rate loop running at 400 Hz on a Pixhawk.
- Removing I cuts overshoot the most (1.58 to 0.10 m), because here most overshoot comes from I accumulated during the climb, and the model has no steady error for I to remove. A real drone still needs I to remove steady errors such as an offset centre of gravity or hover throttle that shifts with payload, so keep I and use anti-windup. KD 3.0 gives more overshoot than KD 2.0 (1.94 against 1.58 m) because a high KD makes the altitude loop behave like a PI loop with smaller gains KP/KD and KI/KD, so altitude approaches the target more slowly and I accumulates for longer (when 10 m is first reached, the I term is 2.53 m/s² at KD 2.0 and 4.11 m/s² at KD 3.0). The damping of the slow mode tied to I falls from ζ 0.86 to 0.67, even without acceleration saturation. Lowering KI along with it (KD 3.0 with KI 0.27) gives 1.48 m, but settling takes 16.3 s.
- With the climb rate limited, altitude approaches the target more slowly, so the error stays large for longer and I builds up more (when 10 m is first reached, the I term is 11.29 m/s² against 2.53 m/s² with no limit). On arrival the stored I pushes past by 5.56 m, against 1.58 m with no limit. This is why module 4 says the outer loop's anti-windup must be told when an inner loop saturates; stopping I brings it down to 0.53 m.
- A larger N shortens Tf = Td/N, so the filter smooths less and the peak grows (72.3, 139.5, 260.9 at N = 5, 10, 20). Derivative on measurement peaks at only about 0.6 to 2, because the measurement does not jump with the setpoint, unlike the error, which jumps by 10 at once.
- Ki = K/Ti = 2/4 = 0.5. Entering the numbers without converting gives the wrong gains, because the standard form multiplies every term by K while the parallel form keeps them separate. PX4 supports both through MC_ROLLRATE_K, so check which one is in use first.
- A strong answer starts with the rate loop, because every mode uses it, then tunes the attitude, velocity and position loops; it tests with step inputs in hover, changes one value at a time, saves the parameter file each time, and adds D only with filtering while watching motor temperature.
Discussion questions
- Why does PX4 support both parallel and standard PID forms, and how does each suit tuning?
- If D is always computed from the measurement, what do we lose in setpoint following?
- In Table 1, raising KD from 2.0 to 3.0 did not reduce overshoot. What does this warn us about general P, I, D rules when an I term is present?
Adapting to student background
- Upper secondary (M.6)
- Have them work the digital PID update by hand for the first 3 time steps and compare with the code, to see where each term comes from.
- Vocational certificate
- Give a script with the gains at the top and a fill-in table; let them change values and read the plots first, then explain the formula term by term.
- Diploma
- Extension: write back-calculation anti-windup as in the lesson and compare its overshoot with clamping.
4Worksheet 4 Exploring parameters and modes in SITL
Lab · About 6 h of class time · CLO3, CLO2
Objective: Tie each control loop to its parameters and flight modes, and practise traceable parameter-file management
Equipment
- PX4 or ArduPilot SITL
- QGroundControl or Mission Planner
- Python and the module 4 example code
Safety
- Simulation only; no real flights
- Never load experimental parameter files onto a real drone
Steps
- Start SITL, connect the GCS and save the default parameter file
- Find the parameters for every loop in Figure 1, noting defaults and units
- Fly each mode and record what each stick axis means
- Raise the rate-loop P by 20% steps, save files and compare with Example 2
- Use Compare Params or compare by hand before loading the originals back
Deliverables
- Parameter table for every loop
- Mode and stick table
- File comparison and proof of restore
Checklist
- The default parameter file is saved and its name written down before any change
- Table 1 has at least one parameter for every loop in Figure 1, each with value and unit
- Table 3 works out percentages against both the previous file and the original
- Proof of restore is attached: a comparison showing no differences from the default file
- The answer to question 1 uses the active loops from Table 2
Instructor guide
Class timing
- Objectives and parameter-file rules20 min
- Start SITL, connect the GCS and save the default file40 min
- Find the parameters of every loop for Table 180 min
- Fly each mode and fill in Table 290 min
- Raise P in 20% steps, save files and compare with Example 280 min
- Restore originals, questions and hand-in checklist50 min
Expected results
- Table 1: for PX4 at least MPC_XY_P and MPC_Z_P (position), MPC_XY_VEL_P_ACC (velocity), MC_ROLL_P (attitude) and MC_ROLLRATE_P, I, D, K (rate). For ArduPilot at least ATC_ANG_RLL_P (angle) and ATC_RAT_RLL_P, I, D with filters FLTT, FLTE, FLTD (rate); record the position-loop parameters as the GCS lists them. Defaults and units depend on the firmware version, so accept what the GCS actually shows. The values in the lesson's Example 2 are hypothetical, not defaults.
- Table 2 (from the lesson and Example 1): Stabilized/Stabilize uses the rate and attitude loops, with the pilot commanding tilt and throttle directly; Altitude/Alt Hold adds the altitude loop, and centre throttle holds height; Position/Loiter adds horizontal position, and releasing the sticks holds the drone in place; Mission/Auto uses every loop and generates its own path; record what the sticks do in the version used.
- Table 3 (if the default P is 0.135, the hypothetical value in Example 2): 0.162 (+20.0% from previous, +20.0% from original), 0.1944 (+20.0%, +44.0%, review), 0.2333 (+20.0%, +72.8%, review), using the 30% review limit of Example 2. With a different default the percentages stay the same. After restoring, the final file must show no differences from the default.
- Wandering only in Position and Mission while Altitude is fine points to the horizontal position loop, the only loop those modes have that Altitude lacks. Shaking in every mode points to the rate or attitude loops that every mode shares.
- Each step is 20% of the previous value, so the changes compound to +44.0% and +72.8% from the original. Comparing only with the previous file hides that the 30% review limit has been passed, so always compare with the original before flying and before restoring.
- Experimental files have not been tested on a real drone, and parameter names, meanings or defaults can differ between firmware versions and between airframes, so a copy can bring wrong or unsafe values. Start from that drone's own values and change a little at a time.
- For example, switching from Alt Hold to Stabilize with the throttle at centre: in Alt Hold that means hold height, but in Stabilize the throttle commands thrust directly, so the drone may climb or sink at once. A strong answer says the new meaning must be known before switching.
Discussion questions
- Why does Mission Planner's Compare Params not write to the vehicle until Write Params is pressed, and how is that safer?
- Why does a fast inner loop make the outer loop easier to design?
- If someone else must be able to repeat this experiment, what must be kept?
Adapting to student background
- Upper secondary (M.6)
- Have them explain the cascade from Figure 1 and predict each mode's loops before flying, then check against what they see; give extra time to practise with the GCS.
- Vocational certificate
- Hand out the list of parameter names to find, let them look up values in the GCS, and use a checklist for saving files each time; help with the percentages on a calculator before using the code.
- Diploma
- Extension: adapt Example 2 to read two real parameter files exported from the GCS and list the changes.
5Worksheet 5 Tuning and testing in SITL
Lab · About 6 h of class time · CLO2, CLO1
Objective: Compare two tuning sets from real simulator logs and measure path-tracking error with wind
Equipment
- PX4 (Gazebo) or ArduPilot SITL
- Flight Review or UAV Log Viewer
- Python and the module 5 example code
- Lab L02 instructions
Safety
- Simulation only; no real flights
Steps
- Start SITL and record firmware version, simulator version and parameter file
- Command a roll step in hover and export rate data from the log
- Apply the metrics function from Example 1 to both tuning sets
- Fly a straight-line mission with and without wind per L02 and compute errors with Example 2
- Write a short report comparing tunings with plots, parameter files and simulation limits
Deliverables
- Metrics for both tuning sets
- Tracking error table
- Short report with parameter files
Checklist
- Every run records the firmware version, simulator version and parameter file name
- The two tuning sets differ only in the stated gains; everything else is the same
- Metrics are computed with the metrics function after trimming data before the command and using the real final value, in ms, % and s
- The report attaches plots and parameter files and states the limits of simulation results
- The answer to question 3 uses the mean error to explain the effect of wind
Instructor guide
Class timing
- Objectives and experiment procedure20 min
- Start SITL and record software versions and parameter files50 min
- Roll step tests with both tuning sets and log export80 min
- Compute metrics with Example 1 for Table 140 min
- Straight-line missions with and without wind and error calculation100 min
- Short report, questions and hand-in checklist70 min
Expected results
- Table 1 (numbers depend on the real logs; if the responses resemble Example 1): set A rise time 256 ms, overshoot 20.5%, settling time 1.39 s; set B 424 ms, 4.6%, 1.20 s. With real logs, accept values consistent with the group's plots, and check that data before the command was trimmed and the real final value was used instead of 1.0.
- Table 2 (if the errors resemble Example 2): calm RMS 0.11 m, maximum 0.15 m, mean +0.01 m; crosswind RMS 0.78 m, maximum 1.10 m, mean +0.74 m. With real data the numbers depend on the wind setting, but the wind run should show a mean offset to one side.
- Good notes give the firmware and simulator (for example PX4 with Gazebo, or ArduPilot SITL), the log and parameter file names for every run, plots on the same axes and units, and the limit that SITL results must be confirmed with careful real flights before use.
- Choose set B: overshoot 4.6% against 20.5% and faster settling (1.20 versus 1.39 s), even though it rises more slowly (424 versus 256 ms). This is closer to what the PX4 guide asks for, following without oscillating or overshooting. A strong answer also admits the cost in speed.
- Overshoot matches e^(-πζ/√(1-ζ²)) at 20.5% and 4.6%, but 4/(ζω₀) gives settling times of 1.48 and 1.14 s against the measured 1.39 and 1.20 s, so the formula is only an estimate. Looking at plots alone cannot separate differences this small or compare two sets fairly.
- A mean of +0.74 m out of an RMS of 0.78 m means most of the error is a steady offset to one side (removing the mean leaves an RMS of about 0.23 m). The velocity loop is not fully rejecting a constant disturbance, so the next test is to raise the velocity loop's I a little, changing that one value and repeating the same mission.
- The simulator model does not match the real drone in everything, for example mass, motors, propellers, sensor noise and real wind. SITL gains are a starting point and must be confirmed with careful real flights, changing a little at a time, before use.
Discussion questions
- When should PX4 Autotune or ArduPilot AutoTune replace hand tuning, and how should the results be compared?
- Why should tracking error be reported as RMS, maximum and mean together?
- If a repeat gives different numbers, how would you tell whether the tuning or a different set-up caused it?
Adapting to student background
- Upper secondary (M.6)
- Have them work out the RMS of errors 0.3, -0.4 and 0 m by hand (0.29 m) and read rise time from the plot before using the code; give extra time to set up SITL and export logs.
- Vocational certificate
- Give a step-by-step log export guide with screenshots, focus on running and recording completely, then explain RMS with a small numeric example.
- Diploma
- Extension: run PX4 Autotune or ArduPilot AutoTune in SITL and compare its metrics with both hand-tuned sets.
Scoring rubric
For worksheets and the mini-project. Each criterion scores level (1–4) ÷ 4 × weight.
| Criterion | Weight | Excellent (4) | Good (3) | Fair (2) | Needs work (1) |
|---|---|---|---|---|---|
| Accuracy of models and calculations | 30% | Models and numbers all correct, units complete, code reproducible | Nearly all correct, method shown | Some errors or missing units | Many errors or no method |
| Systematic experiments and tuning | 30% | One change at a time, versions and parameters fully recorded, originals always restorable | Mostly systematic | Several changes at once or incomplete records | No method, not traceable |
| Interpreting response and stability | 20% | Explains results correctly with poles, ζ, delay and phase margin, including simulation limits | Nearly all explained correctly | Superficial explanation | No or wrong explanation |
| Safety and reporting | 20% | Follows all test-stand safety rules; clear report with plots and files | Nearly complete | Some key points missing | Ignores safety or no report |
Assessment map: CLOs and how they are assessed Draft
The CLOs are a web-team draft; the course owner sets the final ones (curriculum book, part 4). This table is built from the worksheet and module-quiz data, so it follows any change to the CLOs.