Protocol Engineering2026

MAVLink v2 Telemetry Recorder

An embedded-style C++17 learning project that reconstructs MAVLink v2 frames from a byte stream, decodes selected UAV messages, and records human-readable telemetry to CSV.

C++17MAVLink v2CMakeFinite State MachineCRC-16/X.25Binary Protocol Parsing

Key Metrics
Parser states4 explicit states
Memory modelFixed-size buffers
Decoded messages3 message types
Impact

Built and documented the complete shape of a streaming binary-protocol pipeline: byte framing, fixed-buffer state management, message dispatch, unit conversion, and CSV recording. The project also exposed the difference between a self-consistent demo and verified wire compatibility, an important boundary for the next iteration.

Problem Statement

UAV telemetry arrives as a continuous binary byte stream with no natural message boundaries.

Drone systems continuously transmit telemetry such as vehicle state, attitude, and GPS information. Unlike text-based formats such as JSON, MAVLink packets arrive back-to-back as raw bytes. A parser must identify packet boundaries, determine payload length, extract the message identifier, handle corrupted data, and verify packet integrity without losing synchronisation with the stream.

Solution

A byte-by-byte finite state machine with explicit framing and decoding boundaries.

Implemented the parsing path independently instead of calling MAVLink parsing utilities. The parser progresses through HUNTING, HEADER, PAYLOAD, and CRC states, reconstructs the 24-bit message ID, uses the declared payload length to bound collection, and separates framing from message-specific decoding. HEARTBEAT, ATTITUDE, and GLOBAL_POSITION_INT payloads are converted into a compact CSV representation.

Tradeoffs & Decisions

Predictable memory and inspectable state transitions, with deliberate prototype boundaries.

The parser avoids dynamic allocation and uses a fixed MAVLink-sized buffer, making its memory behaviour easy to reason about. The tradeoff is a narrower implementation than the production protocol: the demo assumes little-endian data, handles unsigned frames only, and currently exercises frames produced by its own harness. Interoperability work still needed includes validating CRC-extra accumulation against official wire vectors, handling the optional MAVLink v2 signature, and adding automated corruption and resynchronisation tests.

Architecture
Telemetry Stream
Byte Input
MAVLink FSM
Header Parser
Payload Buffer
Checksum Stage
Message Decoder
HEARTBEAT
ATTITUDE
GLOBAL_POSITION_INT
CSV Flight Log
StartEndWrite-back
Hover nodes for details