Skip to main content

read_export

Function read_export 

Source
pub fn read_export(text: &str) -> Result<FlightLog, LogError>
Expand description

Reads one of the exports PerfectFlite’s software writes from a flight: comma-separated, with a header row such as Time,Altitude,Velocity,Temperature (F),Voltage, or tab-separated, with a header row such as Time, Altitude, Temp., Voltage and temperatures written with their unit, such as 58.7F.

The units are a .pf2’s: seconds, feet, feet per second, and the temperature’s stated unit. The header doesn’t state the altitude’s. cargo xtask logs bears out feet on the project’s sample exports: most peak at exactly the height of the .pf2 saved beside them, and the rest climb, read in feet, as long as those do against a fall in vacuum from the peak (its report, validation/reports/log-import.md, gives the counts and ratios). An export doesn’t name the logger’s model, so the logger reads PerfectFlite. A column the reader doesn’t know, such as Acceleration (calculated), is kept as written.

§Errors

LogError::NotThisFormat if the first line isn’t an export’s header row; LogError::Syntax for a cell that isn’t a number, a temperature in a unit other than its column’s, a row with more cells than the header, or a time that doesn’t increase; LogError::NoData if there are no rows.