From 56d8cc042fee2b7eaef882ffa9f7429ef01d8352 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 11 Aug 2025 10:49:17 +1000 Subject: [PATCH] AP_GPS: add sanity check to AP_GPS_Blended in SITL we should not be producing a zero location from Blended while also having a status above zero --- libraries/AP_GPS/AP_GPS_Blended.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/AP_GPS/AP_GPS_Blended.cpp b/libraries/AP_GPS/AP_GPS_Blended.cpp index 4e00d276dba..3919ff37e5b 100644 --- a/libraries/AP_GPS/AP_GPS_Blended.cpp +++ b/libraries/AP_GPS/AP_GPS_Blended.cpp @@ -386,6 +386,13 @@ void AP_GPS_Blended::calc_state(void) gps.Write_GPS(GPS_BLENDED_INSTANCE); } #endif + +#if CONFIG_HAL_BOARD == HAL_BOARD_SITL + // sanity checks + if (state.status > AP_GPS::NO_FIX && !state.location.initialised()) { + AP_HAL::panic("status is >NO_FIX but location is zero"); + } +#endif // CONFIG_HAL_BOARD == HAL_BOARD_SITL } bool AP_GPS_Blended::get_lag(float &lag_sec) const