Teaching pack · UAT 104

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 9 of 9 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
Computational thinkingM1Module 1: thinking like a computer, the four skills and the problem-solving stepsCovered
AlgorithmsM1M2Module 1: thinking like a computer (design an algorithm, test with known answers) · Module 2: deciding with if, starting from a flowchartCovered
Variables, data types and expressionsM1Module 1: variables and data types, calculating and converting units, decimals that are not exactly equalCovered
Control structuresM2Module 2: deciding with if; loops and data structuresCovered
FunctionsM2Module 2: reusable functions and testing functionsCovered
ArraysM2M3Module 3: Arrays with NumPy (shape, dtype, slicing, boolean masks, whole-array arithmetic, two-dimensional arrays, Example 1) · Module 2: Loops and data structures (list, tuple, dict) · Module 3: pandas columns and the vectorised calculation in Example 3Covered
File handlingM3M4Module 3: reading and writing files, CSV and text encodings, JSON for summaries · Module 4: reading tlog files with pymavlink and exporting to CSVCovered
DebuggingM2M3Module 2: Debugging: finding out why a program goes wrong (three kinds of error, reading a traceback from the bottom up, inspecting variables with print and breakpoint, pdb and the VS Code debugger, Example 3) · Handling errors · Testing functions · Module 3: Example 2, finding and fixing an altitude spikeCovered
Program development for acquiring, processing and presenting technological dataM3M4M5Module 3: exploring with pandas, cleaning, summarising by group and plotting · Module 4: finding link outages and packet loss, connecting to SITL live · Module 5: Git history and GitHub flow for teamworkCovered

Weekly teaching plan

WeekTopicPre-classLectureLabEvidence
1 M1Computational thinking and setting up the environmentRead module 1 up to 'Setting up the environment'The four computational-thinking skills, the problem-solving steps and choosing a Python versionWorksheet 1 part A: install Python, create .venv and install requirements.txtScreenshots of python --version and pip list
2 M1Variables, data types and unit conversionRead the variables and unit-conversion sections; run Example 1Basic data types, expressions and battery energy calculationsWorksheet 1 part B: write mission_calc.py and test it against Example 1 (24.4 minutes)mission_calc.py matching the example
3 M1Inexact decimals and readable codeRead the decimals and readable-code sections; run Example 2; take the module 1 quizFloating-point limits, safe comparison and naming conventionsWorksheet 1 part C: switch to the group's drone and explain Example 2 in JupyterNotebook with explanation and quiz result
4 M2Deciding with if and handling errorsRead module 2 on deciding with if and handling errorsFrom flowchart to if/elif/else, condition order and raising exceptionsWorksheet 2 part A: write battery_status() with a docstring and reject impossible valuesFunction that raises ValueError correctly
5 M2Loops and data structuresRead the loops and data structures section; run Examples 1 and 2list, tuple, dict and looping over point pairs for route lengthWorksheet 2 part B: write distance_m(), route_length_m() and a geofence checkmission_tools.py with three functions and a report of points outside the radius
6 M2Reusable functions, testing and debuggingRead the functions, testing and debugging sections; run Example 3; take the module 2 quizTesting boundary, impossible and known-answer values with pytest; reading tracebacks and using breakpoints with pdb or VS CodeWorksheet 2 part C: write test_mission_tools.py and swap tests with another groupPassing pytest output, cases that broke the other group's code, quiz result
7 M3Reading and writing CSV and JSON, and arrays with NumPyRead module 3 on reading and writing files, including CSV and text encodings, and on arrays with NumPy; run Example 1Text encodings, with open, saving summaries as JSON, and whole-array arithmetic with boolean masksWorksheet 3 part A: read flight_log_sample.csv; check missing values, outliers and periods under 10 satellitesData-quality issue table
8 M3Exploring, cleaning and summarising with pandasRead the exploring, cleaning and grouping sections; run Example 2Changing values with .loc in pandas 3 and groupby by flight modeWorksheet 3 part B: clean the data, compare describe() before and after, summarise by modeBefore/after describe() and per-mode summary
9 M3Method changes the answer, plotting; midtermRead the method and plotting sections; run Example 3; review modules 1–3; take the module 3 quizMidterm examination (modules 1–3)Worksheet 3 part C: compute distance two ways, plot, and rerun the notebook from the startData-quality notebook and midterm score
10 M4The MAVLink 2 frame and reading files with pymavlinkRead module 4 to 'Reading the file with pymavlink'; run Example 1Frame fields, decoding a heartbeat and a position, and the blocking pitfallWorksheet 4 part A: read telemetry_sample.tlog; count messages and rates per secondMessage count and rate table
11 M4Message units, link outages and packet lossRead the message-units and outage sections; run Example 2Converting integer fields to units and computing packet loss from sequence numbersWorksheet 4 part B: find outages, packet loss and flight-mode changesLink-quality report
12 M4Exporting CSV and connecting to SITL liveRead the CSV export and live SITL sections; take the module 4 quizCombining several message types and safety cautions for live connectionsWorksheet 4 part C: export position, voltage and speed to CSV, compare with module 3 file, try SITLCSV file, comparison and quiz result
13 M5From block programs to PythonRead module 5 on blocks to Python and polygons and stars; run Examples 1–2Translating Hula blocks to SimDrone commands and star turning anglesWorksheet 5 part A: translate a level 2–4 Hula example to Python with testsPython code and passing tests
14 M5Git, GitHub flow and concurrencyRead the concurrency, Git and GitHub flow sections; take the module 5 quizCommits, branches, pull requests, good commit messages and never committing secretsWorksheet 5 part B: create the group repository with .gitignore, open pull requests and review a teammateRepository link, commit history, at least one review per member, quiz result
15 M5Mini-project presentationsBring files from modules 2 to 4 into the repository and prepare a demoCourse wrap-up and project criteriaWorksheet 5 part C: demonstrate the program and, if a Hula drone is available, fly the original block program and compare with simulationMini-project repository and demo, 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 A mission calculator
Analysis activity · About 6 h of class time · CLO1

