mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-23 23:40:47 +08:00
d0775f2e40407dc9779ba0a6b122b97c6f092b4d
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
4964fa5995 |
feat(sensors/gnss): select the GNSS receiver on failures and the strict checks (#28798)
* feat(sensors/gnss): select the GNSS receiver on failures and reported accuracy The interim selection took the receiver with the best fix type and the most satellites, and the preferred one whenever it had a 3D fix. Fix type and satellite count compare poorly across receivers, and nothing held a switch, so a one-sample fix blip flipped the output and back. A preferred receiver (SENS_GNSS_PRIME, or with -1 the moving base of a moving base pair) is used until it fails: no usable, on-time sample for 2 s, or clearly less available than the other receiver. The selection returns to it once usable again, after 10 s while armed. Without one, it moves after 5 s to a receiver reporting at most half the eph and no worse epv, floored at 5 cm. SENS_GNSS_PRIME defaults to -1. vehicle_gnss carries the reason for the last switch, sensors_status_gnss each receiver's availability. GpsBlending becomes GnssSelector. Co-authored-by: Andrea Bernasconi <andrea.bernasconi@auterion.com> Assisted-by: Claude:claude-opus-5-5 * docs(sensors/gnss): rewrite the SENS_GNSS_PRIME description The description walked through the selection's internal timings and thresholds, and claimed that every switch resets the EKF2 position, which it doesn't while another source constrains the position. The availability comment left out that late samples count as unavailable. Assisted-by: Claude:claude-opus-5-5 * fix(sensors/gnss): update the selection while no receiver publishes The selector and sensors_status_gnss only updated when a sample arrived. When every receiver stopped, the last status kept reporting the receiver healthy and available, the receiver never timed out, and on its return the gap counted as available time. Co-authored-by: Andrea Bernasconi <andrea.bernasconi@auterion.com> Assisted-by: Claude:claude-opus-5-5 * refactor(sensors/gnss): keep the GNSS samples in the module, not the selector The selector stored full samples and antenna offsets only to hand them back, a leftover from blending; it reads just each sample's timestamp, eph and epv. The module now keeps every receiver's latest sample and publishes the selected one, which is the sample its checks ran on, and the heading path reads the receiver state from it instead of copying every receiver out of uORB. A timed-out receiver is reset in one place, without the writes to the fix type and satellite count that only blending ranked on. Assisted-by: Claude:claude-opus-5-5 * feat(sensors/gnss): rank receivers on the requirements and RTK fix, without returning to a failed one The eph ratio switched receivers on reported accuracy alone, and the 10 s return to the primary went back to a receiver likely to fail again in the same flight, at the cost of another EKF2 position reset. While disarmed, the selection fell back to the other receiver, so a vehicle could take off on it with a failing primary. While disarmed the primary is now selected whenever it publishes, so commander reports its failed checks before arming. While armed, a receiver left because it failed is selected again only when the selected one fails, until disarmed. Without a primary, receivers rank by meeting GNSS_REQ_EPH/EPV/SACC/FIX, which GnssChecks now also evaluates in flight, then by an RTK fixed solution; the selection moves up after 10 s armed or 2 s disarmed. Assisted-by: Claude:claude-opus-5-5 * feat(gnss_checks): always run strict checks to have the information for the selection algorithm, switch to simplified checks in-air when the strict checks fail * feat(GnssSelector): rework selection algorithm * fix(lib/gnss): pass the checks again and relax them only after a strict pass |
||
|
|
8e67d725de |
feat(gnss): keep one receiver each on GPS_RAW_INT and GPS2_RAW (#28940)
An operator reads the two messages as two fixed receivers, but SensorGpsSelector resolved SENS_GNSS_PRIME in the MAVLink streams on its own and put instance 0 on GPS_RAW_INT whenever no receiver was named. The sensors module now gives every receiver a fixed position on sensors_status_gnss: 0 for the preferred receiver, otherwise for the first to publish, then in order of first publication. GPS_RAW_INT and GPS2_RAW report positions 0 and 1, and more receivers fit once MAVLink has an instanced GNSS message. MAX_RECEIVERS names the array length, as .msg array sizes can't reference a constant. Assisted-by: Claude:claude-opus-5-5 |
||
|
|
4ad48205df |
feat(gnss): check each receiver and carry the result on the sample (#28520)
* refactor(gnss): move GnssChecks to src/lib/gnss The checks judge a receiver, not the estimate, and the sensors module needs one checker per receiver. GnssChecks now takes its thresholds as a params struct and armed, in air and at rest per call instead of referencing EKF2's parameters and control status, and the thresholds become GNSS_CHECK and GNSS_REQ_*, with GNSS_REQ_TIME for the health time. EKF2 still runs it, so the checks behave as before. Co-authored-by: jonas <jonas.perolini@rigi.tech> Assisted-by: Claude:claude-opus-5-5 * feat(gnss): carry the GNSS check result on the sample A latest-wins status can't gate fusion: it describes the newest sample, which runs ahead of the one EKF2 fuses by the GNSS delay plus the EKF buffer. The sensors module now runs one GnssChecks per receiver and stamps the selected receiver's result on each vehicle_gnss sample (usable, and failed_checks in GNSS_CHECK bit order), and EKF2 fuses a sample only if that sample is usable. EKF2 drops its own checker and estimator_gps_status; estimator_status.gps_check_fail_flags forwards the sample's failures in its own bit order until commander reads vehicle_gnss. Every receiver's diagnostics go on sensors_status_gnss. Co-authored-by: Matheo Taillandier <matheo.taillandier@rigi.tech> Co-authored-by: jonas <jonas.perolini@rigi.tech> Assisted-by: Claude:claude-opus-5-5 * feat(commander): count GNSS receivers that pass their checks A 3D fix says nothing about accuracy, drift, spoofing or jamming, so the redundancy check counted receivers the sensors module rejects. It now counts a receiver while sensors_status_gnss says it passes its checks. Co-authored-by: jonas <jonas.perolini@rigi.tech> Assisted-by: Claude:claude-opus-5-5 * fix(boards): drop EKF2::PublishGpsStatus from the i.MX RT ITCM lists The function went with estimator_gps_status, and the ITCM check fails on a listed symbol that is missing from the ELF. Assisted-by: Claude:claude-fable-5-1 * fix(ekf2): report GNSS check failures only while GNSS fusion is enabled EKF2 ran the checks only past its GNSS-intended gate, so with EKF2_GPS_CTRL 0 estimator_status.gps_check_fail_flags stayed 0. Forwarding the sample's failures unconditionally made commander turn a receiver EKF2 ignores into pre-arm failures, and into an arming block with COM_ARM_WO_GPS 0. Assisted-by: Claude:claude-fable-5-1 * refactor(commander): index the GNSS status by receiver instance The sensors module fills sensors_status_gnss by sensor_gnss instance, the index the redundancy check already subscribes with, so the device_id lookup was redundant. Its sizeof idiom also tripped clang-tidy's bugprone-sizeof-expression. Assisted-by: Claude:claude-fable-5-1 * refactor(ekf2): rename the GNSS checks pass time to sample accepted It is set only for a sample that is both usable and within EKF2_VEL_LIM, so it is the last time a sample was accepted for fusion, not the last time the checks passed. Assisted-by: Claude:claude-fable-5-1 * docs(msg): keep thresholds and parameters out of the GNSS check comments Message comments describe the message and its fields, not the code that fills them. Assisted-by: Claude:claude-fable-5-1 --------- Co-authored-by: Matheo Taillandier <matheo.taillandier@rigi.tech> Co-authored-by: jonas <jonas.perolini@rigi.tech> Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com> |