Skip to main content

Module entacore_raw

Module entacore_raw 

Source
Expand description

Entacore AIM XTRA’s own files: a flight as the AIM software saves it to an .xtra file, and the flight computer’s memory as the software downloads it, raw, before any conversion.

The AIM software saves a flight in its own .xtra file and exports it to CSV (entacore); the manual names both but describes neither layout (AIM XTRA/BASE v4.x.x Manual, Entacore, 2 February 2025, p38). The layouts here were worked out from one flight’s three files among the sample logs: a raw dump of the computer’s memory, the .xtra the software made of it, and an earlier copy of that .xtra, cut short. The raw dump’s last recording reads, by the rules below, to the .xtra’s values bit for bit, and the short copy’s bytes are the .xtra’s first ones. So every rule here is checked against the maker’s own conversion, on one flight.

What the records hold. One record a sample of one group of readings, each group at its own rate (the manual gives the barometer every 20 ms, the accelerometers and gyroscope every 10 ms, the magnetometer every 100 ms, the temperature every 500 ms, and the GPS’s position every 200 ms and its time every 500 ms, p2, each written at a multiple of its period the owner sets for each phase of the flight, p21). Each group is a kind of record, and each of its fields a channel, on the clock of that kind’s records. The names are the CSV export’s, where its column is the same sensor:

Kind: .xtra class, raw typeChannelsQuantity, unitRaw value
2, 0x02accelerationQuantity::Acceleration, g × 9.806 65 m/s², the CSV’si16 / 256
3, 0x0blat. X accel., lat. Y accel.the samei16 / 256 each
15, 0x0cGyro X, Gyro Y, Gyro ZQuantity::AngularRate, °/s (p24)i16 × 0.07 each
4, 0x03pressureQuantity::Pressure, Pau24
5, 0x04; 6, 0x05battery 1 voltage, battery 2 voltageQuantity::Voltage, V(u16 ÷ 16) × (3.3 × 133 / 33) / 4096, the factor in single precision
7, 0x06temperatureQuantity::Temperature, °C + 273.15 Ki16 × 0.01
17–20, 0x07–0x0aA Voltage … D VoltageQuantity::Voltage, Vu16 × 3.3 / 16,384
16, 0x0dMag X, Mag Y, Mag ZQuantity::Unrecognized, as writteni16 × 10⁻⁶ each
10, 0x0elat, long, GPS MSL, SVs, GPS flagdegrees, degrees, Quantity::GnssAltitude m, Quantity::Number, as writteni32 × f32(10⁻⁷), i32 × f32(10⁻⁷), i32 mm as an f32 × f32(0.001), a byte’s bits 0–4, its bit 5
14, 0x12GPS Time of Week, GPS week, GPS time flag 1, GPS time flag 2, GPS leap secondsas written (ms, as the CSV’s), Quantity::Number, as written, as written, Quantity::Numberu32, u16, a byte’s bit 7, its bit 6, its bits 0–5
13, 0x10state, A on … D on, A cont … D contQuantity::Numbera u16’s top 4 bits (0, 1, 3, 5 read as 0, 1, 2, 3), bits 8–11, bits 7 to 4
21, 0x15quaternion 1 … quaternion 4Quantity::Unrecognized, as writteni16 / 32,768 each

The raw values are big-endian, and are converted as the software converts them, in 32-bit floats, so that the two readers’ channels are equal value for value. The accelerations are recorded in g, as the CSV’s are, and read in m/s²; lat. X accel. reads 16 g at −4,096, the 16 g its sensor measures (p2). Which battery is the computer’s and which the ejection charges’ isn’t known: both read 6.6 V in the sample. The magnetometer’s unit isn’t settled, as for the CSV. The quaternion is kept as written. The on and cont names, and the letters, are inferred from the sample: the CSV names four outputs’ firing and continuity flags so, and in the sample C and D fire and lose continuity when the recovery charges do; A and B never change. What state’s numbers mean isn’t stated either: in the sample it turns 1 about a second into the boost, 2 later in the climb and 3 at apogee.

Events. Each change of state is an event named state N, and each rise of an on flag from 0 to 1 an event named by its channel, at the record’s time.

