mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
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:
1 parent
c57eb74506
commit
5f98f8bdf3
40 files changed
+2606
-1238
No files matched your search
@@ -7,6 +7,30 @@ import {
|
||||
} from '../../data/motionModel.js';
|
||||
import { POSITION_HISTORY_LIMIT } from './recordPolicy.js';
|
||||
import { followsClock } from './policy.js';
|
||||
import { newestReport, pushReport } from '../../data/aircraftMotionRegime.js';
|
||||
|
||||
/**
|
||||
* Note how late each report in a live snapshot is, and aim the display delay
|
||||
* again, before any contact is planned with it: a layer drawing nothing yet
|
||||
* takes the new delay at once.
|
||||
*/
|
||||
function noteDelivery(flightState, snapshot) {
|
||||
const delay = flightState._displayDelay;
|
||||
if (!delay) return;
|
||||
const receiptMs = Date.now();
|
||||
for (const observation of snapshot.records) {
|
||||
const reportMs = observation.positionTimeMs;
|
||||
if (!(Number.isFinite(reportMs) && reportMs > 0)) continue;
|
||||
const history = flightState._positionHistory.get(observation.id);
|
||||
const previous = history && newestReport(history);
|
||||
delay.noteReport(
|
||||
receiptMs,
|
||||
reportMs,
|
||||
previous ? Math.trunc(previous.epochMs) : undefined,
|
||||
);
|
||||
}
|
||||
delay.settle(receiptMs, { jump: !flightState._icons.count });
|
||||
}
|
||||
|
||||
/** Apply military record changes to the layer's drawing and existing follow operations. */
|
||||
export function createMilitarySnapshotRenderer({
|
||||
@@ -32,6 +56,9 @@ export function createMilitarySnapshotRenderer({
|
||||
const currentIcaos = new Set();
|
||||
const receiptNowMs = snapshot.observedAtMs;
|
||||
records.beginSnapshot(snapshot.observedAtMs);
|
||||
// Live, the display delay follows how late this delivery's reports are.
|
||||
if (!replace && !followsClock(flightState))
|
||||
noteDelivery(flightState, snapshot);
|
||||
// Field-test fix (RS46): coarse floor cells to warm for the below-ground
|
||||
// clamp — collected during the loop (low airborne contacts only),
|
||||
// batch-resolved once after it. Never a fetch inside the loop.
|
||||
@@ -69,34 +96,37 @@ export function createMilitarySnapshotRenderer({
|
||||
}
|
||||
const history = flightState._positionHistory.get(icao24);
|
||||
const newest = history[history.length - 1];
|
||||
// Whole milliseconds, as the fix times are kept.
|
||||
const report = newestReport(history);
|
||||
// Whole milliseconds, as the fix times are kept. A report newer than
|
||||
// the last report goes in, past any synthetic fix after it.
|
||||
if (
|
||||
!newest ||
|
||||
Math.trunc(fixEpochMs) > Math.trunc(motion._fixEpochMs(newest))
|
||||
!report ||
|
||||
Math.trunc(fixEpochMs) > Math.trunc(motion._fixEpochMs(report))
|
||||
) {
|
||||
// Per-fix kinematics: the fix's own velocity/track ride along so the
|
||||
// extrapolation paths use the values that BELONG to the fix they
|
||||
// extend, not whatever the latest poll reported.
|
||||
history.push({
|
||||
...motion._historyFix(
|
||||
fixEpochMs,
|
||||
position,
|
||||
meta.speedMps,
|
||||
meta.track,
|
||||
),
|
||||
// Drawn at an invented height: a trail seeded from history keeps no
|
||||
// position for it.
|
||||
inventedHeight: meta.renderAltitudeInvented === true,
|
||||
// Whether this report was on the ground: a trail backfill joins it
|
||||
// only across a landing or take-off it saw.
|
||||
onGround: meta.onGround === true,
|
||||
});
|
||||
if (history.length > POSITION_HISTORY_LIMIT) {
|
||||
history.shift();
|
||||
}
|
||||
pushReport(
|
||||
history,
|
||||
{
|
||||
...motion._historyFix(
|
||||
fixEpochMs,
|
||||
position,
|
||||
meta.speedMps,
|
||||
meta.track,
|
||||
),
|
||||
// Drawn at an invented height: a trail seeded from history keeps no
|
||||
// position for it.
|
||||
inventedHeight: meta.renderAltitudeInvented === true,
|
||||
// Whether this report was on the ground: a trail backfill joins it
|
||||
// only across a landing or take-off it saw.
|
||||
onGround: meta.onGround === true,
|
||||
},
|
||||
POSITION_HISTORY_LIMIT,
|
||||
);
|
||||
// Turn rate from the fix-track history — computed once per new fix
|
||||
// (≤5 samples), consumed by the extrapolation paths at tick rate.
|
||||
meta.turnRateDps = turnRateFromFixHistory(history);
|
||||
meta.turnRateDps = turnRateFromFixHistory(history.slice(-5));
|
||||
// Trail accumulation is separate from the 5-fix DR history (PRD F2)
|
||||
// so the visible trail keeps growing while tracked. Round 2
|
||||
// (owner): ground traffic appends too — taxi history stays live
|
||||
@@ -105,6 +135,7 @@ export function createMilitarySnapshotRenderer({
|
||||
if (isTracked)
|
||||
tracking._appendTrailFix(motion._copyPosition(position), fixEpochMs, {
|
||||
nullAltitude: meta.renderAltitudeInvented === true,
|
||||
track: meta.track,
|
||||
});
|
||||
} else {
|
||||
const modelOwnsGroundVisual = rendering._modelOwnsVisual(icao24);
|
||||
@@ -134,7 +165,7 @@ export function createMilitarySnapshotRenderer({
|
||||
if (synthetic) {
|
||||
history.push(synthetic);
|
||||
if (history.length > POSITION_HISTORY_LIMIT) history.shift();
|
||||
meta.turnRateDps = turnRateFromFixHistory(history);
|
||||
meta.turnRateDps = turnRateFromFixHistory(history.slice(-5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user