mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-27 00:48:23 +08:00
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.
This commit is contained in:
committed by
Gennaro Guidone
parent
4701d1bee8
commit
6f9e072e4b
@@ -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<int>(lroundf(vehicle_command.param1));
|
||||
const int failure_type = static_cast<int>(lroundf(vehicle_command.param2));
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <lib/perf/perf_counter.h>
|
||||
#include <parameters/param.h>
|
||||
#include <px4_platform_common/defines.h>
|
||||
#include <px4_platform_common/module.h>
|
||||
#include <px4_platform_common/module_params.h>
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user