Skip to main content

Module raven_fipa

Module raven_fipa 

Source
Expand description

The Featherweight Raven’s raw downloads, .FIPa: the altimeter’s flash memory as the Featherweight Interface Program (FIP) saves it, before any export.

The file opens with text lines, each starting #, up to a #den line; then the memory, in frames of a :, 256 data bytes and a checksum byte, the sum of the 256 modulo 256; then #DONE and a line end:

#Component=Raven
#DateTime=1/2/2020 3:04:05 PM         (invented values throughout)
#FlightNum=7
#FlightState=#7  O  5  1000  …        (tab-separated: the settings block's words)
#BinaryFormat 1.0
#R 3.0                                (the firmware's version)
#Num 25
#den 20                               (a tick is Num/den ms: 1.25 ms)
:<256 bytes><checksum>:<256 bytes><checksum>…#DONE

Blocks. Each frame holds four blocks of 32 big-endian 16-bit words. Unused memory reads 0xFFFF; the flight ends at the first block of nothing else, and every block after it must be unused too. Block 5 is the settings block, the words #FlightState lists after its first two fields. Each other block covers 40 ticks, 0.05 s: blocks 0 to 4 are the 0.25 s before the Raven detected the launch, and the blocks after the settings block the flight, one tick later in each block’s pattern. A block is ten triplets (A, B, S), then two words, at ticks 4k to 4k + 3 within it (4k + 1 to 4k + 4 after the settings block):

BitsSampleTick
A >> 5, 11 bitsthe axial accelerometer4k
(A & 0x1f) << 5 | B >> 11, 10 bitsthe lateral accelerometer4k + 1
B & 0x7ff, 11 bitsthe axial accelerometer4k + 2
Sthe kth slow channel4k + 3

so the axial accelerometer runs at 400 Hz, the lateral at 200 Hz and the slow channels at 20 Hz, as the blocks lay them out and as the FIP’s export times them; Featherweight’s manual says the Raven records the data its deployment logic uses at 20 Hz (Raven User’s Manual, updated for the Raven4, 2020-08-15). Time zero is the first sample before the launch, as in the FIP’s export.

Values. Each into the FIP’s export’s column, by the export’s own arithmetic, then SI as crate::raven reads that column:

ColumnFrom the wordRaven’s unit
Axial Accel (Gs)(trunc(X1 (a − Z1) / 1000) + F3) / 100g
Lateral Accel (Gs)trunc(X2 (l − Z2) / 1000) / 100g
Current Draw (A)slow 0, signed, / 1000A
Volts Pyro Apogee (V), … Main, … 3rd, … 4thslow 1 to 4, signed, / 1000V
Volts Battery (V)slow 6, signed, / 1000V
Temperature (F)slow 7, signed (no sample file holds a negative one to show it), / 100°F
Baro (Atm)slow 8, unsigned, / 25,000atm
Velocity (Accel-Ft/Sec)slow 9, signed, / 10ft/s

trunc rounds toward zero, and X1 / 1000 is worked in double precision, as the FIP does: exact integers differ from its export by a hundredth of a g where the product is a whole number that double precision leaves just under it, as on 11 of the sample files (ADR-259). X1, Z1, F3, X2 and Z2 are the settings block’s: word 0 the axial offset F3 (read signed, though no sample file’s is negative), words 23–24 the signed 32-bit axial gain X1, word 25 the axial zero Z1, words 26–27 the lateral gain X2, word 28 the lateral zero Z2. A header whose #Axis is 1 (a single-axis accelerometer; 2 otherwise) keeps the lateral bits as written, as lateral counts, since the Raven calibrates no lateral axis. Slow channel 5, which the FIP doesn’t export, and the two words after each block’s triplets are kept as written, numbered by their place, as Quantity::Unrecognized. The export stops Velocity (Accel-Ft/Sec) at its first sample at or below zero after it has gone positive, its apogee; the record keeps every sample the Raven wrote.

The record. The primary track is empty, with a note: the Raven records a pressure, not an altitude; the export’s [Altitude (Baro-Ft-AGL)] and [Altitude (Baro-Ft-ASL)] are the FIP’s conversions, and working an altitude out of the pressure is a reading, not this reader’s to make (milestone M7.2, the readings, takes it). The settings block’s word 1, the ground’s elevation in feet, which the FIP’s export takes from the altitude above sea level to give it above the pad, is stated as the launch site’s elevation; #FlightNum is the flight’s number and #R the firmware.

Checked against the FIP. The layout and the arithmetic were worked out from raw files and the FIP’s exports of the same flights; wherever the project’s sample logs hold both, cargo xtask logs compares every sample of every channel the export holds with the raw file’s: 55 of the 57 sample files have an export beside them, and all 55 match it.

Refused, naming the byte: a header without its #Num and #den ticks, or a #BinaryFormat other than 1.0; a frame whose checksum fails; anything after the frames but #DONE and a line end; a settings block other than #FlightState’s words, or a #FlightState listing none; an #Axis other than 1 or 2; fewer than the five blocks before the launch and the settings block; and a used block after an unused one.

Functions§

read
Reads a Raven .FIPa file.