Expand description
One entry point for every format HPR Sim reads: give read a file’s bytes, and it
recognizes the layout from the content, never the file’s name, and reads it into the record
every reader fills (FlightLog).
The layouts it recognizes, the raw downloads by their bytes, the GPS logs by their own marks, the rest by the first line that isn’t blank:
| Format | Recognized by |
|---|---|
Raven .FIPa | its bytes: they open #Component=Raven, and a #den line within the first 4,096 is followed by a frame’s :; told before the file is decoded as text |
RRC3 .rff | its bytes: an MS-NRBF serialization header, version 1.0, and mDACS’s mDACS.AnalysisSupport+FlightRecord class name within the first 4,096; told before the file is decoded as text |
ARTS2 .odf | its bytes: the length 9, then Ozark.odf; told before the file is decoded as text |
RTx .rtx | its bytes: an MS-NRBF serialization header, version 1.0, then the class record of a List<Int32>; told before the file is decoded as text |
| KML | its root element is kml, after any XML declaration and comments |
| GPX | its root element is gpx, after any XML declaration and comments |
| NMEA 0183 | at least 3 of its first 50 lines that aren’t blank open with a sentence whose checksum checks out, such as $GPGGA,…*hh |
| Featherweight GPS CSV | the first line opens UTCTIME,UNIXTIME, or TRACKER,DATE,TIME, and names the latitude and longitude |
| Featherweight summary CSV | the first line names Rocket Name, and one of the first 200 names Max Altitude or Launch time UTC |
PerfectFlite .pf2 | names PerfectFlite, such as PerfectFlite Pnut, in a file with no **!!Data: line (a .pfa’s) |
PerfectFlite .pfa | names PerfectFlite, such as PerfectFlite Alt15K/WD, and has a **!!Data: line |
| PerfectFlite CSV and text | Time, Altitude and more of an export’s names, by commas or tabs; or, with no header row, four tab-separated numbers, the third a temperature ending in F or C, in either case |
| AltOS CSV | starts #version,, or opens with # comments before a #version, or version,serial, header; or, a table cut from an export, its first line names time, state and state_name and only AltOS’s own columns, and of its first 100 rows one gives a state as AltOS’s exports number and name it, and none contradicts them |
| Raven FIP CSV | opens with a time column and holds the Raven’s Axial Accel (Gs) channel |
| Blue Raven CSV | opens Year,Month,Day,Time,Flight_Time_(s),Sync,, or Flight_Time_(s),Sync, in a file with no date |
| RRC3 CSV | Time, Altitude, Pressure, Velocity, then any of Temperature, Events, Voltages |
| AltimeterCloud CSV | a header within the first 65 lines whose first name is Time(ms), in any case, and which also names acceleration_total(mG) and tilt |
| Entacore AIM CSV | the first line starts with a time column, names at least two, and names one of the AIM’s own channels, such as Pressure AGL |
AltOS .eeprom | a JSON object naming log_format and product; or, within the first 1,000 lines, a Config version: line and a manufacturer altusmetrum.org line |
| Blue Raven USB download | one of the first 1,000 lines opens @ LOG_HIR or @ LOG_LOW and closes with a CRC that checks |
| Teensy data logger, tab-separated | its first line that isn’t blank is a tag, a whole-number clock and values, by tabs, and one of its first 100 is Alt, the clock, P and a number, MSL and a number |
| Radio packets | its first line that isn’t blank is a 255:…:254 packet, a whole number or Gain[…], and a packet is one of its first 100 |
| Radio packets in RTF | an RTF document, one of whose first 100 lines, its markup taken off, is a 255,…,254 packet |
| Teensy data logger, named fields | its first line that isn’t blank states a tag’s units, ICM data in us, …, and one of its first 100 is a tag, t, a clock and name–value pairs, by commas |
| MARSA download | its first line that isn’t blank is a <NAME> value setting, such as <BARO_ZERO 0> 790, and one of its first 200 is <MARSA VERSION> and a value |
| Console capture | a start marker, such as ----++++//[[( data start )]]\\++++----, on a line of its own within the first 1,000; refused, naming its blocks, as its records need the caller’s layout (capture::read) |
| AltOS telemetry | the first line that isn’t blank is TELEM, a space, and an even number of hexadecimal digits |
| AltOS telemetry CSV | the first line that isn’t blank opens serial,tick,ptype, |
| R-DAS text | the first line that isn’t blank is *** Configuration ***, and a *** Raw data *** line comes within the first 200 |
| ARTS2 CSV | a first line of # and the names MET Acc Vel iAlt pAlt, by spaces, tabs or commas, in any case; tried before AltOS’s # comments |
| ARTS2 raw CSV | the first line that isn’t blank is MET,Acc(HI),Acc/Baro(LO),Baro(HI),State, the names as written |
| RTx CSV and text | the first line that isn’t blank is UTC Time,Latitude,Longitude,Altitude,Velocity,VDOP,NavStatus,Sats,SOG,COG, or its tab-separated text file’s UTC, Lat, an empty name, Lon, an empty name, Alt, Vel, VDOP, Nav, Sats, SOG, COG, the names as written |
| SillyGoose text | the first line, or the one after a CONFIG line, starts with timestampMs and names pressurePa and altitudeM |
| Silicdyne Fluctus CSV | a sep= line, or none, then a header starting time that names deltaTime and baro-altitude |
| Eggtimer text | an Eggtimer … Flight Settings title before an Eggtimer CSV header, within the first 200 lines that aren’t blank |
| Eggtimer CSV | T,Alt, and more of Eggtimer’s column names |
| A table read by its header | tried last: a header row within the first 64 lines, past blank lines, # comments and a sep= line, that names a clock with a unit of time, such as Time (s) or timestamp__ms, followed by a row with a number in the clock’s cell |
Text is read as UTF-8, or as UTF-16 after its byte-order mark (decode), with any byte-order
mark dropped; a byte that isn’t UTF-8 becomes U+FFFD, as a .pf2’s comments may be in another
encoding and no reader uses them.
use hpr_flightdata::{import, log::LogFormat};
let text = "Time,Altitude,Velocity\n0.00,0,0\n0.05,1,8\n0.10,3,30\n";
assert_eq!(import::detect(text.as_bytes()), Some(LogFormat::PerfectFliteCsv));
let log = import::read(text.as_bytes())?;
assert_eq!(log.channels.len(), 2); // the altitude and the velocity; the time is their clockConstants§
Functions§
- decode
- A file’s bytes as text: UTF-8, or UTF-16 if the file opens with UTF-16’s byte-order mark, as
some mDACS exports of an RRC3’s flight are; any byte-order mark dropped, and a byte, or a pair
of them, that isn’t a character replaced by U+FFFD. One such export, among the project’s sample
files, opens after its UTF-16 mark with a UTF-8 mark’s three bytes, each written as a UTF-16
character (
): they are dropped too, as the mark they are. - detect
- The format of a log, recognized from its first line that isn’t blank;
Nonefor a layout HPR Sim doesn’t read. - read
- Reads a flight log in any format HPR Sim reads.
- read_
one - Reads one record of a file that may hold several: the sheet
sheetof a spreadsheet’s workbook (.xlsxbyworkbook::read,.xlsbyxls::read), each sheet read as a file of its own, or the recordingrecordingof an Entacore AIM raw dump (entacore_raw::read_dump), each counted from 0. With no choice, a workbook’s one sheet, or of several the one that reads as a log, or the dump’s one recording. Any other file is read asreadreads it, and takes neither choice.