GnssFaultModel

Enum GnssFaultModel 

Source
pub enum GnssFaultModel {
    None,
    Degraded {
        rho_pos: f64,
        sigma_pos_m: f64,
        rho_vel: f64,
        sigma_vel_mps: f64,
        r_scale: f64,
    },
    SlowBias {
        drift_n_mps: f64,
        drift_e_mps: f64,
        q_bias: f64,
        rotate_omega_rps: f64,
    },
    Hijack {
        offset_n_m: f64,
        offset_e_m: f64,
        start_s: f64,
        duration_s: f64,
    },
    Combo(Vec<GnssFaultModel>),
}
Expand description

Models how GNSS measurement content is corrupted before it reaches the filter.

This is complementary to GnssScheduler, which decides when GNSS updates are delivered. GnssFaultModel decides what corruption to apply to each delivered measurement. Together, they allow you to simulate a wide range of denial, jamming, or spoofing conditions.

Typical usage is to wrap a “truth-like” GNSS fix (from your dataset) with one of these variants before passing it to the UKF update step.

§Variants

  • None: deliver the fix unchanged.
  • Degraded: add AR(1)-correlated noise to position and velocity, and inflate the advertised covariance. Simulates low-SNR or multipath conditions.
  • SlowBias: apply a slowly drifting offset in N/E position and velocity. Simulates soft spoofing where the trajectory is nudged gradually away from truth.
  • Hijack: apply a hard constant offset in N/E position during a fixed time window. Simulates hard spoofing where the solution is forced onto a parallel displaced track.
  • Combo: apply several fault models in sequence (output of one feeds into the next), allowing composition of multiple effects.

§Examples

use strapdown::messages::GnssFaultModel;

// No corruption (baseline)
let fault = GnssFaultModel::None;

// Degraded accuracy: ~3 m wander, ~0.3 m/s vel wander, 5x inflated R
let fault = GnssFaultModel::Degraded {
    rho_pos: 0.99,
    sigma_pos_m: 3.0,
    rho_vel: 0.95,
    sigma_vel_mps: 0.3,
    r_scale: 5.0,
};

// Slow bias drifting north at 2 cm/s
let fault = GnssFaultModel::SlowBias {
    drift_n_mps: 0.02,
    drift_e_mps: 0.0,
    q_bias: 1e-6,
    rotate_omega_rps: 0.0,
};

// Hijack: apply 50 m north offset between 120–180 s
let fault = GnssFaultModel::Hijack {
    offset_n_m: 50.0,
    offset_e_m: 0.0,
    start_s: 120.0,
    duration_s: 60.0,
};

// Combo: first drift slowly, then add hijack window
let fault = GnssFaultModel::Combo(vec![
    GnssFaultModel::SlowBias { drift_n_mps: 0.02, drift_e_mps: 0.0, q_bias: 1e-6, rotate_omega_rps: 0.0 },
    GnssFaultModel::Hijack { offset_n_m: 50.0, offset_e_m: 0.0, start_s: 120.0, duration_s: 60.0 },
]);

Variants§

§

None

No corruption; GNSS fixes are passed through unchanged.

§

Degraded

(2) Degraded accuracy: AR(1)-correlated noise on position and velocity, plus inflated advertised covariance. Models low-SNR or multipath cases.

Fields

§rho_pos: f64

AR(1) correlation coefficient for position error (close to 1.0).

§sigma_pos_m: f64

AR(1) innovation standard deviation for position error (meters).

§rho_vel: f64

AR(1) correlation coefficient for velocity error.

§sigma_vel_mps: f64

AR(1) innovation standard deviation for velocity error (m/s).

§r_scale: f64

Scale factor for inflating the advertised measurement noise covariance.

§

SlowBias

(5) Slow drifting bias (soft spoof), applied in N/E meters and velocity.

Models gradual displacement of the navigation solution that appears plausible to the filter.

Fields

§drift_n_mps: f64

Northward drift rate (m/s).

§drift_e_mps: f64

Eastward drift rate (m/s).

§q_bias: f64

Random walk PSD (m²/s³) for adding a small stochastic component to the bias.

§rotate_omega_rps: f64

Optional slow rotation of drift direction (rad/s).

§

Hijack

(6) Hard spoof window: apply a constant N/E offset for a fixed time window.

Simulates abrupt hijacking of the trajectory.

Fields

§offset_n_m: f64

North offset in meters.

§offset_e_m: f64

East offset in meters.

§start_s: f64

Start time of spoofing window (s).

§duration_s: f64

Duration of spoofing window (s).

§

Combo(Vec<GnssFaultModel>)

Compose multiple effects by chaining models together.

The output of one model is fed as the input to the next. This allows combining e.g. SlowBias with a Hijack to simulate multi-stage spoofing.

Trait Implementations§

Source§

impl Clone for GnssFaultModel

Source§

fn clone(&self) -> GnssFaultModel

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GnssFaultModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V