From 71f56df23b737a389c5c6f5753b5f890c42bfd91 Mon Sep 17 00:00:00 2001 From: Tobias Fenner Date: Sat, 18 Oct 2025 18:31:54 -0700 Subject: [PATCH] adsb: Fix vertical separation check using wrong parameter The collision detection incorrectly used crosstrack_separation (horizontal radius) for both horizontal and vertical checks. This resulted in the vertical separation threshold being ignored, creating a spherical detection zone instead of the intended cylindrical "hockey puck" shape. Fixed by using vertical_separation parameter for altitude difference check on line 80. The bug was likely introduced as a copy-paste error when creating the vertical check from the horizontal check template. The existing unit test uses identical values for both parameters (500.0f), which masked this bug. Testing: Code review. The existing unit tests pass, but they don't catch this bug due to using equal values. Future test improvement would be to use different crosstrack_separation and vertical_separation values. Signed-off-by: Tobias Fenner --- src/lib/adsb/AdsbConflict.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/adsb/AdsbConflict.cpp b/src/lib/adsb/AdsbConflict.cpp index 08d13e12a4..976b322796 100644 --- a/src/lib/adsb/AdsbConflict.cpp +++ b/src/lib/adsb/AdsbConflict.cpp @@ -77,7 +77,7 @@ void AdsbConflict::detect_traffic_conflict(double lat_now, double lon_now, float && (fabsf(_crosstrack_error.distance) < _conflict_detection_params.crosstrack_separation); const bool _crosstrack_separation_check = (fabsf(alt_now - _transponder_report.altitude) < - _conflict_detection_params.crosstrack_separation); + _conflict_detection_params.vertical_separation); bool collision_time_check = false;