From 6f9e072e4b7d9fdb4a9d6f08c0abbeb90506d796 Mon Sep 17 00:00:00 2001 From: gguidone Date: Thu, 28 May 2026 15:52:07 +0200 Subject: [PATCH] refactor(sensor_gps_sim): drop SYS_FAILURE_EN gate from failure injector The failure injector is SITL-only; the system-wide enable gate isn't needed here. Gating will be revisited when extending injection to the real GPS driver in a follow-up. --- .../sensor_gps_sim/SensorGpsSim.cpp | 19 ------------------- .../sensor_gps_sim/SensorGpsSim.hpp | 3 --- 2 files changed, 22 deletions(-) diff --git a/src/modules/simulation/sensor_gps_sim/SensorGpsSim.cpp b/src/modules/simulation/sensor_gps_sim/SensorGpsSim.cpp index 7a1f9b691f..0663397a35 100644 --- a/src/modules/simulation/sensor_gps_sim/SensorGpsSim.cpp +++ b/src/modules/simulation/sensor_gps_sim/SensorGpsSim.cpp @@ -45,7 +45,6 @@ SensorGpsSim::SensorGpsSim() : ModuleParams(nullptr), ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default) { - _param_sys_failure_en = param_find("SYS_FAILURE_EN"); } SensorGpsSim::~SensorGpsSim() @@ -244,26 +243,8 @@ void SensorGpsSim::publishWithFailures(int instance, sensor_gps_s gps, sensor_gp void SensorGpsSim::check_failure_injection() { - int32_t sys_failure_en = 0; - const bool enabled = _param_sys_failure_en != PARAM_INVALID - && param_get(_param_sys_failure_en, &sys_failure_en) == PX4_OK - && sys_failure_en == 1; - vehicle_command_s vehicle_command; - if (!enabled) { - // Clear any active failures so disabling the param at runtime - // stops injection instead of latching the previous state. - _gps_blocked_mask = 0; - _gps_stuck_mask = 0; - _gps_wrong_mask = 0; - - // Drain queued commands so re-enabling doesn't replay them. - while (_vehicle_command_sub.update(&vehicle_command)) {} - - return; - } - while (_vehicle_command_sub.update(&vehicle_command)) { const int failure_unit = static_cast(lroundf(vehicle_command.param1)); const int failure_type = static_cast(lroundf(vehicle_command.param2)); diff --git a/src/modules/simulation/sensor_gps_sim/SensorGpsSim.hpp b/src/modules/simulation/sensor_gps_sim/SensorGpsSim.hpp index 5b9d543aeb..a0608435b1 100644 --- a/src/modules/simulation/sensor_gps_sim/SensorGpsSim.hpp +++ b/src/modules/simulation/sensor_gps_sim/SensorGpsSim.hpp @@ -34,7 +34,6 @@ #pragma once #include -#include #include #include #include @@ -102,8 +101,6 @@ private: perf_counter_t _loop_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")}; - param_t _param_sys_failure_en{PARAM_INVALID}; - uint8_t _gps_blocked_mask{0}; uint8_t _gps_stuck_mask{0}; uint8_t _gps_wrong_mask{0};