ADSB selected the most dangerous vehicle by CPA calculation#11346
ADSB selected the most dangerous vehicle by CPA calculation#11346error414 wants to merge 5 commits intoiNavFlight:maintenance-10.xfrom
Conversation
b244be4 to
18885fc
Compare
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan Review Summary by QodoImplement CPA-based ADS-B threat detection and MSP2 configurator integration
WalkthroughsDescription• Implement CPA (Closest Point of Approach) calculation for ADS-B threat detection - Adds calculateCPA() and calculateMeetPoint() functions for trajectory prediction - Introduces findVehicleForAlert() and findVehicleForWarning() with CPA-based selection logic • Move ADSB processing from OSD thread to dedicated ADSB task thread - Relocate taskAdsb() from fc_tasks.c to adsb.c with 500ms period - Improves OSD thread performance by offloading calculations • Add two new MSP2 commands for configurator integration - MSP2_ADSB_LIMITS returns warning/alert distance thresholds - MSP2_ADSB_WARNING_VEHICLE_ICAO returns dangerous vehicle ICAO and alert status • Add CPA configuration option and simulator tools - New adsb_calculation_use_cpa setting to toggle between distance and CPA modes - Python simulator script for testing ADS-B traffic injection Diagramflowchart LR
A["ADSB Vehicle Data"] --> B["CPA Calculation"]
B --> C["Threat Detection"]
C --> D["Alert/Warning Selection"]
D --> E["OSD Display"]
D --> F["MSP2 Response"]
G["ADSB Task Thread"] --> B
H["Configuration Setting"] --> C
File Changes1. src/main/io/adsb.c
|
Code Review by Qodo
1. send_adsb() lacks JSON validation
|
7c2c8d1 to
2f717eb
Compare
|
Test firmware build ready — commit Download firmware for PR #11346 228 targets built. Find your board's
|
2f717eb to
0fb19f4
Compare
0fb19f4 to
5e434e6
Compare
…rpose * update settings.md * MSP2 return ADSB limits, and warning/alert vehicle ICAO * ADSB CPA calculation
5e434e6 to
6de9355
Compare
Review Summary by QodoImplement CPA-based ADS-B threat detection and move calculations to dedicated thread
WalkthroughsDescriptionThis description is generated by an AI tool. It may have inaccuracies • Implement CPA (Closest Point of Approach) calculation for ADS-B threat detection - Added calculateCPA() function to predict aircraft collision trajectories - New findVehicleForAlert() and findVehicleForWarning() functions select dangerous vehicles based on CPA or distance • Move ADSB calculations from OSD thread to dedicated ADSB task thread (500ms period) - Moved taskAdsb() function to adsb.c with recalculation logic - Improves OSD thread performance by offloading heavy computations • Add two new MSP2 commands for configurator integration - MSP2_ADSB_LIMITS returns warning/alert distance thresholds - MSP2_ADSB_WARNING_VEHICLE_ICAO returns ICAO and alert status of dangerous vehicle • Add ADSB simulator tool for development and testing - Python script to inject simulated ADS-B contacts via MAVLink protocol - Includes sample aircraft JSON configuration file Diagramflowchart LR
A["ADSB Task<br/>500ms"] -->|recalculate| B["Vehicle Data"]
B -->|CPA enabled| C["calculateCPA"]
C -->|predict trajectory| D["meetPointDistance<br/>meetPointTime"]
B -->|find threat| E["findVehicleForAlert"]
B -->|find threat| F["findVehicleForWarning"]
E -->|select| G["Most dangerous vehicle"]
F -->|select| G
G -->|MSP2 commands| H["Configurator"]
H -->|display| I["OSD Warning/Alert"]
File Changes1. src/main/fc/fc_msp.c
|
Code Review by Qodo
|
Base of this PR is add posibility to choose CPA calculation. If vehicle flies from warning zone to alert then vehicle is showed in OSD as alert (blinking).
Manual is changed https://github.com/error414/inav/blob/error414/feature/adsb-intercept-calc/docs/ADSB.md and Martinov created nice video with explanation https://discord.com/channels/791437907478577172/881440734761345086/1473447570234806486
Next changes:
ADSB calculation was removed from OSD thread and moved to ADSB thread (500ms). OSD thread takes soo much time so better to move ADSB calculation to his own thread. ADSB thread takes a few uS.
added two new MSP2 commands, ADSB_LIMITS and ADSB_WARNING_ICAO. "Limits" returs ADSB limits from OSD settings, and "adsb_warning_icao" returns icao of plane which is selected as dangerous. MSP commands are new functionality in configurator
in configurator, selected vehicle as dangerous is marked red or orange depend of if iot's warning or alert
map is spread to whole VISIBLE area
visually represented ADSB limits on map, see screenshot
Configurator: iNavFlight/inav-configurator#2569
BTW: MSP is breaking change so maybe better to merge it to INAV 10.