Skip to main content

Module smoother

Module smoother 

Source
Expand description

The smoother: a flight’s height and vertical speed at every sample, each with its standard error, from the barometer, the axial accelerometer and a GNSS receiver together, and a health card saying how each sensor fared (M7.2d).

What it is for. The readings take one number each from one track. The smoother takes the whole flight from every sensor the log holds, and says at each moment how far the truth may be: its 90% interval is the estimate ± INTERVAL_Z standard errors. On HPR Sim’s synthetic flights, whose truth is known, it is checked at burnout, the top speed, apogee and a drawn moment (cargo xtask synthetic). There the three sets’ cells hold between 94.2% and 99.4% of the truths inside the 90% intervals. Two logger cells hold 88.7% and 89.2%, which the check allows. Its rules were set with those sets in view.

How far to trust it. It has not been compared with a real flight’s truth. Its errors are the sensors’ errors as the synthetic flights draw them, from the makers’ datasheets and measured public logs (ADR-280 §3, the plan for the synthetic flights). A real logger whose errors are larger or of another kind, such as a port that reads the flow differently or a swing correlated over more than a second or two, can leave the truth outside the interval more often than it says; the health card shows where its sensors disagreed. It needs a barometer: a GNSS track alone is never trusted, as its receiver lags a climb by up to hundreds of meters while flagging its fix valid (docs/research/gnss-in-boost.md).

Method (docs/research/altimeter-smoothing-methods.md, “What this suggests” 1–2, 5; ADR-300, the smoother and its check). A Kalman filter runs forward over every sample, then a Rauch–Tung–Striebel pass back (kalman). Its state is the logger’s height above the pad, its vertical speed and acceleration, and the sensors’ own errors: the accelerometer’s bias, scale and a slowly changing model error (the rocket’s tilt puts its axis off the vertical); the barometer’s slow correlated noise, its drift and the drift’s rate, and the static port’s pressure coefficient in the fall; the day’s air off the standard atmosphere as a share of the height, which only a GNSS receiver measures; and the receiver’s offset. The acceleration is a white-jerk state that the accelerometer measures (a + g along the axis, gravity’s reaction in it), so a log with no accelerometer, or one clipped, uses the same model with nothing measuring it. On the pad the height, speed and acceleration are held at zero until liftoff, found from the accelerometer where there is one.

The climb’s port coefficient can’t be learned from the log, so it is held at its prior, and the log is smoothed again with it a standard deviation off, replaying the first run’s choices; each standard error is widened by the difference (smooth_with).

  • The barometer is de-weighted from TRANSONIC_FROM_MACH to TRANSONIC_FULL_MACH and above, where its port’s pressure coefficient jumps (docs/research/altimeter-mach-error.md §1–2), for CHARGE_WINDOW_S after each charge the log records, and around its own apogee (APOGEE_CHARGE_SPAN_M), where a charge fires whether or not the log names it.
  • The GNSS receiver is fused at zero weight from liftoff until its vertical speed has agreed with the smoother’s for GNSS_AGREE_WINDOW_S (gnss-in-boost.md §5), then with its variance inflated for GNSS_SETTLE_S; never on its fix flag.
  • Every sensor is gated: a sample whose squared innovation passes GATE_SIGMAS² of its variance is rejected and listed, and a sensor rejected for GATE_RESET_S is taken back with the height’s and speed’s uncertainty widened by the gap.

Structs§

Health
A log’s health card: how each sensor fared against the others (the smoothing note §7, after PX4’s and ArduPilot’s estimator status).
Largest
A sensor’s largest test ratio.
Liftoff
Liftoff, as the smoother holds it.
Options
How the smoother runs.
Rejected
A rejected sample.
SensorHealth
How one sensor fared.
Smoothed
A flight smoothed.
Span
A span over which the barometer was de-weighted.
State
One moment’s smoothed state.
Withheld
A log that isn’t smoothed, and why.

Enums§

Deweighted
Why the barometer was de-weighted.
GnssTrust
How the GNSS receiver is trusted.
LiftoffFrom
How liftoff was found.
Reason
Why a log isn’t smoothed.
Sensor
The sensors.