Objective: Set up a Python environment and write a first program comparing available flight time with the time the mission needs

Equipment

  • Computer with Python 3.12–3.14
  • requirements.txt and example code at /downloads/uat-104/
  • VS Code or Jupyter Notebook
  • Battery specification of the group's chosen drone

Safety

  • Desk work only; no flying

Steps

  1. Install Python, create .venv and install requirements.txt
  2. Screenshot python --version and pip list
  3. Write mission_calc.py storing voltage, capacity, usable fraction, average power and distance as variables
  4. Print available and required flight time; test against Example 1 to get 24.4 minutes
  5. Switch to the group's drone and check whether the mission fits
  6. Open Jupyter, run Example 2 and explain the result in a text cell

Deliverables

  • Environment screenshots
  • mission_calc.py
  • Notebook explaining Example 2

Checklist

  • Screenshots show (.venv) before the prompt, Python 3.12-3.14 and a pip list containing pandas, matplotlib, pymavlink and pytest (Program correctness)
  • The run giving 24.4 minutes for Example 1 is attached before the group drone's result (Testing and error finding)
  • Every value in Table 2 has a unit, and the group drone's row names the source of its battery data (Program correctness)
  • Variable names in mission_calc.py state meaning and unit, in lower case with underscores as in PEP 8 (Code quality and teamwork)

Instructor guide

Class timing 360 min

  1. Objectives, the problem-solving steps and testing against known answers30 min
  2. Install Python, create .venv, install requirements.txt and fill in Table 190 min
  3. Write mission_calc.py and test it against Example 1120 min
  4. Enter the group's drone values and fill in Table 260 min
  5. Run Example 2 in Jupyter and write Note 340 min
  6. Wrap-up, questions and hand-in checklist20 min

