MAVLink Sequence Wrap: Review Counter Steps Before Calling Them Packet Loss
Inspect eight-bit MAVLink sequence transitions offline, preserving wrap and repeated-value ambiguity without turning a filtered or merged capture into a radio-loss percentage.

Start with the capture population rather than a loss percentage
An apparent jump in a drone telemetry sequence column can become a convincing loss statistic long before anyone has established what the table contains. In a NiVO support discussion, begin by identifying the capture and its population. This tutorial inspects transitions between already decoded MAVLink packet sequence values. It demonstrates wrap arithmetic and preserves ambiguous observations without assigning a radio failure. The example contains no actual flight recording, and the function neither decodes packets nor communicates with an aircraft. Its output is a transition inventory that still needs the recording context before any operational interpretation.
Record the capture revision, collection point, decoder and export filters. Establish whether the table includes all received message types or a selected subset, and whether different links were merged. Keep the original arrival order available. An export containing only a few requested fields can remain useful, but it may not retain the population needed to estimate message delivery. State that limitation explicitly. A percentage derived from an unexplained sequence column can answer a different question from the one the operator intended, even when its arithmetic is internally consistent and the resulting chart looks precise.
Read the eight-bit counter and its channel assumptions
MAVLink packet serialization defines the header sequence as an eight-bit value. The packet-loss guide describes incrementing it as messages are emitted on a channel and wrapping after two hundred fifty-five. Its simple loss interpretation assumes that the receiving system gets all messages from that channel and does not mix several channel sequences. The guide gives routing and redundant-link examples where those assumptions do not hold. These are reasons to inspect the communication arrangement before interpreting a counter jump, not reasons to dismiss every discrepancy as harmless.
Do not assume that grouping rows by system and component identifiers automatically recovers the required channel history. Identify what the recording point and routing configuration actually preserve. Likewise, filtering to one message type can remove messages that advanced the packet counter. Keep packet sequence separate from a logical message field such as STATUSTEXT chunk_seq. Those fields describe different relationships. A useful report names the exact column and grouping method rather than referring vaguely to a sequence number and allowing readers to infer a meaning that the source evidence cannot support.

Product context only; this photograph does not depict the constructed examples in this article.
Trace wrap and repeated values with a bounded Python check
Consider the invented received values two hundred fifty-four, two hundred fifty-five, zero, two and two. Calculating the next value minus the previous value modulo two hundred fifty-six produces advances of one, one, two and zero. The wrap from the maximum value to zero is therefore a one-step transition. The jump from zero to two is nonconsecutive in this small excerpt. The repeated two has an unchanged counter value. Neither of the latter observations establishes its cause, and an unchanged value is deliberately not labelled a confirmed duplicate packet by the recipe.
The function below validates a list of integer byte values, retains the observed order and emits one record for each adjacent pair. It does not return a missing-packet total or a loss percentage. A modulo advance alone cannot reveal every complete counter cycle that may have occurred between observations. A restart, reordering, repeated delivery, selection filter or merged path also requires evidence outside the arithmetic. An empty or single-value input produces no transitions; that result says nothing about capture completeness. Keep the input population and recording boundaries with every exported transition report.
def sequence_transitions(values):
if type(values) is not list:
raise ValueError("expected a selected list of decoded sequence values")
if any(type(v) is not int or not 0 <= v <= 255 for v in values):
raise ValueError("expected integer sequence bytes")
result = []
for i in range(1, len(values)):
advance = (values[i] - values[i - 1]) % 256
if advance == 1:
observation = "one-step-modulo"
elif advance == 0:
observation = "unchanged-counter-value"
else:
observation = "nonconsecutive-modulo"
result.append({"inputIndex": i, "previous": values[i - 1],
"current": values[i], "moduloAdvance": advance,
"observation": observation})
return result
# Constructed decoded header values only; no aircraft or capture access.
print(sequence_transitions([254, 255, 0, 2, 2]))Preserve discontinuities instead of repairing the sequence
When a real excerpt crosses a recording restart or an uncertain merge boundary, retain that boundary explicitly. Do not sort the counter values into numerical order, because a legitimate wrap would then be rearranged. Sorting by an unrelated event timestamp can also change the observed arrival sequence. Preserve both orders if the task needs them and explain their different roles. If the decoder rejected frames or the capture dropped records, retain those diagnostics alongside the sequence review. The small function does not examine checksums, signing state, payload validity or the acquisition path.
Treat a large modulo advance as an observation to investigate rather than automatically subtracting one and declaring that many missing radio packets. A short reverse movement in recorded order can produce a large forward modulo difference. The arithmetic cannot decide whether that movement reflects reordering, another stream or a different cause. Keep the surrounding records and the selection method so the producer can reproduce the finding. Where the needed channel or session identity cannot be established, a bounded statement about the excerpt is more defensible than a confident explanation of the physical link.
Relate the counter finding to the actual review question
A packet sequence observation is not a direct measure of camera-event completeness, survey coverage or control-system reliability. Define the evidence needed for the intended NiVO data handoff separately. A ground display and an onboard archive can preserve different populations, so compare them only after identifying their source and clock relationships. If the task is to investigate delayed telemetry, retain the appropriate timing evidence as well. The context photograph identifies a product family; it does not depict the invented sequence or establish a particular installed routing arrangement.
An investigation can proceed without replaying traffic or changing flight settings. Share the identified excerpt, topology description, export policy and transition findings through the normal technical review. If another recording point is available, compare the same bounded interval while keeping any selection differences visible. Do not quietly substitute a cleaner interval and present it as the original finding. A later test or corrected export should have its own identity and purpose. Preserve what the existing records actually show, then define a follow-up that can resolve the remaining question.
Deliver a reproducible transition inventory
A useful handoff names the capture revision, decoder version, message population, observed order, stream assumptions and excluded boundaries. Include the raw sequence values and the exact transition method. Report wrap, unchanged values and nonconsecutive advances without silently converting those labels into causes. Another analyst should be able to reproduce the same adjacent pairs before applying a more complete implementation-specific loss method. Keep unresolved topology and recording limitations with the result so they remain visible when the inventory is summarized in a report or support conversation.
For NiVO telemetry reviews, the practical benefit is a clearer separation between a counter observation and a link conclusion. The tutorial provides a concrete check over decoded byte values and a disciplined way to retain ambiguity. It complements general packet-loss-versus-delay and logical text-chunk reviews while addressing the specific wrap calculation. Any later loss percentage still needs its own justified population, implementation and evidence. Preserve that distinction through the handoff, and a small offline calculation can help locate a question without becoming an unsupported performance claim about an aircraft or radio system.



