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.

Last updated: · 3(2-2-5) · Per week: lecture 2 h, lab 2 h, self-study 5 h; 60 contact hours per term

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 topicModulesWhere it is taughtStatus
System modelingM1Module 1: a first-order motor model, vertical dynamics and linearisation, second-order transfer functionsCovered
Feedback control principlesM1Module 1: the closed-loop block diagramCovered
StabilityM2Module 2: stability and poles, and time delay eats phaseCovered
System responseM2Module 2: step-response metrics and the simulation-versus-formula exampleCovered
PID controlM3Module 3: two forms of PID, integral windup, derivative on measurement and filteringCovered
Attitude and altitude stabilizationM3M4Module 3: altitude control with saturated thrust · Module 4: cascaded control, attitude and rate loopsCovered
Autopilot architectureM4Module 4: cascaded control, and flight modes and active loopsCovered
ConfigurationM4Module 4: managing parameter files and the example comparing two parameter filesCovered
TuningM3M5Module 3: tuning order · Module 5: comparing two tuning sets from a rate logCovered
Flight-control simulationM2M5Module 2: simulation versus formula · Module 5: experiment architecture, step responses from logs and tracking error with wind in SITLCovered

Weekly teaching plan

WeekTopicPre-classLectureLabEvidence
1 M1Control systems and the closed-loop block diagramRead module 1 up to 'The closed-loop block diagram'Setpoint, error, controller, plant and sensorWorksheet 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 M1A first-order motor modelRead the first-order model section; run Example 1The time constant and finding it from a step responseWorksheet 1 part B: step the throttle, record thrust against time and find τThrust-time plot and the value of τ
3 M1Vertical dynamics, linearisation and second-order transfer functionsRead the vertical dynamics and second-order sections; run Example 2; take the module 1 quizHover throttle, local gain, and ζ and ω₀Worksheet 1 part C: find hover throttle with and without payload; draw the altitude controller block diagram with unitsHover throttle results, block diagram and quiz result
4 M2Step-response metricsRead module 2 up to the step-response metrics; run Example 1Overshoot, rise time, settling time and their link to ζWorksheet 2 part A: try three values of ω₀ in Example 1; record overshoot and settling timeResponse metrics for three cases
5 M2Stability and polesRead the stability and poles sectionPole locations in the complex plane and response shapeWorksheet 2 part B: plot each case's poles on graph paper and compare with Figure 2Pole plots with explanation
6 M2Time delay eats phaseRead the time delay section; run Example 2; take the module 2 quizCritical delay π/(2K) and phase marginWorksheet 2 part C: change K to find the critical delay; lower the gyro filter frequency in SITL and watch the oscillation in the logConclusion on target ζ and phase margin, and quiz result
7 M3Two forms of PIDRead module 3 up to 'Two forms of PID'; run Example 1The roles of P, I and D and converting between the two formsWorksheet 3 part A: change KP, KI and KD one at a time in Example 1; tabulate resultsOvershoot and settling time against gains
8 M3Integral windup and derivative on measurementRead the windup and derivative sections; run Example 2Thrust saturation, climb-rate limits and control peaks on setpoint changeWorksheet 3 part B: add a 2 m/s climb-rate limit; vary N between 5 and 20Before-and-after plots and D-term peaks
9 M3Tuning order; midtermRead the tuning order section; review modules 1–3; take the module 3 quizMidterm 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 orderWorksheet 3 report and midterm score
10 M4Cascaded controlRead module 4 up to 'Cascaded control'Position, velocity, attitude and rate loopsWorksheet 4 part A: start SITL, save the default parameter file and find the parameters for every loop in Figure 1Parameter table with defaults and units
11 M4Flight modes and active loopsRead the flight mode section; run Example 1Which loops each mode uses and what the sticks mean in eachWorksheet 4 part B: fly every mode in SITL; record what each stick axis meansTable of modes, loops and sticks
12 M4Managing parameter filesRead the parameter file section; run Example 2; take the module 4 quizSaving, comparing and restoring parameters systematicallyWorksheet 4 part C: raise the rate-loop P by 20% steps, compare files with Example 2, then restoreFile comparison, proof of restore, and quiz result
13 M5Experiment architecture and step responses from logsRead module 5 up to 'Measuring step responses from logs'; run Example 1Recording firmware and simulator versions; comparing two tuning setsWorksheet 5 part A: command a roll step in SITL, export rate data and apply the metrics functionMetrics table for two tuning sets
14 M5Tracking error with windRead the tracking error section; run Example 2; take the module 5 quizPath-tracking error and the limits of simulation resultsWorksheet 5 part B: fly a straight-line mission with and without wind following lab L02 and compute the errorsError table for both cases and quiz result
15 M5Mini-project presentationsPrepare the SITL tuning comparison reportCourse wrap-up and project criteriaPresent the tuning comparison with plots, parameter files and simulation limitsMini-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

  1. Mount the motor and propeller on the thrust stand following lab safety rules
  2. Command several throttle levels, record steady thrust and find k in T = k u²
  3. Step the throttle, record thrust against time and find τ with Example 1
  4. Use Example 2 to find hover throttle with and without payload
  5. 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 (Accuracy of models and calculations)
  • τ is found by both methods, compared in Table 2, and runnable code is attached (Accuracy of models and calculations)
  • The propeller and power source used are stated, and only the throttle changed between runs (Systematic experiments and tuning)
  • The lab instructor has signed that the propeller guard was fitted and power was connected last before the first run (Safety and reporting)
  • The block diagram shows reference, error, command, output, disturbance and feedback, each with a unit (Accuracy of models and calculations)