Expected results

  1. Record: Table 1 Development environment checkTable 1: python --version shows 3.12.x, 3.13.x or 3.14.x, (.venv) appears before the prompt, and pip list shows pandas (3.x), matplotlib (3.10 or later), pymavlink and pytest as in requirements.txt. If import pandas fails, the most common cause is forgetting to activate the venv.
  2. Record: Table 2 Output of mission_calc.pyTable 2, Example 1 row (22.2 V, 8.0 Ah, 80% usable, 350 W, 54 km/h): energy 177.6 Wh, usable 142.1 Wh, available time 24.4 min, speed 15.0 m/s. The lesson gives no mission distance; if the class uses 12 km, the mission needs 13.3 min and leaves 11.0 min of margin, so it fits; with 25 km it needs 27.8 min and does not fit (3.4 min short). The group drone's row depends on its real data; check it with V × Ah × usable fraction ÷ average power × 60. Accept rounding differences of ±0.1 min.
  3. Record: Note 3 Explain the result of Example 2 in your own wordsAdding 0.1 ten times gives 0.9999999999999999 because 0.1 can only be stored as a nearby binary value, so total == 1.0 is False and math.isclose is True. A good explanation says this is not a Python bug but the nature of float in every language.
  4. Question 1: Why must the program give 24.4 minutes for Example 1 before you enter your group's drone? If it printed 0.41 or 1461.4 instead, which line of the code would you suspect?To confirm the program calculates correctly first; if the result does not match, you know the code needs fixing rather than doubting the real data. 0.41 is the time in hours (142.08 ÷ 350), meaning the multiplication by 60 was forgotten; 1461.4 is the time in seconds, meaning 3600 was used instead of 60. Suspect the line that computes endurance_min.
  5. Question 2: How many minutes of margin does your group's drone have over the time the mission needs? If the usable fraction drops from 0.8 to 0.7, how much does the result change, and does the mission still fit?With the Example 1 values and 12 km, the margin is 11.0 min. At a usable fraction of 0.7, usable energy falls to 124.3 Wh and available time to 21.3 min (3.0 min less); a 12 km mission still fits. A strong answer uses the group drone's real numbers and says how sensitive the result is to the usable fraction.
  6. Question 3: Why does total == 1.0 in Example 2 give False while math.isclose(total, 1.0) gives True? What would happen if a program checked sensor values with ==?0.1 is not stored exactly, so the sum differs slightly from 1.0. == needs every bit to match, so it gives False; isclose allows a small difference within a tolerance. With == on sensor values a condition may never become true, for example checking that altitude equals 30.0 m and never finding it, because sensor values are never exact.
  7. Question 4: Give two variable names from your group's mission_calc.py and explain which unit mistake each name helps prevent.A strong answer: speed_kmh and speed_ms stop a km/h value going into a formula that needs m/s; capacity_ah stops someone entering 8000 (mAh) instead of 8.0. Names without units, such as v or x1, force the reader to guess.

Discussion questions

  • If there is no hand-worked example yet, where can you find a known answer to test a new program?
  • Why should each project have its own venv rather than installing libraries straight onto the computer?
  • Is the 80% usable fraction an engineering decision or a programming one, and who should set it?

Adapting to student background

Upper secondary (M.6)
Have them work Example 1 by hand first, then turn each step into one line of code; pair them with a peer who is quick at installing software during the venv setup.
Vocational certificate
Give a mission_calc.py skeleton with the variable names already set; they fill in one formula per line, print every intermediate value and check it with a calculator.
Diploma
Extension: make the program read values with input(), convert them to float and print a warning when the margin is under 20% of the mission time.

Common student mistakes: Common mistakes in the module 1 lesson

2Worksheet 2 A mission tools library
Analysis activity · About 6 h of class time · CLO1

Objective: Write reusable functions with automated tests and check a route against a geofence radius

Equipment

  • Computer with Python and pytest
  • Module 2 example code

Safety

  • Desk work only; no flying

Steps

  1. Create mission_tools.py with battery_status(), distance_m() and route_length_m(), each with a docstring
  2. Make functions raise an error on impossible values rather than guess
  3. Write test_mission_tools.py for boundary, impossible and known-answer values (1 degree of longitude on the equator is 111 194.9 m)
  4. Make pytest pass
  5. Write a function that checks every waypoint is inside the geofence radius and reports those outside
  6. Swap tests with another group, run them on their code and record the cases that break it

Deliverables

  • mission_tools.py
  • test_mission_tools.py and pytest output
  • List of cases that broke the other group's code

Checklist

  • Table 1 has all three case types: boundaries (16, 15, 7), invalid values (-1 or 120) and the known answer 111 194.9 m (Testing and error finding)
  • The python -m pytest output with every test passing is attached (Testing and error finding)
  • Every distance in Table 2 is in metres and points outside the radius are clearly marked (Program correctness)
  • Every function in mission_tools.py has a docstring and no bare except: is used (Code quality and teamwork)

