Skip to main content

Crate hpr_flightdata

Crate hpr_flightdata 

Source
Expand description

Flight-log importers, the canonical flight record, smoothing and time alignment, and the readings taken from a flight with the provenance of each.

Guide: Start here says what works today and what is planned.

This crate does not depend on the simulator, and must not: reading a flight log and working out what it says is a use of this project in its own right, for someone who has a log and neither a design file nor any wish to simulate anything. Comparing a flight with a simulation of it is hpr-forensics, which depends on both.

Every reading carries where it came from (measured by an instrument, derived from what was measured, or clipped because the sensor saturated), and a reading the log cannot support is withheld with a reason rather than printed.

Status: pre-alpha. One format is read so far, PerfectFlite’s .pf2 (perfectflite), into the record every reader produces (log::FlightLog), and readings takes a first set of readings from it: liftoff, apogee, the top speed, landing and the descent. The guide’s reading a flight log page shows them on a log. The other loggers’ formats are planned for milestone M7.1 of the roadmap, and the rest of the readings, smoothing and reconstruction for M7.2.

use hpr_flightdata::{perfectflite, readings};

// A few rows of an invented PerfectFlite log: feet and seconds.
let mut text = String::from("PerfectFlite Pnut\nData: (Time, Altitude, Velocity)\n");
for (i, feet) in [0, 0, 0, 40, 90, 120, 130, 130, 120, 90, 40, 5, 0, 0, 0, 0].iter().enumerate() {
    text.push_str(&format!("{}, {feet}, 0\n", i as f64 * 0.5));
}
let log = perfectflite::read(&text)?;
let read = readings::read(&log);
let apogee = read.apogee.value().expect("the log climbs");
assert_eq!(apogee.altitude_m, 130.0 * 0.3048);
assert_eq!(apogee.time_s, 3.25); // midway between the two samples at the top

Modules§

error
Why a flight log couldn’t be read.
filter
Filters a flight log’s channels are cleaned with before a reading is taken from them.
log
The flight record every log reader produces: a clock, the channels the logger recorded on it, and what the file states about itself.
perfectflite
PerfectFlite’s .pf2 flight logs, as its software writes a Pnut’s flights. The StratoLogger and StratoLoggerCF are expected to write the same layout, as Debrief’s reader assumes; no file of theirs has been read.
readings
The readings taken from a flight log on its own: liftoff, apogee, the top speed, landing and the descent, with no design file and no simulation.