mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Tracked aircraft keep moving when reports give no speed or a stale one
A fix that moves while the reported speed is 0 or stale used to leave the aircraft frozen, then jump it kilometres at once. The step between fixes now measures a jump, and the drawn speed bounds the recovery.
This commit is contained in:
1 parent
22952f8f16
commit
e3cfdcf44e
7 files changed
+131
-12
No files matched your search
@@ -38,7 +38,11 @@ function sharpestTurnDeg(line) {
|
||||
return worst;
|
||||
}
|
||||
|
||||
function run(layer, pollOptions = {}, { drop = [] } = {}) {
|
||||
function run(
|
||||
layer,
|
||||
pollOptions = {},
|
||||
{ drop = [], reportedSpeedMps, frameMs } = {},
|
||||
) {
|
||||
const polls = slowFeedPolls({
|
||||
startMs: T0,
|
||||
count: 30,
|
||||
@@ -53,6 +57,8 @@ function run(layer, pollOptions = {}, { drop = [] } = {}) {
|
||||
// From the seventh poll: the delay has settled and the trail has begun.
|
||||
measureFromMs: polls[6].receiptMs,
|
||||
contacts: CONTACTS,
|
||||
reportedSpeedMps,
|
||||
...(frameMs ? { frameMs } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -99,6 +105,15 @@ export function feedLatencyTests(layer, floorSec) {
|
||||
assertTrail(sim, 60);
|
||||
});
|
||||
|
||||
test(`${layer}: reports that give a speed of 0 still draw the tracked aircraft along its path, with no jump or stall`, () => {
|
||||
// The drawn motion is minutes behind the newest report, whose speed may
|
||||
// be stale or 0: a jump is judged by the path, not by that speed.
|
||||
// At 10 fps a frame moves 13 m, more than a speed of 0 allows.
|
||||
const sim = run(layer, {}, { reportedSpeedMps: 0, frameMs: 100 });
|
||||
assertSmoothMotion(sim);
|
||||
assert.ok(placementError(sim, sim.frames, 'tracked', 0) < 100);
|
||||
});
|
||||
|
||||
test(`${layer}: a fresh fallback feed for four polls and reports that do not move on: no jump, no stall, no kink`, () => {
|
||||
const sim = run(layer, {
|
||||
fallback: [12, 13, 14, 15],
|
||||
|
||||
Reference in new issue
Block a user