Instructor guide

Class timing 360 min

  1. Objectives and test-stand safety briefing30 min
  2. Mount the motor and measure steady thrust for Table 190 min
  3. Throttle step tests and τ with Example 190 min
  4. Hover throttle with Example 2, with and without payload45 min
  5. Draw the altitude controller block diagram with units60 min
  6. Wrap-up, questions and hand-in checklist45 min

Expected results

  1. Record: Table 1 Steady thrust at each throttle levelTable 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.
  2. Record: Table 2 Step response and hover throttleTable 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.
  3. Record: Altitude controller block diagram with the unit of every signalBlock 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.
  4. Question 1: Is k in Table 1 the same at every throttle level? What does this say about using T = k u², and about using the linear model far from hover?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.
  5. Question 2: How far apart are τ from the 63.2% point and τ from the line fit? If the load cell is noisy, which method would you trust, and what does τ tell you about designing the rate loop?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.
  6. Question 3: When payload is added, how much do hover throttle and the thrust-to-weight ratio change? Do gains tuned without payload still fit, and why?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.
  7. Question 4: Why must the block diagram give the unit of every signal? Give one case where mixed units would make a gain badly wrong.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.

Common student mistakes: Common mistakes in the module 1 lesson

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

  1. Try three values of ω₀ in Example 1; record overshoot and settling time
  2. Plot each case's poles on graph paper and compare with Figure 2
  3. Change K in Example 2, find the new critical delay and compare with π/(2K)
  4. In SITL, gradually add delay or lower the gyro filter frequency and watch oscillation in the log
  5. 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 (Accuracy of models and calculations)
  • Every row's poles are plotted to scale, and cases with the same ζ lie on the same angle line (Interpreting response and stability)
  • Each run changes only one value (ω₀, K, delay or filter frequency) and the value is written down (Systematic experiments and tuning)
  • The SITL log plot is attached with the parameter changed, its values and the firmware version (Safety and reporting)
  • The conclusion gives a ζ and phase margin range with reasons from the group's own results (Interpreting response and stability)

Instructor guide

Class timing 360 min

  1. Objectives and review of response metrics20 min
  2. Run Example 1 with three ω₀ values for Table 170 min
  3. Work out and plot the poles on graph paper50 min
  4. Run Example 2 with three K values for Table 260 min
  5. Delay or gyro filter experiment in SITL and log reading120 min
  6. Conclusion, questions and hand-in checklist40 min

