fix(flights): an aircraft with no ground track faces its true heading, not north

readsb rows (adsb.lol and a local dump1090 receiver) often send no track for
an aircraft on the ground, only its true heading. The track then read as
missing and the aircraft was drawn facing north, so one taxiing south looked
like it was moving backwards. Each normalizer now falls back to true_heading,
never the magnetic heading.
This commit is contained in:
Sameh Khamis committed 2026-11-14 08:49:29 -08:00
1 parent 3934be9ff9
commit fd06272e37
6 files changed
+65 -3

No files matched your search

+16
View File
@@ -168,6 +168,22 @@ test('readsb units and position/contact ages are normalized once against the sou
);
});
test('a readsb aircraft with no track takes its true heading, never its magnetic one', () => {
const course = (extra) =>
normalizeReadsbAircraft(
{ hex: 'a4418c', lat: 37.6, lon: -122.38, alt_baro: 'ground', ...extra },
now,
).courseDeg;
assert.equal(
course({ track: 56.25, true_heading: 40 }),
56.25,
'track first',
);
assert.equal(course({ true_heading: 185.62 }), 185.62, 'true heading');
assert.equal(course({ mag_heading: 278.44 }), null, 'not magnetic');
assert.equal(course({}), null, 'none');
});
test('readsb vertical rate falls back to the GNSS rate when no baro rate is sent', () => {
// readsb reports the rate under geom_rate when the aircraft's source is
// GNSS; 26 of 157 positioned rows in a live /v2/mil fetch had only that.