Constants§

APOGEE_CHARGE_SPAN_M
A charge is expected at apogee whether or not the log names it (a dual-deploy drogue, or a motor’s ejection timed for it), so the barometer is de-weighted from the first time its running median comes within this of its highest to the last, and CHARGE_WINDOW_S after, m: a coast passes within 5 m of its apogee for about a second either side, √(2·5/g), wider than the running median’s noise lets the top be placed. HPR Sim’s choice.
APOGEE_SPEED_M_S
A climb is under way, for finding its burnout and apogee, once its speed has passed this, m/s.
ASSUMED_ACCELERATION_SD_M_S2
The prior on the acceleration at a launch-started log’s first sample, 1σ, m/s²: 30 g, about zero, which holds a motor’s first spike on most hobby rockets. HPR Sim’s choice.
ASSUMED_HEIGHT_SD_M
The prior on the height at a launch-started log’s first sample, 1σ, m, about that sample: wide enough that the barometer alone places it, whatever the offset state below holds.
ASSUMED_SETTLE_S
How long a launch-started log’s barometer is settled for, s, at least ASSUMED_SETTLE_SAMPLES: a filter this wide takes any sample as the truth, and has narrowed by then. Over this span each sample fused is the median of the five about it, which leaves a climb as it was and takes out one or two bad samples, and the first two, which have no such window, aren’t weighed. On a log with a pad, the pad’s narrow priors reject those samples at the gate.
ASSUMED_SETTLE_SAMPLES
The fewest samples a launch-started log’s barometer is settled over.
ASSUMED_SPEED_SD_M_S
The prior on the speed at a launch-started log’s first sample, 1σ, m/s, about zero: not about the barometer’s rate there, whose running median has too few samples at a log’s edge to set one garbled sample aside. A rocket that has climbed the 49 m (160 ft) a StratoLogger’s launch detection allows at 30 g is doing about 170 m/s, under two of these. HPR Sim’s choice.
CHARGE_SD_M
The barometer’s standard deviation in that window, m: twice the Pnut pulse’s 16 m.
CHARGE_WINDOW_S
How long after a charge the log records the barometer is de-weighted, s: the public Pnut log’s pulse lasts 0.3 s.
CHARGE_WORDS
Words in an event’s name that mark a charge.
DEWEIGHT_TAU_S
The time over which a de-weighted span’s error is correlated, s: the second or so a climb takes from Mach 0.8 through 1.0, and longer than a charge’s pulse. HPR Sim’s choice.
DIVERGED_SPEED_M_S
The vertical speed past which a smoothed track is withheld as Reason::Diverged, m/s: Earth’s escape speed at its surface, √(2 GM/R) with GM = 398,600 km³/s² and the mean radius R = 6,371.0 km, the 11.186 km/s of NASA’s Earth Fact Sheet (D. R. Williams, NASA Space Science Data Coordinated Archive, Goddard Space Flight Center). Nothing that climbs on a hobby motor and comes back passes it, so an estimate that does is the filter’s, not the rocket’s.
FAST_NOISE_M
The barometer’s fast correlated noise, 1σ, m: an AR(1) process of φ = 0.5 at 50 Hz, measured on public logs (docs/research/altimeter-sensor-noise.md §6).
FAST_NOISE_TAU_S
Its time constant, s: −1/(50 ln 0.5).
GATE_RESET_S
A sensor rejected this long is taken back, s: HPR Sim’s choice, longer than a charge’s pulse (0.3 s on the public Pnut log the synthetic flights copy) and shorter than any transonic span.
GATE_SIGMAS
A sample is rejected when its innovation passes this many of its standard deviations: PX4’s default barometer gate, 5 (its EKF2 parameter EKF2_BARO_GATE; the smoothing note §7).
GNSS_AGREE_M_S
…within this, m/s (“within a few m/s”), and within twice their combined standard error.
GNSS_AGREE_WINDOW_S
The GNSS receiver’s speed must agree with the smoother’s this long before it is fused, s (gnss-in-boost.md §5: “for at least 2 s”).
GNSS_GAP_S
A gap between fixes this long ends the receiver’s trust, s: a dropout.
GNSS_OFFSET_SD_M
The prior on its offset, 1σ, m, set again each time it is trusted.
GNSS_OFFSET_WALK
The offset’s random walk, m²/s: a receiver’s lead or lag changes as the acceleration does.
GNSS_SD_DEFAULT_M
The receiver’s altitude noise when its pad can’t say, m; its pad’s scatter is floored at GNSS_SD_FLOOR_M.
GNSS_SD_FLOOR_M
The least its noise is taken as, m.
GNSS_SETTLE_FACTOR
…this many times.
GNSS_SETTLE_S
After trust, its variance is inflated this long, s…
INTERVAL_Z
The standard normal quantile at 95%: the estimate ± this many standard errors is a two-sided 90% interval.
JERK_COAST
…in the coast to apogee, m²/s⁵: the drag changes slowly.
JERK_DESCENT
…in the descent, m²/s⁵: a canopy’s opening changes the speed within a second or two.
JERK_PAD
The white jerk’s spectral density on the pad, m²/s⁵.
JERK_POWERED
…while the motor may be burning, m²/s⁵: lets the acceleration rise by 100 m/s² within 0.05 s at 3σ, as a motor’s thrust does.
LANDED_S
… for this many seconds: under the slowest main canopies, 2 m/s, a descent moves 6 m in it.
LANDED_SPAN_M
The barometer has landed once its running median stays within this many meters …
LANDING_LEAD_S
The impact is taken back this long before the landing’s first settled reading, s: the running median lags a stop by its half-width, and a ballistic stop takes a few hundredths of a second.
MAX_STEPS
The most steps the smoother takes, every sensor’s samples together: two sensors at 500 Hz for 33 minutes. The synthetic flights’ longest 500 Hz logs pass 500,000. The filter holds two covariances a step for the pass back, over 1 kB, so a step count without a limit is a memory limit a file could reach: a file just under this one takes tens of seconds and gigabytes, by a run in review, not a committed test.
PAD_MIN_SAMPLES
The fewest barometer samples on the pad that zero it and measure its noise. A log with fewer, as one written from launch detection is, is smoothed on an assumed pad (Health::assumed_pad).
PAD_SD
The pad’s hold on the height, speed and acceleration: their standard deviation there.
PORT_PRIOR_MEAN
The prior on the port’s pressure coefficient: its mean. The ogive-cylinder’s measured coefficient a caliber or more behind the nose’s shoulder is −0.02 to 0.00 below Mach 0.9 (altimeter-mach-error.md §1–2); HPR Sim’s prior is centered there…
PORT_PRIOR_SD
…with this standard deviation, half the range again either side. The climb’s coefficient is held there and enters each interval by the consider run (smooth_with); learned from the log, it came out biased by 0.010 claiming 0.001 on the synthetic flights’ barometer-only loggers (ADR-300, the smoother and its check).
POWERED_HOLD_S
How long the motor may still burn after the acceleration first falls below −g/2, s.
RATE_DROP_SHARE
The burn is taken as over once the barometer’s rate has fallen this share below its peak: a coast’s drag and gravity take a tenth of the speed within a few seconds, while the rate’s own noise is a few m/s. HPR Sim’s choice.
RATE_HALF_S
The barometer’s own climb rate is taken over this many seconds either side of a sample, for the Mach number its de-weighting ends at, the burnout’s and apogee’s rules, and the speed the port’s term is taken at, which keeps the barometer’s row linear in the states: its noise there is a few m/s.
REGRESSOR_HALF_S
The half-span of the running median a scale state’s regressor is taken from, s. A scale multiplies the quantity it scales; taken from the state, the product makes the filter extended, and its linearization finds information along directions the sensors can’t see (the scale and the acceleration it multiplies, with the barometer de-weighted); taken from the raw sample, the sample’s own noise is fitted by the scale (a pad’s noise, read as a height that scales). The median keeps the track’s shape and takes most of its noise out. HPR Sim’s choice.
REGRESSOR_MAX_HALF
The most samples either side a scale state’s running median is taken over: REGRESSOR_HALF_S at 5 kHz, past any logger’s rate the project has seen. A file’s clock could otherwise ask for a window of 50,000 samples, kept sorted, for each of its samples.
SCATTER_HALF_S
A barometer’s scatter is taken over this many seconds either side of a sample, and over at least SCATTER_MIN_SAMPLES samples either side: long against SWING_TAU_S, so a quadratic through the window can’t follow a swing and take its variance out, and long enough that a charge’s pulse or a spike is a minority of it. Where the track bends faster than a quadratic over six seconds, as a fall settles to its canopy’s speed or the main opens, the scatter reads the bend as noise too, and the barometer is weighed less there than it could be.
SCATTER_MAX_SAMPLES
The most samples a scatter’s window is read at, evenly spaced: enough for its median to scatter by a tenth, and a fast logger’s window no slower than a slow one’s.
SCATTER_MIN_SAMPLES
The fewest samples either side a barometer’s scatter is taken over.
SLOW_NOISE_M
The barometer’s slow correlated noise, 1σ, m: the top of the 0.24–0.29 m of a first-order Gauss–Markov term measured on a BMP085 at rest (altimeter-sensor-noise.md §3).
SLOW_NOISE_TAU_S
Its time constant, s: within the 0.65–1.26 s measured beside it.
SWING_TAU_S
The time over which the barometer’s scatter in flight beyond the pad’s is correlated, s: a rocket swinging under its canopy on L = 3–15 m of cord and lines is a pendulum of period 2π √(L/g), 3.5–7.8 s, and a first-order error of τ = √(L/g), 0.55–1.24 s, averages away no faster than its swing does. HPR Sim’s estimate, taken past that range because the scatter’s quadratic takes part of a correlated error’s variance out: with 2 s, descents swinging by 3–6 m correlated over up to a second stay inside their 90% intervals in the tests, and one correlated over 3 s doesn’t. The noise note gives no correlation time for the swing.
TILT_FLOOR_M_S2
The model error’s floor, m/s²: the drag a sideways speed puts along the axis near apogee, where the rocket may lie far over. HPR Sim’s choice.
TILT_TAU_S
The model error’s time constant, s. HPR Sim’s choice: a tilt changes over seconds.
TRANSONIC_CLEAR_S
An open transonic span closes once the barometer’s rate has said subsonic this long, s: a shock crossing the port swings the rate both ways for a few tenths of a second.
TRANSONIC_FROM_MACH
The Mach number, estimated high (mach_high), at which the barometer begins to be de-weighted: below it the port’s coefficient holds within 0.01 of its subsonic value on the tunnel’s ogive-cylinder a caliber or more behind the shoulder (altimeter-mach-error.md §1–2). HPR Sim’s margin below that note’s 0.9.
TRANSONIC_FULL_MACH
The Mach number from which the barometer is fully de-weighted.
TRANSONIC_PORT_SHIFT
How far the port’s coefficient may move from its subsonic value once fully de-weighted: the tunnel’s largest jump, −0.07 to −0.20 at the shoulder from Mach 0.7 to 1.0, rounded up.
UNKNOWN_PAD_MSL_M
The pad’s height above sea level taken where the log can’t say, m, for the coldest air and slowest sound the barometer’s de-weighting allows: higher than most launch sites.
WIND_LIMIT_M_S
The largest wind a high-power flight leaves the pad in, m/s: 20 mph, the most the NAR high-power safety code and NFPA 1127 allow.

Functions§

smooth
Smooths a flight log, the GNSS receiver trusted by agreement.
smooth_with
Smooths a flight log whose readings are already taken.
tilt_share
The accelerometer’s model error as a share of its reading: the axis θ off the vertical costs 1 − cos θ of the reading. Under power the axis is within a rail’s 20° (RAIL_TILT_DEG). In the coast it pitches over as the climb slows while the sideways speed through the air stays, tan θ = v_side/v: at most the burnout’s sin 20° share of the top speed plus a WIND_LIMIT_M_S wind, so the share grows toward one at apogee, where the reading is small.