navigator: RTL: fix idle setpoint on activation (#26537)

When switching modes, navigator resets the position setpoint triplet to
idle. In the case of entering RTL, it is not replaced immediately by the
correct triplet, but published once and only corrected a split second
later. This causes zero thrust to come from control_idle in
FixedWingModeManager

Fix by calling run(true) on the appropriate sub-mode at the end of
RTL::on_activation(), same as in the on_active just below.

The submode is in inactive at that point, but run(true) triggers:
 - on_activation of the submode
 - set_rtl_item, which calls:
     - mission_item_to_position_setpoint
     - _navigator->set_position_setpoint_triplet_updated

and therefore the navigator publishes the position setpoint triplet
immediately (which was already being correctly set).

Navigator: RTL: also update subs on actiavation

Navigator: RTL: also disable mission RTL if direct RTL

matching the logic in on_active exactly
This commit is contained in:
Balduin 2026-02-20 14:51:51 +01:00 committed by GitHub
parent 8602849847
commit 918efc8f97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -220,6 +220,12 @@ void RTL::publishRemainingTimeEstimate()
void RTL::on_activation()
{
_global_pos_sub.update();
_vehicle_status_sub.update();
_mission_sub.update();
_home_pos_sub.update();
_wind_sub.update();
setRtlTypeAndDestination();
switch (_rtl_type) {
@ -228,12 +234,21 @@ void RTL::on_activation()
case RtlType::RTL_MISSION_FAST_REVERSE:
if (_rtl_mission_type_handle) {
_rtl_mission_type_handle->setReturnAltMin(_enforce_rtl_alt);
_rtl_mission_type_handle->run(true);
}
_rtl_direct.run(false);
break;
case RtlType::RTL_DIRECT:
_rtl_direct.setReturnAltMin(_enforce_rtl_alt);
_rtl_direct.run(true);
if (_rtl_mission_type_handle) {
_rtl_mission_type_handle->run(false);
}
break;
default: