HOME SERVICES SUBSTACK

CODE BLUEPRINT

Rust Quadcopter Flight Data

A Rust blueprint for capturing quadcopter sensor data at 200 Hz. Compare SQLite WAL with append-only raw binary storage using the same reproducible flight data, and measure storage size, throughput, latency, and CPU use.

Rust QuadCopter Flight Data diagram

From simulated flight to recorded data

Ten channels travel together: four rotor speeds, three accelerometer axes, and three gyroscope axes. The mocker program generates seeded flight maneuvers; simrec replays them in real time or as fast as possible.

Bounded queues connect the replay, dispatcher, and recording threads. Backpressure protects the main recording from dropped ticks. Choose raw binary, SQLite with a timestamp primary key, or SQLite with ten additional channel indexes to compare their write costs.

Batched writes, measurable tradeoffs

SQLite uses WAL mode, cached prepared statements, and one transaction per batch, with a default 100 ms flush interval. Published metrics track throughput, flush latency, backpressure, and output size, with CPU and memory sampling available on macOS.

This is a capture benchmark, not a crash-durable flight recorder. SQLite's synchronous=NORMAL setting preserves database consistency, but recent commits can be lost after power failure.

A lighter view for the console

A separate summary thread writes minimum, maximum, and average values for every channel in 500 ms buckets. Its best-effort queue can drop batches without slowing the main recording.

The console integration contract uses this 2 Hz SQLite summary, opened read-only, for a rolling 60-second view. Maneuver labels come from the generated flight story.

Quadcopter flight console interface preview
Flight console interface preview.
rust-blueprint-quadcopter-flight-data