UAT 104 Computer Programming

Worksheet 4 A link-quality report from a tlog

Lab 6 hAssesses CLO2

Objective

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

Equipment and materials

  • 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

Record of results

Table 1 Message counts and rates
Message typeCountTime span used (s)Rate (messages/s)
Table 2 Link quality and mode changes
EventStart (s)Duration or countEvidence from the code
Table 3 CSV from the tlog compared with flight_log_sample.csv
ItemFrom the tlogFrom flight_log_sample.csvWhy they differ

Questions

  1. Is the heartbeat gap you found longer than the simulated link outage? Why?

  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?

  3. If you counted lost packets without % 256, what would go wrong when the sequence number wraps from 255 back to 0?

  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?

  5. Why does this lesson only read telemetry, and why must the MAVLink port of a real aircraft never be opened to the internet?

Check before you hand in

What to hand in

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

CLO2 Read, process and store data from files and telemetry. (CLOs are a web-team draft; the course owner sets the final ones.)

Instructors: answers and teaching notes for this worksheet are in the teaching pack