UAT 104 Computer Programming
Worksheet 4 A link-quality report from a tlog
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
- Read telemetry_sample.tlog and count each message type
- Compute each type's messages per second
- Find link outages and packet loss; report flight-mode changes
- Export position, battery voltage (SYS_STATUS) and speed (VFR_HUD) to CSV
- Compare with module 3's flight_log_sample.csv
- If SITL is available, connect live, fly a short mission, record a tlog and rerun the program
Record of results
| Message type | Count | Time span used (s) | Rate (messages/s) |
|---|---|---|---|
| Event | Start (s) | Duration or count | Evidence from the code |
|---|---|---|---|
| Item | From the tlog | From flight_log_sample.csv | Why they differ |
|---|---|---|---|
Questions
Is the heartbeat gap you found longer than the simulated link outage? Why?
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?
If you counted lost packets without % 256, what would go wrong when the sequence number wraps from 255 back to 0?
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?
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