Instructor guide

Class timing 360 min

  1. Review if, condition order and raising exceptions30 min
  2. Write the three functions in mission_tools.py with docstrings90 min
  3. Write test_mission_tools.py, run pytest and fill in Table 190 min
  4. Write the geofence check and fill in Table 260 min
  5. Swap test files, debug with tracebacks and fill in Table 360 min
  6. Wrap-up, questions and hand-in checklist30 min

Expected results

  1. Record: Table 1 Test cases in test_mission_tools.pyTable 1 has at least 8 rows: battery_status(16) = OK, (15) = LOW, (8) = LOW, (7) = CRITICAL, (0) = CRITICAL, (-1) and (120) raise ValueError, distance_m(0, 0, 0, 1) = 111 194.9 m (abs_tol 0.1) and route_length_m([(0, 0), (0, 1), (0, 2)]) = 222 389.9 m. Every row passes.
  2. Record: Table 2 Geofence check resultsTable 2 depends on the route the class uses; the lesson does not set one. With take-off at (13.000, 100.000), a 500 m radius and waypoints (13.002, 100.000), (13.002, 100.003), (13.000, 100.005), (12.996, 100.000), the distances are 222.4, 393.8, 541.7 and 444.8 m, and only (13.000, 100.005) is outside. Accept ±0.5 m from the earth radius used or rounding.
  3. Record: Table 3 Cases that broke the other group's codeTable 3 has at least 2 cases. Common ones: no ValueError for 120 or -1, OK returned at exactly 15, degrees passed to trigonometric functions without converting to radians (distance far off), and a list used as a default parameter value. Each case must name the line in the other group's file that causes it.
  4. Question 1: What do 15 and 7 give in battery_status()? If someone swapped the checks so <= 15 comes before <= 7, which test in Table 1 would catch it and which would not?15 gives LOW and 7 gives CRITICAL. If the order is swapped, 7 and lower values such as 5 give LOW, which is wrong. The test battery_status(7) == CRITICAL catches it, while the tests for 16, 15 and 8 still pass, so every level needs its own boundary case.
  5. Question 2: Why should battery_status() raise ValueError (and your other functions raise an error) on impossible values instead of returning a guess? How does the caller find out there is a problem?A guessed value looks correct and flows on into decisions, for example 120% reported as OK. Raising an error tells the caller at once, and the caller chooses how to handle it with a try/except naming the type, such as except ValueError. A strong answer notes that a bare except: would hide the problem again.
  6. Question 3: Pick one case from Table 3 that broke the other group's code. Which line of the traceback did you read first, and was the cause a syntax, runtime or logic error?Start from the last line, which gives the error type, then move up to the first line from the other group's own file. Example: ZeroDivisionError or ValueError is a runtime error, while a wrong result with no message, such as 15 giving OK, is a logic error that only a known-answer test catches.
  7. Question 4: If a waypoint is just outside the geofence radius from take-off, how should the program report it, and why should it not be rounded into a pass?Report the waypoint and its real distance, for example 541.7 m against a 500 m radius, and never round it into a pass, because the geofence is a safety limit and GNSS positions already carry error. A strong answer asks the planner to change the route rather than letting the program fix it.

Discussion questions

  • Do passing tests prove the code has no bugs? If not, what kind of confidence do they give?
  • Why does swapping test files with another group often find bugs the author could not see?
  • Should the geofence check also know about flight mode or battery? How does 'one function, one job' help decide?

Adapting to student background

Upper secondary (M.6)
Have them draw the flowchart of battery_status() before coding and write the tests before the function; pair them with a peer fluent in VS Code for the debugging part.
Vocational certificate
Give them the lesson's ready-made distance_m() and focus on writing the Table 1 test cases row by row; demonstrate setting a breakpoint with F9 in VS Code before they try it.
Diploma
Extension: make the geofence function take the radius and take-off point as parameters, and write a parametrised pytest that includes a point exactly on the radius.

Common student mistakes: Common mistakes in the module 2 lesson

3Worksheet 3 A flight-data quality report
Analysis activity · About 6 h of class time · CLO2

Objective: Read, check, clean, summarise and plot flight data in a notebook that reruns to the same result

Equipment

  • Computer with Python, pandas and matplotlib
  • flight_log_sample.csv from /downloads/uat-104/
  • Jupyter Notebook

Safety

  • Desk work only; no flying

Steps

  1. Read the file; check missing values, altitude outliers and periods under 10 GPS satellites; report in a table
  2. Clean with .loc and compare describe() before and after
  3. Summarise time and mean speed per flight mode
  4. Find when the battery first drops to 90%
  5. Compute distance flown by at least two methods and explain the choice
  6. Plot altitude and battery voltage against time, then rerun the notebook from the start to the same result

Deliverables

  • Reproducible notebook
  • Data-quality table and per-mode summary
  • Two plots with commentary

Checklist

  • Table 1 gives the row count and time of the missing values, the altitude spike and the under-10-satellite period, all three problems (Data handling and analysis)
  • Values are changed with a single .loc statement, and describe() before and after cleaning is attached (Data handling and analysis)
  • Table 3 has at least two methods, every value has a unit, and the chosen method is justified (Data handling and analysis)
  • The notebook gives the same results after Restart and Run All, and the original CSV is unchanged (Code quality and teamwork)
  • The altitude and voltage plots have axis labels with units (Data handling and analysis)

Instructor guide

Class timing 360 min

  1. The data pipeline and where the synthetic file comes from30 min
  2. Read and explore the file, fill in Table 175 min
  3. Clean with .loc and compare describe()60 min
  4. Summarise by mode, find when the battery reaches 90%, fill in Table 260 min
  5. Compute the distance by several methods, fill in Table 375 min
  6. Plot, rerun the whole notebook, answer questions and check before hand-in60 min

Expected results

  1. Record: Table 1 Data-quality problems in flight_log_sample.csvTable 1 (807 rows, 10 columns): batt_v missing in 2 rows at 200.0 and 200.5 s (found with isna); one altitude spike at 120.0 s, 69.94 m against a reference of 30.08 m (5-point rolling median, more than 5 m apart); gps_sats under 10 in 10 rows from 250.0 to 254.5 s (minimum 6). Acceptable handling: replace the spike with the reference, fill or leave the missing values while stating the row count, and never drop rows silently.
  2. Record: Table 2 Summary by flight modeTable 2: AUTO 659 rows, 329.5 s, 8.24 m/s; RTL 70 rows, 35.0 s, 8.50 m/s; GUIDED 44 rows, 22.0 s, 0.00 m/s; LAND 34 rows, 17.0 s, 0.00 m/s; 807 rows and 403.5 s in total. Every group should match exactly because the file is the same.
  3. Record: Table 3 Distance flown by different methodsTable 3: raw data 3 092 m (+77), weak-GPS points filled 3 067 m (+52), 3-point smoothing 3 014 m (-1), 5-point 2 991 m (-24), 9-point 2 951 m (-64). Another acceptable method is summing speed × 0.5 s, giving 3 014 m. Values should match within ±1 m.
  4. Question 1: How much does the maximum altitude from describe() differ before and after cleaning? If you reported the value before cleaning, what would a reader misunderstand?Before cleaning the maximum is 69.94 m, after cleaning 30.45 m, a difference of 39.49 m; the mean moves from 28.15 to 28.10 m and the median (29.97 m) does not change. Reporting the raw value would suggest the drone climbed to nearly 70 m against a 30 m plan, which could be read as breaking the allowed height.
  5. Question 2: Why is the raw-data distance in Table 3 longer than the plan, while the 9-point smoothed distance is shorter? Which method does your group report, and why?Noise makes the position jitter, so summing point to point overstates the distance, most of all in the weak-GPS period; a window that is too wide cuts the corners at turns and understates it. A strong answer picks the method closest to the plan or to another sensor (for example 3-point smoothing or the speed sum, about 3 014 m) and always reports the method with the result.
  6. Question 3: At what second does the battery first reach 90%, and which flight mode is the drone in then? What does this tell you about planning mission time?batt_pct first reaches 90% at 194.0 s (batt_v 24.33 V), in AUTO mode about halfway through the flight, and ends at 80%. A strong answer notes this mission used about 20% of the battery, and a longer one must be checked against the 15% low-battery threshold from module 2.
  7. Question 4: Why does rerunning the notebook from the start matter? If the group ran cells out of order or edited the original file, what would happen to the results handed in?A notebook run out of order may depend on variables that no longer exist, so someone else rerunning it gets different results or errors. Editing the original file means nobody can check what the raw data was; keep the original and save results to a new file.

Discussion questions

  • If real data has no planned route to compare with, how would you decide which distance method to trust?
  • Filling gaps with interpolate() suits battery voltage, but for which kinds of data might it be wrong?
  • Who needs to know how the data was cleaned, and where should that be recorded?

Adapting to student background

Upper secondary (M.6)
Ask them to predict how the mean and median will change once the spike is removed, then check the real output, linking to the statistics they already know.
Vocational certificate
Give a notebook with a heading cell for each step so they fill in one cell at a time, and explain each column in the file by pointing at a plot before any calculation.
Diploma
Extension: try spike thresholds of 2, 5 and 10 m and report which one catches the outlier without touching the real climb and landing.

Common student mistakes: Common mistakes in the module 3 lesson

4Worksheet 4 A link-quality report from a tlog
Lab · About 6 h of class time · CLO2

Objective: Read MAVLink telemetry with pymavlink, analyse link quality and export data to CSV

Equipment

  • Computer with Python and pymavlink
  • telemetry_sample.tlog and flight_log_sample.csv
  • Lab guide L09 in the drone knowledge hub
  • ArduPilot SITL (if available)

Safety

  • Computer and simulator work only; no real flights
  • Do not send commands from the program to a real drone during practice

Steps

  1. Read telemetry_sample.tlog and count each message type
  2. Compute each type's messages per second
  3. Find link outages and packet loss; report flight-mode changes
  4. Export position, battery voltage (SYS_STATUS) and speed (VFR_HUD) to CSV
  5. Compare with module 3's flight_log_sample.csv
  6. If SITL is available, connect live, fly a short mission, record a tlog and rerun the program

Deliverables

  • Message count and rate table
  • Link-quality and mode-change report
  • CSV file and comparison with the module 3 file

Checklist

  • Table 1 lists all 5 message types and states which time span the rates use (Data handling and analysis)
  • Table 2 has the outage, lost-packet count and percentage, and all 4 mode-change times (Program correctness)
  • The exported CSV is in converted units (deg, m, V, m/s), with no degE7, mm or mV left (Program correctness)
  • The file is read with blocking=False and the code sends no commands to any aircraft (Code quality and teamwork)

Instructor guide

Class timing 360 min

  1. Safety briefing, the MAVLink 2 frame and message units40 min
  2. Read the tlog, count messages, compute rates and fill in Table 180 min
  3. Find the outage, lost packets and flight modes, fill in Table 280 min
  4. Export the CSV and compare with the module 3 file, fill in Table 380 min
  5. Live SITL connection (if available) or discussion of results50 min
  6. Wrap-up, questions and hand-in checklist30 min

