feat(sensors/gnss): warn when a receiver's heading is dropped for missing setup (#29048)

GPS_YAW_OFFSET isn't migrated to SENS_GNSSn_HDG and the antenna positions, and the only sign of a dropped heading was a console line that said to set SENS_GNSSn_HDG even when only the positions were missing. A receiver reporting a valid heading was set up for one, so a QGC warning naming the missing setting reaches the people who upgraded.

Assisted-by: Claude:claude-opus-5-5
This commit is contained in:
Jacob Dahl authored and GitHub committed 2026-10-09 15:53:31 -06:00
1 parent b2f10e9c6e
commit de8d5e64c3
3 files changed
+34 -4

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ Please continue reading for [upgrade instructions](#upgrade-guide).
- **Flight controller firmware no longer embeds CAN node firmware.** The `px4_fmu-v5_uavcanv0periph` build, which carried CUAV CAN GPS v1 firmware in its ROMFS so the flight controller could update the GPS over DroneCAN, and the `CONFIG_BOARD_UAVCAN_PERIPHERALS` board option behind it have been removed. Use the standard `px4_fmu-v5_default` firmware and update the GPS from the SD card with `cuav_can-gps-v1_default.uavcan.bin` from the release instead; see [DroneCAN Firmware Update](../dronecan/index.md#firmware-update). ([PX4-Autopilot#28870](https://github.com/PX4/PX4-Autopilot/pull/28870))
- **jMAVSim has been removed.** `make px4_sitl jmavsim` and the `10017_jmavsim_iris` airframe (`SYS_AUTOSTART=10017`) no longer exist, and the setup scripts no longer install Java or `ant`. Use [SIH](../sim_sih/index.md) with the [Hawkeye](../sim_hawkeye/index.md) visualizer instead (`make px4_sitl_sih sihsim_quadx`), or [Gazebo](../sim_gazebo_gz/index.md).
- **Re-check motor failure handling on hexarotors.** [CA_FAILURE_MODE](../advanced_config/parameter_reference.md#CA_FAILURE_MODE) = `1` now also stops the motor opposite the failed one on a hexarotor (previously only the failed motor was removed from the allocation). Other airframes are unaffected, and `CA_FAILURE_MODE=0` (the default) is unchanged. See [Motor Failure Recovery](../config/motor_failure_recovery.md). ([PX4-Autopilot#28078](https://github.com/PX4/PX4-Autopilot/pull/28078))
- **Dual-antenna GNSS heading must be reconfigured.** `GPS_YAW_OFFSET`, `SEP_YAW_OFFS`, `SEP_PITCH_OFFS` and `EKF2_GPS_YAW_OFF` are removed, including on DroneCAN GNSS nodes, and are not migrated: GNSS yaw is not used until [SENS_GNSSn_HDG](../advanced_config/parameter_reference.md#SENS_GNSS0_HDG) is set on the autopilot for the receiver reporting the heading. The baseline comes from the antenna positions (`SENS_GNSSn_OFFX/Y/Z` of both receivers for a moving base, plus `SENS_GNSSn_AUXX/Y/Z` for the second antenna of a dual-antenna receiver), and headings whose reported baseline is more than 20% off it are rejected. See [GPS as Yaw/Heading Source](../gps_compass/rtk_gps.md#configuring-gps-as-yaw-heading-source). A DroneCAN node running older firmware still subtracts its own `GPS_YAW_OFFSET`; set that to 0. Heading is taken only from `sensor_gnss_relative` (u-blox, Unicore UM982, Septentrio, DroneCAN `RelPosHeading`): the Trimble MB-Two, Femtomes, NMEA `HDT`, SBG and MicroStrain headings and the heading in DroneCAN `Fix2` are no longer used, and the `heading`, `heading_offset` and `heading_accuracy` fields of `sensor_gps` are removed. ([PX4-Autopilot#27102](https://github.com/PX4/PX4-Autopilot/pull/27102))
- **Dual-antenna GNSS heading must be reconfigured.** `GPS_YAW_OFFSET`, `SEP_YAW_OFFS`, `SEP_PITCH_OFFS` and `EKF2_GPS_YAW_OFF` are removed, including on DroneCAN GNSS nodes, and are not migrated: GNSS yaw is not used until [SENS_GNSSn_HDG](../advanced_config/parameter_reference.md#SENS_GNSS0_HDG) is set on the autopilot for the receiver reporting the heading. Until then, a warning names what is missing: `SENS_GNSSn_HDG` or the antenna positions. The baseline comes from the antenna positions (`SENS_GNSSn_OFFX/Y/Z` of both receivers for a moving base, plus `SENS_GNSSn_AUXX/Y/Z` for the second antenna of a dual-antenna receiver), and headings whose reported baseline is more than 20% off it are rejected. See [GPS as Yaw/Heading Source](../gps_compass/rtk_gps.md#configuring-gps-as-yaw-heading-source). A DroneCAN node running older firmware still subtracts its own `GPS_YAW_OFFSET`; set that to 0. Heading is taken only from `sensor_gnss_relative` (u-blox, Unicore UM982, Septentrio, DroneCAN `RelPosHeading`): the Trimble MB-Two, Femtomes, NMEA `HDT`, SBG and MicroStrain headings and the heading in DroneCAN `Fix2` are no longer used, and the `heading`, `heading_offset` and `heading_accuracy` fields of `sensor_gps` are removed. ([PX4-Autopilot#27102](https://github.com/PX4/PX4-Autopilot/pull/27102))
- **GNSS topics, messages and parameters are renamed.**
The per-receiver topic `sensor_gps` is now `sensor_gnss` ([SensorGnss](../msg_docs/SensorGnss.md)).
`vehicle_gps_position` is now `vehicle_gnss` ([VehicleGnss](../msg_docs/VehicleGnss.md)), which nests the selected receiver's sample as `receiver` (for example `vehicle_gnss.receiver.latitude`) and adds the corrected `timestamp_sample` and `antenna_offset`.
@@ -33,6 +33,7 @@
#include "VehicleGPSPosition.hpp"
#include <px4_platform_common/events.h>
#include <px4_platform_common/log.h>
#include <lib/geo/geo.h>
#include <lib/drivers/device/Device.hpp>
@@ -185,6 +186,11 @@ void VehicleGPSPosition::ParametersUpdate(bool force)
_gnss_param_slots[i].heading_offset = atan2f(baselines[i](1), baselines[i](0));
}
_gnss_param_slots[0].heading_enabled = (_param_sens_gnss0_hdg.get() != static_cast<int32_t>
(gnss_heading::BaselineType::Disabled));
_gnss_param_slots[1].heading_enabled = (_param_sens_gnss1_hdg.get() != static_cast<int32_t>
(gnss_heading::BaselineType::Disabled));
#endif // CONFIG_SENSORS_VEHICLE_GNSS_HEADING
}
}
@@ -339,9 +345,31 @@ void VehicleGPSPosition::handleHeadingSample(const HeadingSample &sample, const
const bool configured = slot && (slot->baseline_length >= gnss_heading::kMinAntennaSeparation);
if (PX4_ISFINITE(sample.heading) && !configured && !_heading_unconfigured_reported) {
PX4_WARN("GNSS heading from %" PRIu32 " not used: set SENS_GNSSn_HDG", sample.device_id);
_heading_unconfigured_reported = true;
// A receiver that reports a valid heading was set up for one, so what's missing is the autopilot side, for example
// after an upgrade from GPS_YAW_OFFSET, which isn't migrated
if (PX4_ISFINITE(sample.heading) && !configured) {
if (!slot || !slot->heading_enabled) {
if (!_heading_unconfigured_reported) {
/* EVENT
* @description
* A receiver reports a dual antenna heading, but <param>SENS_GNSS0_HDG</param> or <param>SENS_GNSS1_HDG</param>
* is Disabled for its slot, or no SENS_GNSSn_ID matches it. Set SENS_GNSSn_HDG and the antenna positions.
*/
events::send(events::ID("sensors_gnss_heading_unconfigured"), events::Log::Warning,
"GPS heading not used: set SENS_GNSSn_HDG");
_heading_unconfigured_reported = true;
}
} else if (!_heading_no_baseline_reported) {
/* EVENT
* @description
* SENS_GNSSn_HDG is set, but the antenna positions it measures between are less than 5 cm apart.
* Set SENS_GNSSn_OFFX/Y/Z of both receivers for a moving base, or SENS_GNSSn_AUXX/Y/Z for a dual antenna receiver.
*/
events::send(events::ID("sensors_gnss_heading_no_baseline"), events::Log::Warning,
"GPS heading not used: set the antenna positions");
_heading_no_baseline_reported = true;
}
}
if (!PX4_ISFINITE(sample.heading) || !configured) {
@@ -96,6 +96,7 @@ private:
hrt_abstime delay_us{kDefaultDelay};
float baseline_length{0.f}; // of the antenna baseline the heading is measured along (m)
float heading_offset{0.f}; // yaw of the baseline in the body frame (rad)
bool heading_enabled{false}; // SENS_GNSSn_HDG isn't Disabled
};
// SENS_GNSSn_* slot for a receiver, by device_id or (when no IDs are configured) by sensor_gnss instance
@@ -159,6 +160,7 @@ private:
} _heading_source{};
bool _heading_unconfigured_reported{false};
bool _heading_no_baseline_reported{false};
#endif // CONFIG_SENSORS_VEHICLE_GNSS_HEADING
perf_counter_t _cycle_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")};