Aircraft drawn as far behind real time as their feed is late, along one curve their trail follows

Civil and military aircraft were drawn a fixed 30 s (15 s) behind real time
while anonymous feed reports arrive about 90 s old every 30 s, so every
contact dead reckoned about a minute past its newest report and snapped
when the next one landed (several km on a turn), and the tracked trail,
recorded from those drawn positions and patched as reports arrived, kinked.

- The display delay (data/displayDelay.js) is the 90th percentile of the
  newest 256 report lags plus 5 s, between the layer's floor (30 s, 15 s)
  and five minutes, slewed at most 0.2 s/s up and 0.05 s/s down. Icons,
  the renderer's live motion clock, labels, HUD, detection, the tracked
  camera and the trail read the one delay; following the world clock
  draws with none and deliveries leave it alone.
- Between two reports an aircraft flies a biarc (data/fixCurve.js) that
  passes through both and leaves each along its track, sent as contract
  arc segments; the trail is the reports joined along the same curve, so
  the icon sits on it. Nothing drawn between reports is kept.
- A report a coasting contact missed is eased onto from where it would
  have been that frame (at least 3 s, at most 30% over its speed, within
  20 s); over 5 km it jumps. Past its newest report a contact coasts
  straight on: a turn rate averaged over earlier reports outlived the turn.
- Forward synthetic fixes no longer block real reports older than them,
  and a history keeps 24 fixes.
- A feed simulation (testSupport/aircraftFeedSim.mjs) checks both layers
  against a 90 s late feed, a fallback switch, repeated reports, outages
  and the world clock.
This commit is contained in:
Sameh Khamis committed 2026-11-14 00:31:29 -08:00
1 parent c57eb74506
commit 5f98f8bdf3
40 files changed
+2606 -1238

No files matched your search

+18 -12
View File
@@ -1,6 +1,8 @@
import { MilitaryFlightRecords } from './records.js';
import { createMilitaryFeed } from './ingestion.js';
import { worldTimeFor } from '../../time/worldClock.js';
import { createDisplayDelay } from '../../data/displayDelay.js';
import { POLL_INTERVAL_MS, RENDER_DELAY_SEC } from './policy.js';
export function createFlightState({ source, services }) {
const { createGroundSnap } = services.groundSnap;
@@ -13,6 +15,12 @@ export function createFlightState({ source, services }) {
});
/** The time contacts are drawn behind by the render delay, in epoch ms. */
flightState.now = worldTimeFor('military');
/** How far behind real time live contacts are drawn: follows how late the
* feed's reports arrive (see displayDelayMs in policy.js). */
flightState._displayDelay = createDisplayDelay({
floorMs: RENDER_DELAY_SEC * 1000,
pollMs: POLL_INTERVAL_MS,
});
/** Follows the world clock while the source declares a timeline (set by the
* layer); see followsClock and displayDelayMs in policy.js. */
flightState.timeline = null;
@@ -132,10 +140,9 @@ export function createFlightState({ source, services }) {
flightState._trailHeadOff = null;
/** @type {{position: {x: number, y: number, z: number}|null, timeMs: number, nullAltitude: boolean, breakBefore: boolean, drawn?: boolean}[]}
* Chronological tracked-aircraft trail (oldest first): reports, and
* (`drawn`) where the icon was drawn between them; `breakBefore` starts a
* new segment. */
/** @type {{position: {x: number, y: number, z: number}|null, timeMs: number, nullAltitude: boolean, breakBefore: boolean, track?: number}[]}
* Chronological tracked-aircraft trail (oldest first): reports, joined along
* the curve the icon is drawn along; `breakBefore` starts a new segment. */
flightState._trailFixes = [];
@@ -143,14 +150,6 @@ export function createFlightState({ source, services }) {
flightState._trailBodyCount = 0;
/** @type {{x: number, y: number, z: number}|null} Where the tracked icon was last recorded into the trail. */
flightState._trailRecordPosition = null;
/** @type {number} Display time (epoch ms) of that recording. */
flightState._trailRecordMs = -Infinity;
/** @type {string|undefined} The stale cue last written into the tracked label (see `_staleCueTick`). */
flightState._trackedStaleCueText = undefined;
@@ -263,10 +262,17 @@ export function createFlightState({ source, services }) {
flightState._drCorrectionStartMs = 0;
/** How long (ms) the correction under way takes to ease out. */
flightState._drCorrectionMs = 0;
flightState._drPrevRaw = { x: 0, y: 0, z: 0 };
flightState._drPrevDisplay = { x: 0, y: 0, z: 0 };
/** How the tracked icon moved over the last frame, and that frame's length (s; 0 for none). */
flightState._drPrevStep = { x: 0, y: 0, z: 0 };
flightState._drPrevStepSec = 0;
flightState._drPrevMs = 0;
/** World time of that frame: the wall clock live, the cursor following the clock. */