fix(mavlink): report missing Return time estimates as unknown (#29685)

Assisted-by: Claude:claude-opus-5-5
This commit is contained in:
Jonas Perolini authored and GitHub committed 2026-11-08 16:18:35 +01:00
1 parent 5dc8ab048f
commit caf75ad3c1
6 files changed
+8 -3

No files matched your search

+1
View File
@@ -139,6 +139,7 @@ The remaining flight time comes from the battery:
Without a remaining flight time estimate, the distance-aware return failsafe never triggers, and there is no warning either.
This is the case if `BATn_CAPACITY` is not set (the default is `-1`), if a DroneCAN battery sends only `BatteryInfo`, or if a MAVLink battery does not fill in `time_remaining`.
This also applies when there is no valid home position or global position estimate.
It also never triggers with [RTL_TYPE](../advanced_config/parameter_reference.md#RTL_TYPE) = 2 or 4 while a valid mission is loaded: these Return types do not estimate the time to follow the mission.
The vehicle is then only protected by the [battery level failsafe](#battery-level-failsafe).
:::
+2
View File
@@ -173,6 +173,8 @@ Please continue reading for [upgrade instructions](#upgrade-guide).
- ESC/motor health is now reported in [SYS_STATUS](https://mavlink.io/en/messages/common.html#SYS_STATUS) using the [MAV_SYS_STATUS_SENSOR_PROPULSION](https://mavlink.io/en/messages/common.html#MAV_SYS_STATUS_SENSOR_PROPULSION) bit instead of [MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS](https://mavlink.io/en/messages/common.html#MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS).
([PX4-Autopilot#29192](https://github.com/PX4/PX4-Autopilot/pull/29192)).
- [SYS_STATUS](https://mavlink.io/en/messages/common.html#SYS_STATUS) now sets the [MAV_SYS_STATUS_EXTENSION_USED](https://mavlink.io/en/messages/common.html#MAV_SYS_STATUS_EXTENSION_USED) flag in `onboard_control_sensors_present` when extended sensor fields are used.
- [TIME_ESTIMATE_TO_TARGET](https://mavlink.io/en/messages/common.html#TIME_ESTIMATE_TO_TARGET) reports `safe_return` as `-1` (landed or no estimate) when Return has no time estimate: before Home is set, on the ground unless Return would follow a mission landing, and with [RTL_TYPE](../advanced_config/parameter_reference.md#RTL_TYPE) = 2 or 4 and a valid mission.
It used to send `0`, or an undefined value with `RTL_TYPE` 2 and 4.
### RC
@@ -64,7 +64,8 @@ private:
_rtl_estimate_sub.copy(&rtl_estimate);
mavlink_time_estimate_to_target_t msg{};
msg.safe_return = static_cast<int32_t>(rtl_estimate.safe_time_estimate);
// MAVLink uses -1 when there is no estimate
msg.safe_return = rtl_estimate.valid ? static_cast<int32_t>(rtl_estimate.safe_time_estimate) : -1;
// Set to -1 explicitly because not supported (yet)
msg.land = -1;
+1
View File
@@ -130,6 +130,7 @@ void RTL::publishRemainingTimeEstimate()
}
}
estimated_time.timestamp = hrt_absolute_time();
_rtl_time_estimate_pub.publish(estimated_time);
}
+1 -1
View File
@@ -212,7 +212,7 @@ void RtlMissionFast::setActiveMissionItems()
rtl_time_estimate_s RtlMissionFast::calc_rtl_time_estimate()
{
rtl_time_estimate_s time_estimate;
rtl_time_estimate_s time_estimate{};
time_estimate.valid = false;
time_estimate.timestamp = hrt_absolute_time();
@@ -296,7 +296,7 @@ void RtlMissionFastReverse::handleLanding(WorkItemType &new_work_item_type)
rtl_time_estimate_s RtlMissionFastReverse::calc_rtl_time_estimate()
{
rtl_time_estimate_s time_estimate;
rtl_time_estimate_s time_estimate{};
time_estimate.valid = false;
time_estimate.timestamp = hrt_absolute_time();