diff --git a/docs/en/releases/main.md b/docs/en/releases/main.md index f4722d7fdab..2446e8a9fe7 100644 --- a/docs/en/releases/main.md +++ b/docs/en/releases/main.md @@ -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`. diff --git a/src/modules/sensors/vehicle_gps_position/VehicleGPSPosition.cpp b/src/modules/sensors/vehicle_gps_position/VehicleGPSPosition.cpp index 26df13d786b..e17b35a3e75 100644 --- a/src/modules/sensors/vehicle_gps_position/VehicleGPSPosition.cpp +++ b/src/modules/sensors/vehicle_gps_position/VehicleGPSPosition.cpp @@ -33,6 +33,7 @@ #include "VehicleGPSPosition.hpp" +#include #include #include #include @@ -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 + (gnss_heading::BaselineType::Disabled)); + _gnss_param_slots[1].heading_enabled = (_param_sens_gnss1_hdg.get() != static_cast + (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 SENS_GNSS0_HDG or SENS_GNSS1_HDG + * 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) { diff --git a/src/modules/sensors/vehicle_gps_position/VehicleGPSPosition.hpp b/src/modules/sensors/vehicle_gps_position/VehicleGPSPosition.hpp index a5c60b9224c..83fb25ac0c2 100644 --- a/src/modules/sensors/vehicle_gps_position/VehicleGPSPosition.hpp +++ b/src/modules/sensors/vehicle_gps_position/VehicleGPSPosition.hpp @@ -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")};