Skip to main content

Module perfectflite

Module perfectflite 

Source
Expand description

PerfectFlite’s .pf2 flight logs, as its software writes a Pnut’s, a StratoLogger’s or a StratoLoggerCF’s flights, the CSV and text exports it writes of them (read_export), and the older .pfa of an Alt15K/WD’s flights (read_pfa). Every .pf2 and .pfa among the project’s sample logs reads, of all four models (cargo xtask logs).

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.

§The older .pfa

A .pfa is what PerfectFlite’s DataCap program (AltCapWD 1.10 on the Mac) saves of an Alt15K/WD’s flight. It is text, its lines ending in CR, or CR LF: the logger’s name, four Key: value lines, a blank line, a **!!Data: line, then one altitude a line, zero-padded to five digits, and nothing else. An invented flight’s first lines:

PerfectFlite Alt15K/WD
Ground: 1150
Apogee: 274
NumSamps: 24
Comments:

**!!Data:
00000
00002

import::read tells it from a .pf2 by the **!! line: both open with a line naming PerfectFlite.

Units and clock. The file states neither. The samples are feet above the logger’s reading on the pad, 0.1 s apart, so the record’s time is the sample’s place in the file over 10, from the first sample:

  • Alt15K/WD User’s Manual (PerfectFlite; archived 2013), p. 2: waiting on the pad, the logger samples “every 100 milliseconds”; once a sample is 80 ft above the ground reading, it saves “the previous 8 altitude samples” and adds one “every 100 milliseconds” for the rest of the flight. It beeps the apogee in feet (p. 6).
  • The A15K Data Sheet (archived 2011) and the revision 2 specifications page (archived 2023): “10 samples per second”; the latter lets the launch-detect height be set from 40 to 250 ft, and keeps 2,304 samples a flight.
  • DataCap’s own help: the samples are collected “at the rate of 10 samples per second”; the Apogee: line is “the highest altitude encountered during the flight”; NumSamps: is “the number of data points”.

The project’s 25 sample .pfas bear these out: in every one NumSamps: counts the samples and Apogee: is their highest, and each first reaches 40 or 80 ft at its eighth sample. Each record says where its units came from in a note, `Data` read in feet, 0.1 s apart, from the manual, which cargo xtask logs counts.

Time zero isn’t liftoff. DataCap’s help: “Sampling begins at a point 0.7 seconds before the launch is detected”, so the logger saw the launch at 0.7 s, liftoff came before that, and for a rocket slow off the pad before time zero too (the help: the data “may begin at an altitude greater than 0”). A note says so.

Ground: isn’t the pad’s elevation. DataCap’s help gives it as the site’s elevation “when the ambient barometric pressure is 29.92” Hg at sea level“: a pressure altitude, about 100 ft off the true elevation for every 0.1 inHg the day’s sea-level pressure differs, “reported for interest only”. It is kept in a note, never as Stated::ground_elevation_msl_m.

What else is checked. A NumSamps: that differs from the samples read is noted, as is an Apogee: that isn’t their highest. DataCap’s help says a NumSamps of 2,200 (revision 2) or 2,400 (the original) likely means the logger lost power in flight, its memory then holding older flights after this one’s: such a file reads, with a note. The comment, every line from Comments: to **!!Data:, is kept short in a note. A sample line that isn’t a whole number of up to six digits, an empty line among the samples (it would move every time after it), a **!! line other than **!!Data:, or a Ground:, Apogee: or NumSamps: stated twice is refused, naming the line. Nothing is sized from NumSamps:.

Constants§

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

Functions§

read
Reads a .pf2 flight log from its text.
read_export
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.
read_pfa
Reads a .pfa flight log, as PerfectFlite’s DataCap saves an Alt15K/WD’s flight, from its text: one altitude a line after a **!!Data: line, each 0.1 s after the one before, in feet above the pad. The layout and where its units come from are in the module’s documentation.