mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(flights): an adsb.lol aircraft with no ground track faces its true heading, not north
This commit is contained in:
1 parent
0b1dc325bc
commit
693faae44e
4 files changed
+22
-2
No files matched your search
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- Aircraft from adsb.lol that report no ground track (parked or taxiing
|
||||||
|
slowly) now face their reported true heading instead of north, so parked
|
||||||
|
models line up with their gates (samehkhamis).
|
||||||
- A renderer can draw weather: the `weather` capability adds `globe.weather`,
|
- A renderer can draw weather: the `weather` capability adds `globe.weather`,
|
||||||
with clouds, fog, haze, rain and snow (each 0 to 1) and the wind they drift
|
with clouds, fog, haze, rain and snow (each 0 to 1) and the wind they drift
|
||||||
on. Where the renderer lists it, the view shows the conditions observed
|
on. Where the renderer lists it, the view shows the conditions observed
|
||||||
|
|||||||
@@ -64,7 +64,11 @@ export function normalizeAdsbLolAircraftState(aircraft, nowSeconds) {
|
|||||||
const geometricFeet = finiteNumber(aircraft?.alt_geom);
|
const geometricFeet = finiteNumber(aircraft?.alt_geom);
|
||||||
const groundSpeedKnots = finiteNumber(aircraft?.gs);
|
const groundSpeedKnots = finiteNumber(aircraft?.gs);
|
||||||
const verticalRateFpm = readAdsbVerticalRateFpm(aircraft);
|
const verticalRateFpm = readAdsbVerticalRateFpm(aircraft);
|
||||||
const track = finiteNumber(aircraft?.track);
|
// A parked or slow aircraft reports no ground track, but often its true
|
||||||
|
// heading (surface messages): the way its nose points, which is what an
|
||||||
|
// aircraft standing still is drawn by. Magnetic heading is not true north.
|
||||||
|
const track =
|
||||||
|
finiteNumber(aircraft?.track) ?? finiteNumber(aircraft?.true_heading);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
hex,
|
hex,
|
||||||
|
|||||||
@@ -49,3 +49,15 @@ test('keeps grounded fallback contacts and rejects rows without positions', () =
|
|||||||
assert.equal(normalized.states[0][7], null);
|
assert.equal(normalized.states[0][7], null);
|
||||||
assert.equal(normalized.states[0][8], true);
|
assert.equal(normalized.states[0][8], true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('an aircraft with no track takes its true heading, never its magnetic one', () => {
|
||||||
|
const at = (extra) =>
|
||||||
|
normalizeAdsbLolAircraftState(
|
||||||
|
{ hex: 'abc123', lat: 37.7, lon: -122.2, alt_baro: 'ground', ...extra },
|
||||||
|
1000,
|
||||||
|
)[10];
|
||||||
|
assert.equal(at({ track: 56.25, true_heading: 40 }), 56.25, 'track first');
|
||||||
|
assert.equal(at({ true_heading: 244.69 }), 244.69, 'true heading');
|
||||||
|
assert.equal(at({ mag_heading: 278.44 }), null, 'not magnetic');
|
||||||
|
assert.equal(at({}), null, 'none');
|
||||||
|
});
|
||||||
@@ -71,7 +71,8 @@ export function normalizeReadsbAircraft(row, snapshotTimeMs) {
|
|||||||
ellipsoidAltitudeM: geoFt == null ? null : geoFt * 0.3048,
|
ellipsoidAltitudeM: geoFt == null ? null : geoFt * 0.3048,
|
||||||
onGround: cleanText(row.alt_baro).toLowerCase() === 'ground',
|
onGround: cleanText(row.alt_baro).toLowerCase() === 'ground',
|
||||||
speedMps: speedKts == null ? null : speedKts * 0.514444,
|
speedMps: speedKts == null ? null : speedKts * 0.514444,
|
||||||
courseDeg: finite(row.track),
|
// No track (parked, slow): the true heading, where the nose points.
|
||||||
|
courseDeg: finite(row.track) ?? finite(row.true_heading),
|
||||||
verticalRateMps: rateFtMin == null ? null : rateFtMin * 0.00508,
|
verticalRateMps: rateFtMin == null ? null : rateFtMin * 0.00508,
|
||||||
category: row.category ?? null,
|
category: row.category ?? null,
|
||||||
typeCode: cleanText(row.t),
|
typeCode: cleanText(row.t),
|
||||||
|
|||||||
Reference in new issue
Block a user