TwinFan / LiveTraffic

LiveTraffic is an X-Plane multiplayer plugin, which fills your sky with live air traffic based on public flight tracking data.
https://twinfan.gitbook.io/livetraffic/
Other
100 stars 25 forks source link

Static Objects appear with ADSBEx data channel #261

Closed TwinFan closed 5 months ago

TwinFan commented 8 months ago

Describe the bug

Static objects appear despite Hide Static objects activated when using the ADSBEx channel via RAPID API.

To Reproduce

Use ADSBEx channel via a RAPID API key plus OpenSky Masterdata. Go to EGCC, see list of aircraft

Screenshots

ADSBEx_v1_TWR

Expected behavior

With Hide Static objects enabled, such static object are not supposed to be drawn as planes.

Technical Info

References

Reported by a user on X-Plane.org.

TwinFan commented 8 months ago

ADSBEx does not send a "TWR" identification in the v1 data stream that is still used by the RAPID API interface. The "TWR" designation is actually looked up from OpenSky Masterdata.

But the object should ideally be removed already from the ADSBEx data stream before even an OpenSky Masterdata lookup is attempted. Current static object identificaton is:

        if (!strcmp(jog_s(pJAc, ADSBEX_V1_GND), "1") && // on the ground
            !*jog_s(pJAc, ADSBEX_V1_AC_TYPE_ICAO) &&    // no type
            !*jog_s(pJAc, ADSBEX_V1_HEADING) &&         // no `trak` heading, not even "0"
            !*jog_s(pJAc, ADSBEX_V1_CALL) &&            // no call sign
            !*jog_s(pJAc, ADSBEX_V1_REG) &&             // no tail number
            !strcmp(jog_s(pJAc, ADSBEX_V1_SPD), "0"))   // speed exactly "0"

The planes seen in above screenshot fail to satisfy these conditions for different reasons:

But along the way we learned that OpenSky can return "TWR" as plane type for static objects. That might be useful, too, however more difficult to implement because the OpenSky Masterdata lookup can happen several seconds or even minutes after the first tracking data had been processed from ADSBEx or any other channel. So if then the OpenSky Masterdata lookup returns a "TWR" value the plane would need to be removed (easy) but we would also need to keep a list of ADS-B stations to be ignored in the long run so that the object does not reappear due to tracking data from any channel including it.

TwinFan commented 8 months ago

Changed the logic how Hide static objects works: Instead of trying to filter them at the source, at the channel data before they hit the main logic, the objects are now processed as usual and are always available in the aircraft list. Will need to see if that raises complains by the users if too many such object clutter the list.

Hide static object is then just one more hiding option and processed in LTAircraft::CalcVisible(), so TWRs can now be set visible/invisible with the existing visibility buttons at will and even individually. Not that that enhanced functionality would be needed for TWRs but it's available anyway and now also applied to Hide static objects.