refactor(ekf2): index GNSS check failures by the estimator_status constants (#28812)

The fail status union and the check mask enum each restated a check layout by hand next to the msg constants, joined by a per-check map, so appending a check to one copy silently misassigned it in the others. GnssChecks now keeps one fail word indexed by the msg constants, and one table maps each check to its EKF2_GPS_CHECK bit, checked at compile time. Saved parameters, logs and events keep their bit layouts.

Assisted-by: Claude:claude-opus-5-5
This commit is contained in:
Jacob Dahl authored and GitHub committed 2026-09-29 11:36:22 -06:00
1 parent 8f106ed256
commit 923e340c3d
6 files changed
+151 -137

No files matched your search

@@ -40,6 +40,53 @@
namespace estimator
{
namespace
{
constexpr uint16_t bit(uint8_t check) { return 1u << check; }
constexpr uint16_t kDriftChecks =
bit(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_DRIFT) | bit(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_DRIFT) |
bit(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_SPD_ERR) | bit(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_SPD_ERR);
// nsats and PDOP keep their last pre-flight result, so a check enabled in flight must not fail on it.
constexpr uint16_t kSimplifiedChecks =
bit(estimator_status_s::GPS_CHECK_FAIL_GPS_FIX) | bit(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_ERR) |
bit(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_ERR) | bit(estimator_status_s::GPS_CHECK_FAIL_MAX_SPD_ERR) |
bit(estimator_status_s::GPS_CHECK_FAIL_SPOOFED) | bit(estimator_status_s::GPS_CHECK_FAIL_JAMMED);
constexpr bool eachCheckHasItsOwnParamBit()
{
uint32_t used = 0;
for (uint8_t check = 0; check < GnssChecks::kNumChecks; check++) {
const uint8_t param_bit = GnssChecks::paramBit(check);
if ((param_bit == GnssChecks::kNoParamBit) || (used & (1u << param_bit))) {
return false;
}
used |= 1u << param_bit;
}
return true;
}
static_assert(eachCheckHasItsOwnParamBit(), "every GPS_CHECK_FAIL_* check needs its own EKF2_GPS_CHECK bit");
}
uint16_t GnssChecks::getEnabledChecks() const
{
uint16_t checks = 0;
for (uint8_t check = 0; check < kNumChecks; check++) {
if (isCheckEnabled(check)) {
checks |= bit(check);
}
}
return checks;
}
bool GnssChecks::run(const gnssSample &gnss, uint64_t time_us)
{
// assume failed first time through
@@ -86,90 +133,67 @@ bool GnssChecks::run(const gnssSample &gnss, uint64_t time_us)
return _passed;
}
void GnssChecks::setFail(uint8_t check, bool failed)
{
if (failed) {
_fail_flags |= bit(check);
} else {
_fail_flags &= ~bit(check);
}
}
bool GnssChecks::runSimplifiedChecks(const gnssSample &gnss)
{
_check_fail_status.flags.fix = (gnss.fix_type < 3);
setFail(estimator_status_s::GPS_CHECK_FAIL_GPS_FIX, gnss.fix_type < 3);
// Check the reported horizontal and vertical position accuracy
_check_fail_status.flags.hacc = (gnss.hacc > 50.f);
_check_fail_status.flags.vacc = (gnss.vacc > 50.f);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_ERR, gnss.hacc > 50.f);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_ERR, gnss.vacc > 50.f);
// Check the reported speed accuracy
_check_fail_status.flags.sacc = (gnss.sacc > 10.f);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_SPD_ERR, gnss.sacc > 10.f);
_check_fail_status.flags.spoofed = gnss.spoofed;
_check_fail_status.flags.jammed = gnss.jammed;
setFail(estimator_status_s::GPS_CHECK_FAIL_SPOOFED, gnss.spoofed);
setFail(estimator_status_s::GPS_CHECK_FAIL_JAMMED, gnss.jammed);
bool passed = true;
if (
(_check_fail_status.flags.fix && isCheckEnabled(GnssChecksMask::kFix)) ||
(_check_fail_status.flags.hacc && isCheckEnabled(GnssChecksMask::kHacc)) ||
(_check_fail_status.flags.vacc && isCheckEnabled(GnssChecksMask::kVacc)) ||
(_check_fail_status.flags.sacc && isCheckEnabled(GnssChecksMask::kSacc)) ||
(_check_fail_status.flags.spoofed && isCheckEnabled(GnssChecksMask::kSpoofed)) ||
(_check_fail_status.flags.jammed && isCheckEnabled(GnssChecksMask::kJammed))
) {
passed = false;
}
return passed;
return enabledChecksPass(kSimplifiedChecks);
}
bool GnssChecks::runInitialFixChecks(const gnssSample &gnss)
{
// Check the fix type
_check_fail_status.flags.fix = (gnss.fix_type < _params.ekf2_req_fix);
setFail(estimator_status_s::GPS_CHECK_FAIL_GPS_FIX, gnss.fix_type < _params.ekf2_req_fix);
// Check the number of satellites
_check_fail_status.flags.nsats = (gnss.nsats < _params.ekf2_req_nsats);
setFail(estimator_status_s::GPS_CHECK_FAIL_MIN_SAT_COUNT, gnss.nsats < _params.ekf2_req_nsats);
// Check the position dilution of precision
_check_fail_status.flags.pdop = (gnss.pdop > _params.ekf2_req_pdop);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_PDOP, gnss.pdop > _params.ekf2_req_pdop);
// Check the reported horizontal and vertical position accuracy
_check_fail_status.flags.hacc = (gnss.hacc > _params.ekf2_req_eph);
_check_fail_status.flags.vacc = (gnss.vacc > _params.ekf2_req_epv);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_ERR, gnss.hacc > _params.ekf2_req_eph);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_ERR, gnss.vacc > _params.ekf2_req_epv);
// Check the reported speed accuracy
_check_fail_status.flags.sacc = (gnss.sacc > _params.ekf2_req_sacc);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_SPD_ERR, gnss.sacc > _params.ekf2_req_sacc);
_check_fail_status.flags.spoofed = gnss.spoofed;
_check_fail_status.flags.jammed = gnss.jammed;
setFail(estimator_status_s::GPS_CHECK_FAIL_SPOOFED, gnss.spoofed);
setFail(estimator_status_s::GPS_CHECK_FAIL_JAMMED, gnss.jammed);
runOnGroundGnssChecks(gnss);
// force horizontal speed failure if above the limit
if (gnss.vel.xy().longerThan(_params.ekf2_vel_lim)) {
_check_fail_status.flags.hspeed = true;
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_SPD_ERR, true);
}
// force vertical speed failure if above the limit
if (fabsf(gnss.vel(2)) > _params.ekf2_vel_lim) {
_check_fail_status.flags.vspeed = true;
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_SPD_ERR, true);
}
bool passed = true;
// if any user selected checks have failed, record the fail time
if (
(_check_fail_status.flags.fix && isCheckEnabled(GnssChecksMask::kFix)) ||
(_check_fail_status.flags.nsats && isCheckEnabled(GnssChecksMask::kNsats)) ||
(_check_fail_status.flags.pdop && isCheckEnabled(GnssChecksMask::kPdop)) ||
(_check_fail_status.flags.hacc && isCheckEnabled(GnssChecksMask::kHacc)) ||
(_check_fail_status.flags.vacc && isCheckEnabled(GnssChecksMask::kVacc)) ||
(_check_fail_status.flags.sacc && isCheckEnabled(GnssChecksMask::kSacc)) ||
(_check_fail_status.flags.hdrift && isCheckEnabled(GnssChecksMask::kHdrift)) ||
(_check_fail_status.flags.vdrift && isCheckEnabled(GnssChecksMask::kVdrift)) ||
(_check_fail_status.flags.hspeed && isCheckEnabled(GnssChecksMask::kHspd)) ||
(_check_fail_status.flags.vspeed && isCheckEnabled(GnssChecksMask::kVspd)) ||
(_check_fail_status.flags.spoofed && isCheckEnabled(GnssChecksMask::kSpoofed)) ||
(_check_fail_status.flags.jammed && isCheckEnabled(GnssChecksMask::kJammed))
) {
passed = false;
}
return passed;
return enabledChecksPass(UINT16_MAX);
}
void GnssChecks::runOnGroundGnssChecks(const gnssSample &gnss)
@@ -215,11 +239,11 @@ void GnssChecks::runOnGroundGnssChecks(const gnssSample &gnss)
// hdrift: calculate the horizontal drift speed and fail if too high
_horizontal_position_drift_rate_m_s = Vector2f(_lat_lon_alt_deriv_filt.xy()).norm();
_check_fail_status.flags.hdrift = (_horizontal_position_drift_rate_m_s > _params.ekf2_req_hdrift);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_DRIFT, _horizontal_position_drift_rate_m_s > _params.ekf2_req_hdrift);
// vdrift: fail if the vertical drift speed is too high
_vertical_position_drift_rate_m_s = fabsf(_lat_lon_alt_deriv_filt(2));
_check_fail_status.flags.vdrift = (_vertical_position_drift_rate_m_s > _params.ekf2_req_vdrift);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_DRIFT, _vertical_position_drift_rate_m_s > _params.ekf2_req_vdrift);
// hspeed: check the magnitude of the filtered horizontal GNSS velocity
const Vector2f vel_ne = matrix::constrain(Vector2f(gnss.vel.xy()),
@@ -227,14 +251,14 @@ void GnssChecks::runOnGroundGnssChecks(const gnssSample &gnss)
10.0f * _params.ekf2_req_hdrift);
_vel_ne_filt = vel_ne * filter_coef + _vel_ne_filt * (1.0f - filter_coef);
_filtered_horizontal_velocity_m_s = _vel_ne_filt.norm();
_check_fail_status.flags.hspeed = (_filtered_horizontal_velocity_m_s > _params.ekf2_req_hdrift);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_SPD_ERR, _filtered_horizontal_velocity_m_s > _params.ekf2_req_hdrift);
// vspeed: check the magnitude of the filtered vertical GNSS velocity
const float gnss_vz_limit = 10.f * _params.ekf2_req_vdrift;
const float gnss_vz = math::constrain(gnss.vel(2), -gnss_vz_limit, gnss_vz_limit);
_vel_d_filt = gnss_vz * filter_coef + _vel_d_filt * (1.f - filter_coef);
_check_fail_status.flags.vspeed = (fabsf(_vel_d_filt) > _params.ekf2_req_vdrift);
setFail(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_SPD_ERR, fabsf(_vel_d_filt) > _params.ekf2_req_vdrift);
} else {
// This is the case where the vehicle is on ground and IMU movement is blocking the drift calculation
@@ -244,10 +268,7 @@ void GnssChecks::runOnGroundGnssChecks(const gnssSample &gnss)
void GnssChecks::clearDriftChecks()
{
_check_fail_status.flags.hdrift = false;
_check_fail_status.flags.vdrift = false;
_check_fail_status.flags.hspeed = false;
_check_fail_status.flags.vspeed = false;
_fail_flags &= ~kDriftChecks;
resetDriftFilters();
}
@@ -35,6 +35,7 @@
#define EKF_GNSS_CHECKS_H
#include <lib/geo/geo.h>
#include <uORB/topics/estimator_status.h>
#include "../../common.h"
@@ -50,48 +51,6 @@ public:
_control_status(control_status)
{};
union gps_check_fail_status_u {
struct {
uint16_t fix : 1; ///< 0 - true if the fix type is insufficient (no 3D solution)
uint16_t nsats : 1; ///< 1 - true if number of satellites used is insufficient
uint16_t pdop : 1; ///< 2 - true if position dilution of precision is insufficient
uint16_t hacc : 1; ///< 3 - true if reported horizontal accuracy is insufficient
uint16_t vacc : 1; ///< 4 - true if reported vertical accuracy is insufficient
uint16_t sacc : 1; ///< 5 - true if reported speed accuracy is insufficient
uint16_t hdrift : 1; ///< 6 - true if horizontal drift is excessive (can only be used when stationary on ground)
uint16_t vdrift : 1; ///< 7 - true if vertical drift is excessive (can only be used when stationary on ground)
uint16_t hspeed : 1; ///< 8 - true if horizontal speed is excessive (can only be used when stationary on ground)
uint16_t vspeed : 1; ///< 9 - true if vertical speed error is excessive
uint16_t spoofed: 1; ///< 10 - true if the GNSS data is spoofed
uint16_t jammed : 1; ///< 11 - true if the GNSS data is jammed
} flags;
uint16_t value;
};
/**
* Fail-status flags (gps_check_fail_status_u layout) of the checks enabled by EKF2_GPS_CHECK.
* The param bit order (GnssChecksMask) and the status bit order are not parallel, so they are
* mapped one by one: a positional shift silently misassigns every check that is appended to
* one of the two enums but not the other.
*/
uint16_t getEnabledChecksFailStatusMask() const
{
gps_check_fail_status_u mask{};
mask.flags.fix = isCheckEnabled(GnssChecksMask::kFix);
mask.flags.nsats = isCheckEnabled(GnssChecksMask::kNsats);
mask.flags.pdop = isCheckEnabled(GnssChecksMask::kPdop);
mask.flags.hacc = isCheckEnabled(GnssChecksMask::kHacc);
mask.flags.vacc = isCheckEnabled(GnssChecksMask::kVacc);
mask.flags.sacc = isCheckEnabled(GnssChecksMask::kSacc);
mask.flags.hdrift = isCheckEnabled(GnssChecksMask::kHdrift);
mask.flags.vdrift = isCheckEnabled(GnssChecksMask::kVdrift);
mask.flags.hspeed = isCheckEnabled(GnssChecksMask::kHspd);
mask.flags.vspeed = isCheckEnabled(GnssChecksMask::kVspd);
mask.flags.spoofed = isCheckEnabled(GnssChecksMask::kSpoofed);
mask.flags.jammed = isCheckEnabled(GnssChecksMask::kJammed);
return mask.value;
}
void resetHard()
{
_initial_checks_passed = false;
@@ -115,30 +74,62 @@ public:
uint64_t getLastPassUs() const { return _time_last_pass_us; }
uint64_t getLastFailUs() const { return _time_last_fail_us; }
const gps_check_fail_status_u &getFailStatus() const { return _check_fail_status; }
static constexpr uint8_t kNumChecks = estimator_status_s::GPS_CHECK_FAIL_JAMMED + 1;
// Indexed by estimator_status_s::GPS_CHECK_FAIL_*
uint16_t getFailFlags() const { return _fail_flags; }
// The checks enabled in EKF2_GPS_CHECK, indexed by estimator_status_s::GPS_CHECK_FAIL_*
uint16_t getEnabledChecks() const;
float horizontal_position_drift_rate_m_s() const { return _horizontal_position_drift_rate_m_s; }
float vertical_position_drift_rate_m_s() const { return _vertical_position_drift_rate_m_s; }
float filtered_horizontal_velocity_m_s() const { return _filtered_horizontal_velocity_m_s; }
enum class GnssChecksMask : int32_t {
kNsats = (1 << 0),
kPdop = (1 << 1),
kHacc = (1 << 2),
kVacc = (1 << 3),
kSacc = (1 << 4),
kHdrift = (1 << 5),
kVdrift = (1 << 6),
kHspd = (1 << 7),
kVspd = (1 << 8),
kSpoofed = (1 << 9),
kFix = (1 << 10),
kJammed = (1 << 11)
};
static constexpr uint8_t kNoParamBit = 31;
bool isCheckEnabled(GnssChecksMask check) const { return (_params.check_mask & static_cast<int32_t>(check)); }
// EKF2_GPS_CHECK bit of an estimator_status_s::GPS_CHECK_FAIL_* check. The two orders differ, and saved parameters,
// logs and events each depend on one of them, so neither can be reordered.
static constexpr uint8_t paramBit(uint8_t check)
{
switch (check) {
case estimator_status_s::GPS_CHECK_FAIL_MIN_SAT_COUNT: return 0;
case estimator_status_s::GPS_CHECK_FAIL_MAX_PDOP: return 1;
case estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_ERR: return 2;
case estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_ERR: return 3;
case estimator_status_s::GPS_CHECK_FAIL_MAX_SPD_ERR: return 4;
case estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_DRIFT: return 5;
case estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_DRIFT: return 6;
case estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_SPD_ERR: return 7;
case estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_SPD_ERR: return 8;
case estimator_status_s::GPS_CHECK_FAIL_SPOOFED: return 9;
case estimator_status_s::GPS_CHECK_FAIL_GPS_FIX: return 10;
case estimator_status_s::GPS_CHECK_FAIL_JAMMED: return 11;
default: return kNoParamBit;
}
}
bool isCheckEnabled(uint8_t check) const
{
return (static_cast<uint32_t>(_params.check_mask) & (1u << paramBit(check))) != 0;
}
private:
void setFail(uint8_t check, bool failed);
bool enabledChecksPass(uint16_t checks) const { return (_fail_flags & checks & getEnabledChecks()) == 0; }
bool runSimplifiedChecks(const gnssSample &gnss);
bool runInitialFixChecks(const gnssSample &gnss);
void runOnGroundGnssChecks(const gnssSample &gnss);
@@ -151,7 +142,7 @@ private:
return (timestamp_to_check_us == 0) || (timestamp_to_check_us + timeout_period < now_us);
}
gps_check_fail_status_u _check_fail_status{};
uint16_t _fail_flags{0};
float _horizontal_position_drift_rate_m_s{NAN};
float _vertical_position_drift_rate_m_s{NAN};
@@ -83,8 +83,8 @@ void Ekf::controlGnssYawFusion(const imuSample &imu_delayed)
// reset waits for the GNSS health time. The position checks themselves don't gate the heading: it is a separate
// observation, often from a separate receiver.
const bool is_heading_receiver_flagged =
(gnss_yaw_sample.spoofed && _gnss_checks.isCheckEnabled(GnssChecks::GnssChecksMask::kSpoofed))
|| (gnss_yaw_sample.jammed && _gnss_checks.isCheckEnabled(GnssChecks::GnssChecksMask::kJammed));
(gnss_yaw_sample.spoofed && _gnss_checks.isCheckEnabled(estimator_status_s::GPS_CHECK_FAIL_SPOOFED))
|| (gnss_yaw_sample.jammed && _gnss_checks.isCheckEnabled(estimator_status_s::GPS_CHECK_FAIL_JAMMED));
if (is_heading_receiver_flagged) {
_time_last_gnss_yaw_fail_us = _time_delayed_us;
+2 -3
View File
@@ -404,9 +404,8 @@ public:
// set minimum continuous period without GPS fail required to mark a healthy GPS status
void set_min_required_gps_health_time(uint32_t time_us) { _min_gps_health_time_us = time_us; }
const GnssChecks::gps_check_fail_status_u &gps_check_fail_status() const { return _gnss_checks.getFailStatus(); }
const decltype(GnssChecks::gps_check_fail_status_u::flags) &gps_check_fail_status_flags() const { return _gnss_checks.getFailStatus().flags; }
uint16_t gps_check_fail_status_enabled_mask() const { return _gnss_checks.getEnabledChecksFailStatusMask(); }
uint16_t gps_check_fail_flags() const { return _gnss_checks.getFailFlags(); }
uint16_t gps_checks_enabled() const { return _gnss_checks.getEnabledChecks(); }
bool gps_checks_passed() const { return _gnss_checks.passed(); };
+15 -12
View File
@@ -1397,17 +1397,20 @@ void EKF2::PublishGpsStatus(const hrt_abstime &timestamp)
estimator_gps_status.checks_passed = _ekf.gps_checks_passed();
estimator_gps_status.check_fail_gps_fix = _ekf.gps_check_fail_status_flags().fix;
estimator_gps_status.check_fail_min_sat_count = _ekf.gps_check_fail_status_flags().nsats;
estimator_gps_status.check_fail_max_pdop = _ekf.gps_check_fail_status_flags().pdop;
estimator_gps_status.check_fail_max_horz_err = _ekf.gps_check_fail_status_flags().hacc;
estimator_gps_status.check_fail_max_vert_err = _ekf.gps_check_fail_status_flags().vacc;
estimator_gps_status.check_fail_max_spd_err = _ekf.gps_check_fail_status_flags().sacc;
estimator_gps_status.check_fail_max_horz_drift = _ekf.gps_check_fail_status_flags().hdrift;
estimator_gps_status.check_fail_max_vert_drift = _ekf.gps_check_fail_status_flags().vdrift;
estimator_gps_status.check_fail_max_horz_spd_err = _ekf.gps_check_fail_status_flags().hspeed;
estimator_gps_status.check_fail_max_vert_spd_err = _ekf.gps_check_fail_status_flags().vspeed;
estimator_gps_status.check_fail_spoofed_gps = _ekf.gps_check_fail_status_flags().spoofed;
const uint16_t fail_flags = _ekf.gps_check_fail_flags();
auto failed = [fail_flags](uint8_t check) { return (fail_flags & (1u << check)) != 0; };
estimator_gps_status.check_fail_gps_fix = failed(estimator_status_s::GPS_CHECK_FAIL_GPS_FIX);
estimator_gps_status.check_fail_min_sat_count = failed(estimator_status_s::GPS_CHECK_FAIL_MIN_SAT_COUNT);
estimator_gps_status.check_fail_max_pdop = failed(estimator_status_s::GPS_CHECK_FAIL_MAX_PDOP);
estimator_gps_status.check_fail_max_horz_err = failed(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_ERR);
estimator_gps_status.check_fail_max_vert_err = failed(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_ERR);
estimator_gps_status.check_fail_max_spd_err = failed(estimator_status_s::GPS_CHECK_FAIL_MAX_SPD_ERR);
estimator_gps_status.check_fail_max_horz_drift = failed(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_DRIFT);
estimator_gps_status.check_fail_max_vert_drift = failed(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_DRIFT);
estimator_gps_status.check_fail_max_horz_spd_err = failed(estimator_status_s::GPS_CHECK_FAIL_MAX_HORZ_SPD_ERR);
estimator_gps_status.check_fail_max_vert_spd_err = failed(estimator_status_s::GPS_CHECK_FAIL_MAX_VERT_SPD_ERR);
estimator_gps_status.check_fail_spoofed_gps = failed(estimator_status_s::GPS_CHECK_FAIL_SPOOFED);
estimator_gps_status.timestamp = _replay_mode ? timestamp : hrt_absolute_time();
_estimator_gps_status_pub.publish(estimator_gps_status);
@@ -1950,7 +1953,7 @@ void EKF2::PublishStatus(const hrt_abstime &timestamp)
#if defined(CONFIG_EKF2_GNSS)
// only report enabled GPS check failures
status.gps_check_fail_flags = _ekf.gps_check_fail_status().value & _ekf.gps_check_fail_status_enabled_mask();
status.gps_check_fail_flags = _ekf.gps_check_fail_flags() & _ekf.gps_checks_enabled();
#endif // CONFIG_EKF2_GNSS
status.control_mode_flags = _ekf.control_status().value;
+2 -2
View File
@@ -419,8 +419,8 @@ TEST_F(EkfGpsHeadingTest, continuesWhenPositionQualityPoor)
TEST_F(EkfGpsHeadingTest, flaggedReceiver)
{
// GIVEN: the spoofing and jamming checks enabled and a good heading from a receiver reporting spoofing
_ekf->getParamHandle()->ekf2_gps_check |= static_cast<int32_t>(GnssChecks::GnssChecksMask::kSpoofed)
| static_cast<int32_t>(GnssChecks::GnssChecksMask::kJammed);
_ekf->getParamHandle()->ekf2_gps_check |= (1 << GnssChecks::paramBit(estimator_status_s::GPS_CHECK_FAIL_SPOOFED))
| (1 << GnssChecks::paramBit(estimator_status_s::GPS_CHECK_FAIL_JAMMED));
const float gps_heading = matrix::wrap_pi(_ekf_wrapper.getYawAngle() + math::radians(20.f));
_sensor_simulator._gnss_yaw.setYaw(gps_heading);
_sensor_simulator._gnss_yaw.setSpoofed(true);