Files
PX4-Autopilot/msg/VehicleGnss.msg
T
Jacob DahlandAndrea Bernasconi d6c24648a6 feat(ekf2): reset position when the GNSS receiver changes (#28939)
* feat(ekf2): reset position when the GNSS receiver changes

Receivers report positions in the frame of their correction source and
compute the altitude with their own geoid model, so a switch of the
receiver behind vehicle_gnss steps the measured position. EKF2 fused that
step as a normal measurement.

EKF2 now counts the changes of the selected receiver from its device_id
and resets the horizontal position to the new receiver on its first
fused sample, as proposed in the GNSS selection RFC (#28813). A receiver
without a device_id isn't counted. If another source constrains the
position, GNSS position fusion restarts instead, once the new receiver is
consistent with it. The height is reset if GNSS is the height reference,
otherwise the offset goes into the GNSS height bias.

The count stays in EKF2 for now. vehicle_gnss, next to the selection
that causes it, is the natural place for it in a follow-up.

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

* feat(gnss): count receiver changes in the sensors module

EKF2 counted the changes of the selected receiver itself from the device_id, in every EKF instance, and couldn't tell apart receivers without one. The sensors module makes the switch, so it now stamps selection_count and selected_instance on vehicle_gnss and EKF2 resets on that count.

Assisted-by: Claude:claude-opus-5-5

---------

Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
Co-authored-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
2026-09-30 17:13:46 -06:00

32 lines
1.7 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
# Check result for this sample
bool usable # Sample may be used: the receiver has passed its checks for long enough
uint16 failed_checks # [@enum CHECK] Bitmask of the enabled checks that failed
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