Skip to main content

Module perfectflite

Module perfectflite 

Source
Expand description

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.

A .pf2 is text: the logger’s name on the first line, a preamble of Key: value lines, a Data: line naming the columns, then one row per sample, comma-separated, at about 20 Hz:

PerfectFlite Pnut
Firmware: 1.0
Apogee: 1280' AGL
Ground Elevation: 600' MSL
NumSamps: 3
Flight Number: 2
Data: (Time, Altitude, Velocity, Temperature (F), Voltage)
0.00, 0, 0, 70.00, 4.20
0.05, 0, 0
0.10, 1, 8, 70.00, 4.20

Times are seconds, altitudes feet above the logger’s reading on the pad, speeds feet per second, temperatures degrees Fahrenheit, voltages volts. A row may leave its last columns out (the temperature and voltage are logged less often); a column left out is a gap, NaN. The velocity is the logger’s own, worked out from its barometric altitude: a PerfectFlite has no accelerometer.

Where this comes from. PerfectFlite publishes no specification of the format. This reader follows the one in Debrief (lib/parsers/perfectflite.ts, MIT, the project owner’s own; see THIRD-PARTY-NOTICES.md), which was written from exported files and cites no document; the units above are its reading, borne out by the Pnut fixture Debrief ships, whose preamble states its apogee with a foot mark. Where this reader departs from Debrief’s: it takes the column order from the Data: line when there is one, where Debrief assumes it; and it refuses what Debrief passes over, naming the line: an empty or non-numeric cell, a time that doesn’t increase, and a line that isn’t a row once the rows have begun. A stated apogee or elevation in a unit other than feet is refused rather than guessed at. A byte-order mark is dropped, and lines may end in CR, LF or both.

Constants§

FOOT_M
Meters in a foot, exactly (the international foot).

Functions§

read
Reads a .pf2 flight log from its text.