Skip to main content

Module readings

Module readings 

Source
Expand description

The readings taken from a flight log on its own: liftoff, apogee, the top speed, landing and the descent, with no design file and no simulation.

Each is a Reading: a value with where it came from, or Reading::Withheld with the reason the log can’t support it. A reading is never guessed at; one the log can’t support is left out and says why.

Method. Every reading of a height or a time comes from the altitude after a running median over MEDIAN_WINDOW_S (crate::filter::running_median), which takes out the pressure pulse an ejection charge punches into a barometric trace. Then:

  • the climb begins at the first sample LIFTOFF_HEIGHT_M above where the log starts;
  • the pad is the median of the altitude before it first rises PAD_RISE_M, which must be within LIFTOFF_HEIGHT_M of the logger’s zero, as a logger that zeroes itself on the pad records;
  • liftoff is the last sample before the climb within half the altitude’s resolution of the pad: the rocket had risen less than that then, and more within one sample after;
  • apogee is the filtered altitude’s highest value, at the middle of the run of samples that hold it (the altitude’s resolution leaves a peak flat for a few samples);
  • the top speed is the highest of the logger’s own vertical speed from liftoff to apogee, refused as Debrief refuses one (IMPLAUSIBLE_SPEED_M_S, ASCENT_NOISE_FRACTION, and a peak on the liftoff sample itself);
  • landing is the first sample after apogee below LANDING_HEIGHT_M above the pad that stays under LANDED_CEILING_M for LANDED_FOR_S, and no sooner, give or take a sample, than a fall from rest in vacuum would lose that height, √(2h/g): drag only slows a fall;
  • the top acceleration is withheld when the log has no accelerometer: differencing an altitude twice turns its resolution into spikes of many g.

The thresholds are Debrief’s (lib/analyze/index.ts, MIT, the project owner’s own), set on its corpus of flight logs rather than taken from a published source; the running median in place of Debrief’s Hampel filter is hpr’s, for the reason on MEDIAN_WINDOW_S.

Structs§

Apogee
The highest point.
Landing
Landing, and the descent before it.
Liftoff
Liftoff.
MaxAcceleration
The top acceleration in the climb. No reader fills it yet: the one format read so far has no accelerometer.
MaxSpeed
The top vertical speed in the climb.
Readings
What was read from a flight log.
Sample
One sample of the altitude.
Withheld
Why a reading was withheld.

Enums§

Reading
A reading, or why the log can’t support it.
Reason
The reason a reading was withheld.
Source
Where a reading’s value came from.

Constants§

ASCENT_NOISE_FRACTION
A top speed is refused when the climb’s most negative speed is more than this share of it: a trace swinging that far has no usable sign (Debrief’s 20%).
IMPLAUSIBLE_SPEED_M_S
A top speed above this is refused, m/s (Debrief’s ceiling).
LANDED_CEILING_M
The height above the pad the altitude must then stay under, m (Debrief’s 5 m)…
LANDED_FOR_S
…and for how long, s (Debrief’s 1 s).
LANDING_HEIGHT_M
How close to the pad the altitude must come to mark landing, m (Debrief’s 2 m).
LIFTOFF_HEIGHT_M
The climb above the pad that marks a flight, m (Debrief’s 3 m).
MAX_MEDIAN_HALF_WINDOW
The most samples either side of its center the running median takes: hpr’s choice, the MEDIAN_WINDOW_S window at over 6 kHz, faster than any logger hpr reads. A log sampled faster is withheld (Reason::SampledTooFast): the median’s cost grows with its window.
MEDIAN_WINDOW_S
The running median’s span, s: 0.3 s, Debrief’s despiking window. Debrief runs a Hampel filter over it (crate::filter::hampel, threshold 4); hpr takes the plain median (threshold 0). On the public Pnut log Debrief ships, the ejection charge’s pulse peaks at 1,028 ft, against the 1,009 ft apogee the logger states. The samples around the pulse, a dip before it and a lasting drop after it, widen its window’s spread until the Hampel filter keeps it, and an apogee read after it is the pulse. After the median it reads 1,010 ft. The median removes any pulse up to half its window wide, and reads a noise-free peak bent by gravity alone no more than peak_bound_m low, 0.077 m at 20 Hz. The Pnut numbers are checked only where the log has been fetched into refs/ (it isn’t committed); CI checks an invented log of the same shape.
PAD_RISE_M
The pad is the median of the samples before the altitude first rises this far above where the log starts, m: hpr’s choice, a third of LIFTOFF_HEIGHT_M, so that a log which begins just before liftoff lends the pad few samples that are already climbing.

Functions§

peak_bound_m
How far below its true peak the running median of half samples either side can read a trace sampled every interval s and bent by gravity alone near its peak, m: g ((⌈half/2⌉ + ½) Δt)² / 2. At the highest sample, half + 1 of the window’s samples lie within ⌈half/2⌉ places of it, so the median is no lower than they are, and the true peak lies within half a sample of the highest sample. At 20 Hz, 0.077 m.
read
Takes the readings from a flight log.