mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-22 14:19:57 +08:00
main
6
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 |
||
|
|
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> |
||
|
|
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> |
||
|
|
20eabe6184 |
refactor(sensors): remove GNSS blending (#28921)
Blending averages receivers whose errors are largely shared, drifts when the weights change, and hands every consumer a synthetic sample that no receiver produced, so no per-receiver check result applies to it. The sensors module now always outputs one receiver, chosen by the selection it already used with SENS_GNSS_MASK 0: the SENS_GNSS_PRIME receiver while it has a 3D fix, otherwise the best fix, then the most satellites. Receiver selection replaces that next. SENS_GNSS_MASK and SENS_GNSS_TAU are removed. Assisted-by: Claude:claude-opus-5-5 |
||
|
|
e40501eba0 |
refactor(msg): rename GPS to GNSS in messages, topics and sensor parameters (#24399)
* refactor(msg): rename SensorGps to SensorGnss and add VehicleGnss GPS is one constellation; the receivers and the rest of PX4 handle GNSS. Field names lose their units (latitude, speed_accuracy, course, ...), which move into the metadata comments. The sensors module's output becomes VehicleGnss on vehicle_gnss: the selected receiver's sample next to what the sensors module adds to it (corrected sample time, antenna position, selected instance), so a consumer can tell the two apart and later selection and check results have a place to go. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/gps): publish sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/septentrio): publish sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/pps_capture): read sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(lib/gnss): select receivers on sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(sensors): publish VehicleGnss on vehicle_gnss and rename SENS_GPS* to SENS_GNSS* The sensors module's output nests the selected receiver's sample, with the corrected sample time, antenna position and selected instance next to it. SENS_GPS_MASK/TAU/PRIME and SENS_GPSn_ID/OFFX/OFFY/OFFZ/DELAY take the SENS_GNSS name the heading parameters already use; saved parameters migrate on import, and the EKF2_GPS_POS/EKF2_GPS_DELAY translations now land on the new names directly. Assisted-by: Claude:claude-opus-5-5 * refactor(logger): log sensor_gnss and vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(ekf2): fuse vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(replay): replay vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(local_position_estimator): read vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(attitude_estimator_q): read vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(lib/terrain_estimation): take sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(lib/wind_estimator): read vehicle_gnss in the replay script Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(vision_target_estimator): read vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(navigator): read vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(commander): read sensor_gnss and vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(mavlink): stream sensor_gnss and vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(uxrce_dds_client): bridge vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(zenoh): bridge vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(failure_injection): inject GNSS failures on sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/ins): publish sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/uavcan): publish sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/uavcannode): read sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/cyphal): bridge sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/telemetry): read vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/rc): read vehicle_gnss for telemetry Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/osd): read vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(drivers/transponder): read sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(boards/modalai): publish sensor_gnss from the voxl2 drivers Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(examples): publish sensor_gnss and read vehicle_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(simulation): publish sensor_gnss Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename. Assisted-by: Claude:claude-opus-5-5 * refactor(gnss): name GNSS variables gnss in the sensors module and receiver drivers GPS is one constellation. Identifiers that hold or handle GNSS samples, or bind to the renamed parameters, follow the message and parameter rename; classes, files, modules and names tied to parameters that keep GPS stay. Assisted-by: Claude:claude-opus-5-5 * refactor(gnss): name GNSS variables gnss in the estimators and navigator GPS is one constellation. Identifiers that hold or handle GNSS samples, or bind to the renamed parameters, follow the message and parameter rename; classes, files, modules and names tied to parameters that keep GPS stay. Assisted-by: Claude:claude-opus-5-5 * refactor(gnss): name GNSS variables gnss in commander, mavlink and failure injection GPS is one constellation. Identifiers that hold or handle GNSS samples, or bind to the renamed parameters, follow the message and parameter rename; classes, files, modules and names tied to parameters that keep GPS stay. Assisted-by: Claude:claude-opus-5-5 * refactor(gnss): name GNSS variables gnss in the remaining drivers and simulation GPS is one constellation. Identifiers that hold or handle GNSS samples, or bind to the renamed parameters, follow the message and parameter rename; classes, files, modules and names tied to parameters that keep GPS stay. Assisted-by: Claude:claude-opus-5-5 * docs(gnss): reference sensor_gnss, vehicle_gnss and SENS_GNSS* parameters The upgrade guide covers the topic, field, ROS 2, parameter and Cyphal register renames. Assisted-by: Claude:claude-opus-5-5 * fix(boards): name EKF2::UpdateGnssSample in the fmu-v6xrt ITCM lists The rename left the old UpdateGpsSample symbol in the lists, so the ITCM check fails and the function drops out of ITCM on the boards it doesn't check. Assisted-by: Claude:claude-opus-5-5 * chore(drivers/gps): bump PX4-GPSDrivers to the merged sensor_gnss rename The submodule pointed at the PX4-GPSDrivers#243 branch commit; #243 is merged. Assisted-by: Claude:claude-opus-5-5 * docs(msg): restore WGS84 in SensorGnss and point VehicleGlobalPosition at vehicle_gnss The rename dropped the only mention of the WGS84 datum and ellipsoid, and left VehicleGlobalPosition referring to the removed vehicle_gps_position topic. Assisted-by: Claude:claude-opus-5-5 * refactor(msg): drop selected_instance from VehicleGnss receiver.device_id already names the selected receiver, and 0 while blended. The sensor_gnss instance depends on the order drivers advertise at boot, so it doesn't identify a receiver across boots or logs, and nothing reads it. It would also be meaningless on the per-receiver VehicleGnss instances proposed in #28894. Assisted-by: Claude:claude-opus-5-5 * refactor(gnss): fuse vehicle_gnss.timestamp_sample directly and document the receiver's corrected time vehicle_gnss.timestamp is now the sensors module's publish time, so EKF2's check of timestamp_sample against it was always true; the sensors module always fills timestamp_sample. The message docs described receiver.timestamp_sample as the driver's uncorrected value, but the sensors module writes the corrected time into it as well. Assisted-by: Claude:claude-opus-5-5 * docs(msg): point VehicleGnss users at the top-level timestamp_sample uXRCE-DDS shifts only top-level timestamp and timestamp_sample into agent time, so receiver.timestamp_sample reaches ROS 2 on the PX4 boot clock even though it holds the same value on uORB. Assisted-by: Claude:claude-opus-5-5 * docs(releases): tell ROS 2 users which VehicleGnss timestamps to read Only top-level timestamps are converted to ROS time, so a port that reads receiver.timestamp gets the PX4 boot clock, and vehicle_gnss.timestamp is now the sensors module's publish time rather than the receiver's. Assisted-by: Claude:claude-opus-5-5 |