Expected results

  1. Record: Table 1 Message counts and ratesTable 1 (7 911 messages over 403.4 s): ATTITUDE 3 955, GLOBAL_POSITION_INT 1 582, VFR_HUD 1 582, HEARTBEAT 396, SYS_STATUS 396. Divided by the whole file this gives 9.80, 3.92, 3.92, 0.98 and 0.98 messages/s; excluding the 8 s outage, 10.0, 4.0, 4.0, 1.0 and 1.0 messages/s. Accept either if the time span is stated.
  2. Record: Table 2 Link quality and mode changesTable 2: no heartbeat for 9.0 s starting at 149.0 s; 160 of 8 071 packets lost (1.98%); mode changes at 0.0 s GUIDED, 22.0 s AUTO, 352.0 s RTL and 387.0 s LAND.
  3. Record: Table 3 CSV from the tlog compared with flight_log_sample.csvTable 3: 1 582 position rows from the tlog (4 per second) against 807 rows in the CSV (2 per second); maximum height 30.0 m against 30.45 m after cleaning; first SYS_STATUS voltage 25.16 V against 25.15 V, and the last both 24.32 V; mean VFR_HUD speed 7.49 m/s against 7.47 m/s (maximum 9.00 against 9.55 m/s because the CSV has noise). Positions during the outage are missing from the tlog but present in the CSV, which is recorded on board.
  4. Question 1: Is the heartbeat gap you found longer than the simulated link outage? Why?Yes. The heartbeat gap is 9 s while the link was lost for 8 s, because heartbeats come every 1 s, so the gap seen can be up to 1 s longer than the real outage.
  5. Question 2: From the rates in Table 1, roughly how many packets should an 8 s outage lose? Does that match the count from the sequence numbers?The total rate is about 10 + 4 + 4 + 1 + 1 = 20 messages/s, times 8 s gives 160 packets, exactly the count from the sequence numbers, so almost all lost packets come from the single outage.
  6. Question 3: If you counted lost packets without % 256, what would go wrong when the sequence number wraps from 255 back to 0?With a previous sequence number of 250 and a next one of 3, without % 256 you get 3 - 250 - 1 = -248, a negative number that spoils the total, while (3 - 250 - 1) % 256 = 8 packets, which is right.
  7. Question 4: Why does the number of position rows from the tlog differ from the rows in flight_log_sample.csv, and which time column should you use to join the two files?The tlog holds positions 4 times a second and nothing during the outage, while the CSV holds 2 per second for the whole flight. To join them, use the same clock, such as the autopilot's time_boot_ms, not the ground station's _timestamp, which is when the station received the message and depends on the link.
  8. Question 5: Why does this lesson only read telemetry, and why must the MAVLink port of a real aircraft never be opened to the internet?A wrong command could move a real aircraft unintentionally, so commands are always tried in SITL first, and an exposed MAVLink port lets anyone send commands, since message signing is not enabled in this lesson.

Discussion questions

  • If the link drops during a real flight, where can the data missing from the tlog be found, and what should an analyst be careful about?
  • Is 1.98% packet loss a lot or a little? What does it depend on?
  • What does analysing a tlog with a program give you that scrolling through graphs in the ground station does not?

Adapting to student background

Upper secondary (M.6)
Have them convert three values from the units table by hand first (degE7, mm, mV) and explain % 256 with a clock that wraps around.
Vocational certificate
Let them run the lesson's code first and change it one part at a time, focusing on reading the output and filling in the tables; if SITL is available, show the live ground-station view next to the program's output.
Diploma
Extension: connect to SITL, fly a short mission, cut the link by pausing MAVProxy briefly, then use the same program to find the outage in your own tlog.

Common student mistakes: Common mistakes in the module 4 lesson

5Worksheet 5 A team mini-project with Git
Lab · About 6 h of class time · CLO3, CLO1

Objective: Translate a block program into tested Python and combine the team's work in a repository with GitHub flow

Equipment

  • Computer with Python and Git
  • Students' GitHub accounts
  • Hula block reference and five-level examples
  • Hula drone and an indoor flying area (if available)

Safety

  • Never commit passwords, tokens or secrets; add .gitignore in the first commit
  • Fly the Hula drone only in a safe area under the instructor's supervision; keep people clear
  • Check batteries before flight and disconnect them when not in use

Steps

  1. Choose one Hula example from levels 2–4
  2. Translate it to Python with SimDrone
  3. Write tests confirming the route closes or turns fully as intended
  4. Create the group repository with .gitignore and bring in files from modules 2 to 4
  5. Each member branches, opens a pull request and reviews at least one teammate's work
  6. If a Hula drone is available, fly the original block program and compare with simulation

Deliverables

  • Repository link with every member's commits
  • Python code and passing tests
  • Pull requests and reviews
  • Notes comparing real flight with simulation (if done)

Checklist

  • The tests confirm the route with back_at_start() or the total turn, and pytest passes (Testing and error finding)
  • Table 2 turns match 360k/n and the leg counts match n/gcd(n, k) (Program correctness)
  • The repository has .gitignore in its first commit, no .venv or .env, and every member has at least one commit (Code quality and teamwork)
  • Every member opened a pull request and reviewed at least one teammate's work, and commit messages start with feat:, fix:, test: or docs: (Code quality and teamwork)

Instructor guide

Class timing 360 min

  1. Safety briefing on indoor flying, batteries and secrets in Git30 min
  2. Choose a Hula example, translate it to Python, fill in Table 180 min
  3. Write the route tests and fill in Table 260 min
  4. Create the repository, branch, open pull requests and review, fill in Table 3110 min
  5. Fly the original block program on a Hula drone (if available) and compare with the simulation50 min
  6. Wrap-up, questions and hand-in checklist30 min