Expected results

  1. Record: Table 1 Response metrics and pole locationsTable 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/ω₀.
  2. Record: Table 2 Critical delay against KTable 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.
  3. Record: SITL notes: parameter changed, values used, what the log shows and the conclusionSITL: 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.
  4. Question 1: When ω₀ changed, why did overshoot barely change while settling time did? Explain with the poles you plotted.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.
  5. Question 2: In which case is 4/(ζω₀) furthest from the simulated settling time? What does this say about using the formula instead of measuring?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.
  6. Question 3: When K doubles, how does the critical delay change? Why is a faster loop less tolerant of delay?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.
  7. Question 4: From the SITL log, why can a drone oscillate even though its PID gains did not change?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.

Common student mistakes: Common mistakes in the module 2 lesson

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

  1. Run Example 1, changing KP, KI and KD one at a time; tabulate overshoot and settling time
  2. 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
  3. Use Example 4, changing KD and KI together, and see whether overshoot keeps falling
  4. Use Example 2 with N from 5 to 20 and watch the D-term peak
  5. Identify the rate loop's P, I, D and filter parameters in the PX4 or ArduPilot docs
  6. 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 (Systematic experiments and tuning)
  • The climb-rate limit is run both with and without stopping I, and compared with the base 1.58 m (Accuracy of models and calculations)
  • D-term peaks are recorded for N = 5, 10 and 20, both from the error and from the measurement (Accuracy of models and calculations)
  • Table 3 spells parameter names exactly as in the documentation and states the documentation version used (Safety and reporting)
  • The answer to question 1 explains the role of I, not just the number (Interpreting response and stability)

Instructor guide

Class timing 360 min

  1. Objectives and review of PID and windup20 min
  2. Run Example 1 one gain at a time for Table 1100 min
  3. Add the climb-rate limit, compare, and try KD with KI60 min
  4. Run Example 2 with several N values50 min
  5. Find the rate-loop parameters in the documentation for Table 370 min
  6. Tuning order, questions and hand-in checklist60 min

Expected results

  1. Record: Table 1 Effect of changing one gain at a timeTable 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.
  2. Record: Table 2 Climb-rate limit and D-term peaksTable 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.
  3. Record: Table 3 Rate-loop parametersTable 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.
  4. Question 1: From Table 1, which change cut overshoot the most? Why does removing I almost remove overshoot in this model, and should you remove I on a real drone? Also, why does KD 3.0 give more overshoot than KD 2.0 even though D damps oscillation?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.
  5. Question 2: With a 2 m/s climb-rate limit but I still accumulating while limited, the result is worse than no limit at all. Why?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.
  6. Question 3: Why does a larger N give a higher D-term peak, and why does computing D from the measurement fix the problem at its source?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.
  7. Question 4: A friend gives standard-form gains K = 2 and Ti = 4 s. What Ki do you enter in parallel form, and why must you know which form the autopilot uses before borrowing gains?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.
  8. Question 5: Write the tuning order you will use in SITL in module 5, with reasons.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.

Common student mistakes: Common mistakes in the module 3 lesson

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

  1. Start SITL, connect the GCS and save the default parameter file
  2. Find the parameters for every loop in Figure 1, noting defaults and units
  3. Fly each mode and record what each stick axis means
  4. Raise the rate-loop P by 20% steps, save files and compare with Example 2
  5. 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 (Systematic experiments and tuning)
  • Table 1 has at least one parameter for every loop in Figure 1, each with value and unit (Accuracy of models and calculations)
  • Table 3 works out percentages against both the previous file and the original (Accuracy of models and calculations)
  • Proof of restore is attached: a comparison showing no differences from the default file (Safety and reporting)
  • The answer to question 1 uses the active loops from Table 2 (Interpreting response and stability)

Instructor guide

