diff --git a/src/lib/failure_injection/FailureInjection.cpp b/src/lib/failure_injection/FailureInjection.cpp index 5586992cc1a..c084f691e78 100644 --- a/src/lib/failure_injection/FailureInjection.cpp +++ b/src/lib/failure_injection/FailureInjection.cpp @@ -110,6 +110,15 @@ bool process_gnss(const Config &config, uint8_t uorb_instance, sensor_gps_s &sen int32_t fix_type = sensor_gps_s::FIX_TYPE_2D; param_get(fix_type_handle, &fix_type); sensor_gps.fix_type = (uint8_t)fix_type; + + static const param_t jamming_state_handle = param_find("SYS_FAIL_GPS_JAM"); + + int32_t jamming_state = sensor_gps_s::JAMMING_STATE_UNKNOWN; + param_get(jamming_state_handle, &jamming_state); + + if (jamming_state != sensor_gps_s::JAMMING_STATE_UNKNOWN) { + sensor_gps.jamming_state = (uint8_t)jamming_state; + } } return true; diff --git a/src/lib/failure_injection/FailureInjection.hpp b/src/lib/failure_injection/FailureInjection.hpp index f8246f9bd6c..7a0b5046c6a 100644 --- a/src/lib/failure_injection/FailureInjection.hpp +++ b/src/lib/failure_injection/FailureInjection.hpp @@ -200,7 +200,8 @@ void process_battery(const Config &config, uint8_t instance, battery_status_s &b /** * GNSS counterpart to process(): on FAILURE_UNIT_SENSOR_GPS for the receiver publishing on the * given 0-based uORB instance, Off and Stuck behave as in the generic process() and Wrong reports - * the fix type selected by SYS_FAIL_GPS_WRG while leaving the position untouched. + * the fix type selected by SYS_FAIL_GPS_WRG and the jamming state selected by SYS_FAIL_GPS_JAM + * while leaving the position untouched. * * @param uorb_instance 0-based uORB instance of the publisher (not the 1-based failure instance). * @return false if the sensor_gps publication must be suppressed (Off), true otherwise. diff --git a/src/modules/failure_injection_manager/FailureInjectionManager.hpp b/src/modules/failure_injection_manager/FailureInjectionManager.hpp index 970523577ea..4d63a31c328 100644 --- a/src/modules/failure_injection_manager/FailureInjectionManager.hpp +++ b/src/modules/failure_injection_manager/FailureInjectionManager.hpp @@ -105,6 +105,7 @@ private: (ParamInt) _param_sys_fail_rc_inst, // Consumed via param_find() in failure_injection::process_gnss(); registered // here so it is marked used and shows up in the GCS parameter list. - (ParamInt) _param_sys_fail_gps_wrg + (ParamInt) _param_sys_fail_gps_wrg, + (ParamInt) _param_sys_fail_gps_jam ) }; diff --git a/src/modules/failure_injection_manager/failure_injection_manager_params.yaml b/src/modules/failure_injection_manager/failure_injection_manager_params.yaml index 94180afb91a..38bdfdd0a05 100644 --- a/src/modules/failure_injection_manager/failure_injection_manager_params.yaml +++ b/src/modules/failure_injection_manager/failure_injection_manager_params.yaml @@ -98,3 +98,19 @@ parameters: 3: "Fix: 3D" 5: "Fix: RTK float" 6: "Fix: RTK fixed" + SYS_FAIL_GPS_JAM: + description: + short: GPS Wrong-failure jamming state + long: |- + GNSS jamming state reported by the addressed receiver while a GPS 'wrong' + failure injection is active. The reported position is left untouched, so + 'Detected' simulates a receiver that still delivers a valid fix while + reporting interference. Leave at 'Unchanged' to keep the simulated + receiver's own jamming state. + type: enum + default: 0 + values: + 0: Unchanged + 1: OK + 2: Mitigated + 3: Detected