No primary track. Neither file holds an altitude above the pad, so FlightLog::time_s and FlightLog::altitude_m are empty, as for the Raven’s raw .FIPa, and every value is a channel.

The .xtra file is a Boost serialization binary archive: a signature, serialization::archive, the archive’s version (16), the sizes of an int, a long, a float and a double (4, 4, 4, 8), the top object’s header, and the record count as a u64. Each record is then its class as an i16 (followed, the first time the class appears, by a byte 1 and the class’s version as a u32), its object id (twice its index), on the first record only a byte 1 and a u32 1, its base object’s id (one more), the base’s fields (an f32 of 3.3, a byte 0, and the record’s time in seconds as an f32), then the kind’s fields, little-endian. A class whose version isn’t the sample’s is refused, as its fields may differ. A file that ends inside a record is read to its last whole one, with a note; bytes after the stated count, 114 in the sample, aren’t read.

The raw dump (read_dump) is the computer’s memory: recordings back to back, then erased memory, 0xFF, to its end. A recording opens with type 0x13 and 101 bytes this reader doesn’t read. A byte from 0x80 to 0xFE adds its low 7 bits to the clock, in the computer’s ticks; any other byte is a record’s type, its fields following. The clock is read as the ticks in milliseconds from the recording’s start, as the software reads them. Two things the dump and the .xtra differ in, both the software’s: it sums the .xtra’s times in 32-bit floats, a tick at a time, so they fall behind the ticks as the sum grows: in the sample, by 2.40 s by the end of the recording, and by 0.9 % of the climb’s time; and it leaves the dump’s last record out. Neither file’s clock is GPS time: over the sample’s flight the computer’s tick is 1.009 ms of the GPS’s own clock, 1.021 on the pad, so the dump’s times run 0.9 % short in flight and 2.1 % on the pad; the .xtra’s, behind the ticks as well, run about 1.8 % short over the climb (0.9910 ÷ 1.0087 = 0.982).

Held to the sample. Each byte whose meaning the sample doesn’t show is held to the one value it has in every sample record, and a file where it differs is refused, naming the byte: the .xtra‘s base fields, 3.3 and 0, the output lines’ two flag bytes, 0, and the status’s third set of four bytes, 0; the dump’s battery bits 0–3, the output lines’ bits 14–15, the GPS byte’s bits 6–7, the status’s bits 0–3 and a state number other than the four. recognizes_xtra and recognizes_dump don’t read these, so a file that differs there is refused by name, not left unrecognized. A type or class the sample doesn’t hold is refused too, as its length is unknown; among a dump’s first 1,000 records, or as an .xtra’s first record, it leaves the file unrecognized instead.

use hpr_flightdata::entacore_raw;

// An invented raw dump: a recording's header, 10 ticks, a pressure of 97,700 Pa (0x017DA4),
// 20 ticks, another, then erased memory.
let mut bytes = vec![0x13];
bytes.extend([0; 101]);
bytes.extend([0x8A, 0x03, 0x01, 0x7D, 0xA4, 0x94, 0x03, 0x01, 0x7D, 0x90]);
bytes.extend([0xFF; 16]);
let recordings = entacore_raw::read_dump(&bytes)?;
let pressure = &recordings[0].channels[0];
assert_eq!(pressure.column, "pressure");
assert_eq!(pressure.time_s, [0.01, 0.03]);
assert_eq!(pressure.values, [97_700.0, 97_680.0]);

Functions§

read_dump
Reads an AIM raw dump: each recording in it as a record of its own, in the dump’s order. A recording that holds no record, one opening straight after another, is a record with no channel, so that the records keep the dump’s count.
read_xtra
Reads an AIM .xtra file.
recognizes_dump
Whether bytes are an AIM raw dump: a recording’s opening, then records of the AIM’s types, up to 1,000, or erased memory. The bits held to the sample aren’t read here: read_dump refuses a dump that differs there, naming the byte.
recognizes_xtra
Whether bytes are an AIM .xtra file: a Boost binary archive’s signature, the sample’s top object header, and a first record whose class is an AIM kind’s. The rest isn’t read here: read_xtra refuses a file whose records differ from the sample’s, naming the byte.