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 <tobyrfenner@gmail.com>
This commit is contained in:
Tobias Fenner
2025-10-18 18:31:54 -07:00
committed by Mathieu Bresciani
parent d30fa62f40
commit 71f56df23b
+1 -1
View File
@@ -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;