Class timing 360 min

  1. Objectives and parameter-file rules20 min
  2. Start SITL, connect the GCS and save the default file40 min
  3. Find the parameters of every loop for Table 180 min
  4. Fly each mode and fill in Table 290 min
  5. Raise P in 20% steps, save files and compare with Example 280 min
  6. Restore originals, questions and hand-in checklist50 min

Expected results

  1. Record: Table 1 Parameters of every loopTable 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.
  2. Record: Table 2 Flight modes and stick meaningTable 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.
  3. Record: Table 3 Rate-loop P steps and file comparisonTable 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.
  4. Question 1: From Table 2, if the drone wanders only in Position and Mission but Altitude is fine, which loop is suspect? And if it shakes in every mode?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.
  5. Question 2: Each step adds only 20%, yet the third file differs from the original by much more. Why does the choice of reference file matter when comparing?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.
  6. Question 3: Why must experimental parameter files never be loaded onto a real drone, and why not copy parameters across firmware versions or between drones?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.
  7. Question 4: Give one in-flight mode change where the throttle stick's meaning changes, and say what the drone does if the pilot does not know.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.

Common student mistakes: Common mistakes in the module 4 lesson

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

  1. Start SITL and record firmware version, simulator version and parameter file
  2. Command a roll step in hover and export rate data from the log
  3. Apply the metrics function from Example 1 to both tuning sets
  4. Fly a straight-line mission with and without wind per L02 and compute errors with Example 2
  5. 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 (Systematic experiments and tuning)
  • The two tuning sets differ only in the stated gains; everything else is the same (Systematic experiments and tuning)
  • Metrics are computed with the metrics function after trimming data before the command and using the real final value, in ms, % and s (Accuracy of models and calculations)
  • The report attaches plots and parameter files and states the limits of simulation results (Safety and reporting)
  • The answer to question 3 uses the mean error to explain the effect of wind (Interpreting response and stability)

Instructor guide

Class timing 360 min

  1. Objectives and experiment procedure20 min
  2. Start SITL and record software versions and parameter files50 min
  3. Roll step tests with both tuning sets and log export80 min
  4. Compute metrics with Example 1 for Table 140 min
  5. Straight-line missions with and without wind and error calculation100 min
  6. Short report, questions and hand-in checklist70 min

Expected results

  1. Record: Table 1 Response metrics of the two tuning setsTable 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.
  2. Record: Table 2 Path-tracking errorTable 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.
  3. Record: Notes for the short report: firmware version, simulator version, log file names and limits of simulation resultsGood 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.
  4. Question 1: Which tuning set would you choose? Justify it with all three metrics, not just one.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.
  5. Question 2: How close are the measured overshoot and settling time to the second-order formulas, and why should you not judge by looking at the plot alone?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.
  6. Question 3: In the crosswind, the mean error is almost as large as the RMS. What does this tell you, and what would you change next?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.
  7. Question 4: Why can gains that work well in SITL not go straight onto the real drone?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.

Common student mistakes: Common mistakes in the module 5 lesson

Scoring rubric

For worksheets and the mini-project. Each criterion scores level (1–4) ÷ 4 × weight.

CriterionWeightExcellent (4)Good (3)Fair (2)Needs work (1)
Accuracy of models and calculations30%Models and numbers all correct, units complete, code reproducibleNearly all correct, method shownSome errors or missing unitsMany errors or no method
Systematic experiments and tuning30%One change at a time, versions and parameters fully recorded, originals always restorableMostly systematicSeveral changes at once or incomplete recordsNo method, not traceable
Interpreting response and stability20%Explains results correctly with poles, ζ, delay and phase margin, including simulation limitsNearly all explained correctlySuperficial explanationNo or wrong explanation
Safety and reporting20%Follows all test-stand safety rules; clear report with plots and filesNearly completeSome key points missingIgnores 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.

CLOWorksheetsModule quizzes
CLO1 Model dynamics and analyse system responseW 1W 2W 5M1M2M5
CLO2 Design and tune PID controllersW 3W 4W 5M3M4M5
CLO3 Explain autopilot structure and flight modesW 4M4