Expected results

  1. Record: Table 1 Block program translated to PythonTable 1 maps every block: when clicked is the main program, Take off is drone.take_off(), Fly to Front 60 cm is drone.fly_forward(60), Turn Clockwise 90 degree is drone.turn_clockwise(90), Repeat 4 times is for _ in range(4): and Landing is drone.land(). If Take off is missing, the simulation must report take off first.
  2. Record: Table 2 Simulated and real flight resultsTable 2 from the lesson: {4/1} with 60 cm sides turns 90°, flies 240 cm, turns 360° in total and returns to the start; {5/2} with 50 cm sides turns 144°, flies 250 cm, turns 720° in total and returns to the start. The real flight depends on the area and calibration and usually ends several centimetres from the start; record the real offset.
  3. Record: Table 3 Team work in the repositoryTable 3 lists every member, each with their own branch such as feature/battery-check, commit messages like feat: add battery_status and distance_m or fix: treat 15% as LOW, not OK, and at least one reviewed pull request each. No commits go straight to main.
  4. Question 1: How does your group's test confirm that the route closes or turns fully? If the shape changed from {5/2} to {6/2}, would the same test pass, and why?Test with assert drone.back_at_start() or turned_deg equal to 360k; {5/2} returns after 5 legs with 720° of turning. Changing to {6/2} gives 120° turns and a return after 6/gcd(6, 2) = 3 legs, a triangle flown twice, so back_at_start() is still True after 6 legs. A test that only checks back_at_start() passes without giving a six-point star; also test the number of legs before the return.
  5. Question 2: If the real drone does not return exactly to its start as in the simulation, what could cause it, and what does SimDrone not model?SimDrone works on a flat plane only and does not model wind, turn and distance errors, speed given as a percentage of command (not m/s) or flight time, so a real drone drifts. A strong answer says real distances and turns must be calibrated before trusting the simulation.
  6. Question 3: Which commit message in Table 3 best says what changed, and which should be rewritten following Conventional Commits?A good message says what changed, such as fix: treat 15% as LOW, not OK. Messages such as update should be rewritten, for example test: add boundary tests for battery_status.
  7. Question 4: If a member accidentally commits a .env file holding an API key, what must the team do, in order, and why is deleting the file in the next commit not enough?First revoke or replace the API key at once, then clean the history, and add .env to .gitignore. Deleting the file in the next commit is not enough because Git history keeps every version and someone may already have copied or forked it.

Discussion questions

  • What does block programming do better than Python, and when should you move to Python?
  • Besides whether the code runs, what should a review of a teammate's work look at?
  • If the two threads in the level 5 example updated targets_marked at the same time without a Lock, what could happen?

Adapting to student background

Upper secondary (M.6)
Have them work out the turn angle and leg count from the formulas before running the simulation, then confirm with it; pair them with a peer who has flown drones for the real flight.
Vocational certificate
Start by flying the block program for real (if a drone is available), then translate one block at a time using Table 1; demonstrate each Git command on screen and have them follow.
Diploma
Extension: translate the two-thread level 5 example to Python with threading.Event and a Lock, and write a test that it marks 3 targets on every run.

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)
Program correctness30%Correct in all cases, matches known answers and handles invalid inputNearly all correct, minor edge-case flawsCorrect only for typical casesDoes not run or gives wrong results
Testing and error finding25%Tests cover boundary, invalid and known-answer values; all passMost cases tested; nearly all passOnly typical cases testedNo tests
Data handling and analysis25%Reads, cleans, summarises and plots correctly, explains method choice; notebook reproducibleNearly all correct; explanation incompleteErrors in cleaning or summarisingCannot read or process the data
Code quality and teamwork20%Clear names, docstrings, every member commits and reviews, meaningful messages, no secretsReadable; nearly everyone contributesHard to read or some members absentNo Git use or unreadable code

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 Write structured Python programs to solve technology problemsW 1W 2W 5M1M2M3M5
CLO2 Read, process and store data from files and telemetryW 3W 4M3M4
CLO3 Use Git and collaborative coding practicesW 5M5