Files
Andrea Bernasconi 67f5c57e9a feat(GNSS): Introduce kinematic consistency check (#29660)
* feat(gnss): check that the position change matches the velocity

A receiver computes its position from the code (time of flight) and its
velocity from the Doppler shift. Multipath and other degradation hit the
two differently, so a degraded receiver's position change stops matching
its velocity, often before its reported accuracy shows it. The existing
drift checks compare the two only at rest on the ground.

The new strict check filters the position change rate minus the mean
velocity over about 1 s and fails above GNSS_REQ_POSVEL, also in flight,
so the selection prefers another receiver that passes. It is off by
default (GNSS_CHECK bit 12) until the threshold is tuned on logs; the
filtered value is logged in sensors_status_gnss either way.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* fix(gnss): skip the position step at a fix type change in the consistency check

When a receiver starts or stops applying differential or RTK corrections,
its position steps by up to a few meters in one epoch while the Doppler
velocity is unaffected. That is a new solution, not degradation, and it
shouldn't demote a receiver that just reached RTK fixed. On a 10 Hz log
with DGPS dropping in and out, these steps drove the filtered value to
4.5 m/s; without them it peaks at 0.8 m/s, during a real vertical drift.

Only the interval spanning the change is skipped and the filter keeps its
state, so a receiver that keeps switching isn't blind for longer.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* refactor(gnss): Reduce check description

* fix(GNSS): Make the feature enabled by default but with more margin

* fix(gnss): restrict the position/velocity consistency check to horizontal

Receivers that don't report the vertical velocity failed the check on any
climb. Merge the consistency tests into fewer cases.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* refactor(gnss): mark the position/velocity consistency check as horizontal

The check only compares the horizontal position change with the horizontal
velocity. Name the parameter, flags and status field after that, so that a
vertical counterpart can be added later as GNSS_REQ_VPOSVEL / CHECK_VPOSVEL.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* refactor(gnss): rename the position/velocity check to kinematic consistency

HPOSVEL read like a check on position and velocity separately, next to
HDRIFT and HSPEED. "Kinematic consistency" names the property being
tested and leaves room for a vertical counterpart (VKIN). Messages,
flag comments and the parameter's long description keep the plain
wording, since "kinematic" alone can be read as RTK.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

---------

Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
2026-11-17 10:38:26 +01:00

43 lines
3.1 KiB
Plaintext

# Selected GNSS solution
#
# Published by the sensors module for every sample of the selected receiver, usable or not, with the selection state and the check result for that sample.
# Heading is on vehicle_gnss_heading.
uint64 timestamp # [us] Time since system start
uint64 timestamp_sample # [us] Measurement time, delay corrected. Use this rather than receiver.timestamp_sample, which holds the same value
SensorGnss receiver # The selected receiver's sensor_gnss sample with the corrected timestamp_sample
float32[3] antenna_offset # [m] [@frame FRD] Antenna position of the selected receiver
# Selection state
uint8 selected_instance # [-] sensor_gnss instance of the selected receiver
uint8 selection_count # [-] Increments when the selected receiver changes
uint8 selection_reason # [@enum SELECTION] Why this receiver is selected
uint8 SELECTION_PREFERRED = 0 # The preferred receiver
uint8 SELECTION_ONLY = 1 # No other receiver has published
uint8 SELECTION_RANKED = 2 # No receiver is preferred, and no other one ranks higher
uint8 SELECTION_TIMEOUT = 3 # The previously selected or the preferred receiver stopped publishing
uint8 SELECTION_UNHEALTHY = 4 # The previously selected or the preferred receiver failed its checks or delivered samples late, continuously or often
uint8 SELECTION_STRICT = 5 # Passes the strict checks, which the previously selected receiver didn't
uint8 SELECTION_RTK_FIXED = 6 # Passes the strict checks with an RTK fixed solution, and the previously selected receiver ranked lower
# Check result for this sample. The strict checks are the GNSS_REQ_* thresholds, satellite count, PDOP and drift at rest on the ground; the relaxed checks are fixed, looser limits on fix type, accuracy, spoofing and jamming.
bool usable # Sample may be used: the checks that decide it have passed without a failure for long enough
bool strict # The strict checks decide usable: they haven't passed since the vehicle was disarmed on the ground, or they pass. Otherwise the relaxed checks decide
uint16 failed_strict_checks # [@enum CHECK] Enabled checks this sample fails at the strict thresholds, evaluated on every sample
uint16 failed_relaxed_checks # [@enum CHECK] Enabled checks this sample fails at the relaxed thresholds, evaluated on every sample
uint16 CHECK_NSATS = 1 # Too few satellites
uint16 CHECK_PDOP = 2 # Position dilution of precision too high
uint16 CHECK_EPH = 4 # Horizontal position accuracy too low
uint16 CHECK_EPV = 8 # Vertical position accuracy too low
uint16 CHECK_SACC = 16 # Speed accuracy too low
uint16 CHECK_HDRIFT = 32 # Horizontal position drift at rest too high
uint16 CHECK_VDRIFT = 64 # Vertical position drift at rest too high
uint16 CHECK_HSPEED = 128 # Horizontal speed at rest too high
uint16 CHECK_VSPEED = 256 # Vertical speed at rest too high
uint16 CHECK_SPOOFED = 512 # Receiver reports spoofing
uint16 CHECK_FIX = 1024 # Fix type too low
uint16 CHECK_JAMMED = 2048 # Receiver reports jamming
uint16 CHECK_HKIN = 4096 # Horizontal position change inconsistent with velocity