Skip to main content

Gates

Struct Gates 

Source
pub struct Gates {
    pub gnss_position: Gate<2>,
    pub gnss_height: Gate<1>,
    pub gnss_velocity: Gate<3>,
    pub baro_altitude: Gate<1>,
    pub mag_heading: Gate<1>,
    pub gnss_heading: Gate<1>,
    pub course: Gate<1>,
    pub stationary: Gate<3>,
    pub position_hold: Gate<2>,
}
Expand description

Innovation gate thresholds γ, one per observation, from equation (37).

The filter reports r = ε / γ, so these set what r = 1 means. Built from a percentile, then adjusted per source where a caller has a reason:

use fusion_nav::{Gate, Gates, Percentile};

let mut gates = Gates::at(Percentile::P99);
gates.baro_altitude = Gate::<1>::at(Percentile::P999); // a barometer that sees prop wash

A threshold of the wrong dimension does not compile:

ⓘ
let mut gates = Gates::default();
gates.baro_altitude = Gate::<3>::at(Percentile::P99); // expected `Gate<1>`, found `Gate<3>`

Every threshold is compared against the joint ε = yᵀ S⁻¹ y over all of the observation’s components, not one component at a time. Both production estimators test per component against the diagonal of S only: PX4 each axis at 5σ (src/modules/ekf2/EKF/ekf.h:1142 at c4e4ef98e9), which fits its fusing the axes one by one (EKF/position_fusion.cpp:62-68); ArduPilot the horizontal pair as one sum against the summed variances and the vertical alone (libraries/AP_NavEKF3/AP_NavEKF3_PosVelFusion.cpp:904-906 and :1023 at 368dc0c428). The joint test is what makes a Percentile mean what it names: only ε is chi-square with dim(z) degrees of freedom, so only it rejects exactly 1 − p of good measurements, where a per-component test’s rate depends on correlations nothing states. And it keeps those correlations — a yaw error couples north and east, so the region S describes is an ellipsoid rather than a box aligned with the navigation axes.

A GNSS position fix is the exception, split into a horizontal Gate<2> and a vertical Gate<1> as ArduPilot splits it, because the joint test’s cost is all or nothing: a height the estimate disagrees with rejects a good horizontal fix, 3945 of 4616 on a vehicle whose barometer and receiver drift apart (evidence). The split keeps the joint test within each half, so north and east are still tested as the ellipse S describes; what it gives up is the north–down and east–down correlation, which a position fix barely carries. See GnssFusion.

Fields§

§gnss_position: Gate<2>

GNSS position, horizontal: north and east.

§gnss_height: Gate<1>

GNSS position, vertical: the height half of the same fix.

§gnss_velocity: Gate<3>

GNSS velocity.

§baro_altitude: Gate<1>

Barometric altitude.

§mag_heading: Gate<1>

Magnetic heading.

§gnss_heading: Gate<1>

Dual-antenna GNSS heading.

§course: Gate<1>

Course constraint.

§stationary: Gate<3>

A caller’s claim that the vehicle is still: zero velocity, all three axes.

§position_hold: Gate<2>

The position hold an unaided filter fuses: north and east.

Implementations§

Source§

impl Gates

Source

pub const fn at(percentile: Percentile) -> Self

Every source gated at the same percentile, each at its own degrees of freedom.

Trait Implementations§

Source§

impl Clone for Gates

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Gates

Source§

impl Debug for Gates

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Gates

Source§

fn default() -> Self

The 99.9th percentile: the tightest gate that costs nothing measurable on good data.

Replayed at 95 %, 99 %, 99.9 % and 5σ, the corpus could not tell them apart and the simulator prices the tight end: on mission 95 % turns away one good fix in thirty for worse accuracy, and 99.9 % and 5σ give what 99 % does (evidence). 99.9 % is still tighter than both production estimators, which test each axis at 5σ (PX4 src/modules/ekf2/EKF/common.h:348-374 at c4e4ef98e9; ArduPilot *_I_GATE_DEFAULT 500, in hundredths of σ, libraries/AP_NavEKF3/AP_NavEKF3.cpp:34-36 at 368dc0c428): a one-axis outlier fails γ = 16.27 at 4.0σ.

Source§

impl PartialEq for Gates

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Gates

Auto Trait Implementations§

§

impl Freeze for Gates

§

impl RefUnwindSafe for Gates

§

impl Send for Gates

§

impl Sync for Gates

§

impl Unpin for Gates

§

impl UnsafeUnpin for Gates

§

impl UnwindSafe for Gates

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<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.