Files
PX4-Autopilot/msg
Jacob DahlandAndrea Bernasconi d04e5623f6 feat(gnss): compare receivers in sensors, limit divergence in commander (#29604)
* feat(sensors/gnss): report how far each receiver is from the selected one

Commander compared the receivers itself, reading the sensors module's antenna offsets and comparing samples taken at different times. The sensors module has the receiver-to-slot matching and the corrected sample times, so it now publishes each receiver's disagreement with the selected one on sensors_status_gnss, horizontally and vertically.

The other receiver is moved along its velocity to the selected sample's time. The antenna baseline is rotated with the attitude, so swapped or misplaced antennas show once the primary estimator's heading is aligned. Before that only the distances are compared, since the yaw is arbitrary.

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

* feat(commander): limit the GNSS divergence with COM_GNSS_H_MAX and COM_GNSS_V_MAX

The divergence gate came from the receivers' reported accuracy floored with EKF2_GPS_P_NOISE, so it was hard to predict and read another module's parameter. Commander now takes the disagreement from sensors_status_gnss and applies fixed horizontal and vertical limits. Three times the receivers' combined reported accuracy still widens them, so standalone receivers don't warn on default parameters.

Before arming a divergence is reported at once and clears after 2 s of agreement. In flight it has to persist for 2 s.

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

* fix(commander): keep the GNSS divergence limits fixed

Widening the limits to three times the receivers' combined reported accuracy made them floors, not limits. With the default GNSS_REQ_EPH and GNSS_REQ_EPV the gate opened to 12.7 m horizontally and 21 m vertically before arming, and to about 210 m in flight once a receiver fell back to the relaxed checks. The limits now apply as set, with defaults of 5 m and 10 m so standalone receivers don't warn.

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

* fix(commander): don't take an unknown GNSS disagreement for agreement

The sensors module leaves the disagreement unknown when the two latest samples are more than 0.5 s apart, while both receivers stay healthy. Commander treated that as nothing to compare, so a divergence before arming cleared for that check and an arm request could pass, and in flight the 2 s timer restarted. It happens on any gap over 0.5 s from a healthy receiver, and on 2 Hz receivers whose latencies differ. An unknown disagreement now keeps the state and its timer. A divergence still clears at once when there is no healthy pair to compare.

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

* docs(commander): swapped GNSS antennas hide behind a moving-base heading

The moving-base heading takes its offset from the same antenna positions. With swapped antennas the heading turns by 180°, and the expected baseline turns with it, so the divergence check sees agreement.

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

* docs(commander): reword the moving-base heading caveat

The sentence didn't say plainly that a moving-base heading from the same receivers stops the check from detecting swapped antennas.

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

* docs(commander): fold the moving-base caveat into the swapped-antenna conditions

The caveat read as a repeat of the alignment sentence. It is one more condition for detecting swapped antennas, so it now sits with the others.

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

* refactor(gnss): rotate the antenna baseline with the attitude as it is

The heading gate kept a limit below twice the antenna baseline from reporting a divergence before the heading aligned. With a mag the heading aligns before the receivers turn healthy. A heading from the same two receivers can't reveal swapped antennas anyway. The gate also never opened with an external INS, since only EKF2 publishes estimator_status_flags. Dropping it saves 168 B of flash on fmu-v2. The attitude age limit goes with it, since the last published attitude is a better guess than level and facing north.

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

---------

Co-authored-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
2026-11-19 11:28:20 -07:00
..
2025-11-04 17:22:10 +01:00
2026-10-23 22:48:49 +02:00
…