moshe-braner / SoftRF

:airplane: Multifunctional, compatible DIY general aviation proximity awareness system
GNU General Public License v3.0
18 stars 4 forks source link

collision warning algorithms #3

Closed moshe-braner closed 5 months ago

moshe-braner commented 2 years ago

Try and improve the algorithms:

moshe-braner commented 2 years ago

Added code (mostly in TrafficHelper.cpp but also tweaked TrafficHelper.h, Legacy.h, NMEA.cpp, SoftRF.h) to give a new audio alert if a target got two levels closer than previous alert, or got two levels farther and then back to same level again. This required adding a "CLOSE" level between NONE and LOW. Tweaked NMEA.cpp to restore level codes sent out as data to other devices to the previous codes, since apparently the alarm level codes are an external standard.

moshe-braner commented 2 years ago

Additional modifications made to traffic alarms:

moshe-braner commented 2 years ago

Because there is some error in the GPS altitude, and also some devices will use GPS altitude while others use barometric altitude, I have adjusted the code to subtract 60 meters from the absolute altitude difference (if it's more than 60). That is so that a possible real collision danger will not get ignored. The remainder is multiplied by "SLOPE" (5) and added to the distance to determine alarm level and target priority.

moshe-braner commented 2 years ago

Added code in NMEA.cpp to take altitude differences into account also in the choosing of the "high priority" target for NMEA export.

moshe-braner commented 2 years ago

Version 04: in TrafficHelper.cpp added adjustment to altitude difference based on relative vertical speed. For example, if one glider is climbing in a thermal, and another is flying towards the thermal in sink, and is higher - by the time they may collide the altitude difference between the gliders will get smaller, so be more inclined to sound an alarm.

Also re-organized ParseData() to clarify what it is doing and also make it a bit more efficient.

moshe-braner commented 2 years ago

Version 07: finally implemented collision prediction based on extrapolating circular paths. This uses the data sent by FLARMs, or converts the data sent by other protocols. Choose "Legacy" alarm method. Also transmits data compatible with FLARMs if "Legacy" protocol chosen. This is new draft code and needs flight testing.