From 0c28c677c60c8c39415617de2941bbfe06caa6e7 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Thu, 5 Nov 2026 14:27:06 +0100 Subject: [PATCH] fix(navigator): MIS_YAW_TMT 0 means don't wait --- docs/en/flight_modes_mc/mission.md | 2 +- docs/en/releases/main.md | 1 + src/modules/navigator/mission_block.cpp | 2 +- src/modules/navigator/mission_params.yaml | 2 +- src/modules/navigator/test/test_mission_block_yaw.cpp | 7 +++++++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/en/flight_modes_mc/mission.md b/docs/en/flight_modes_mc/mission.md index 95379306700..bb1a9735b1e 100644 --- a/docs/en/flight_modes_mc/mission.md +++ b/docs/en/flight_modes_mc/mission.md @@ -233,7 +233,7 @@ If getting to the waypoint takes longer than `MIS_YAW_TMT`, the vehicle does not Some headings must be reached for the mission to continue safely, such as the alignment towards the next waypoint before a mission with camera triggering is resumed. If such a heading is not reached within `MIS_YAW_TMT`, the mission fails and the vehicle switches to [Return mode](../flight_modes_mc/return.md). -Set `MIS_YAW_TMT` to -1 to always wait for the heading. +Set `MIS_YAW_TMT` to 0 to never wait for a heading, or to -1 to always wait for it. ## Rounded turns: Inter-Waypoint Trajectory diff --git a/docs/en/releases/main.md b/docs/en/releases/main.md index 3451e2b0766..21a2522e20d 100644 --- a/docs/en/releases/main.md +++ b/docs/en/releases/main.md @@ -70,6 +70,7 @@ Please continue reading for [upgrade instructions](#upgrade-guide). The meaning of parameter values changes: - Multicopters with `MIS_YAW_TMT` set above `0` used to skip all headings that the mission does not require. They now wait for them for up to `MIS_YAW_TMT`. - VTOL vehicles in multicopter mode now always skip headings that the mission does not require, even with `MIS_YAW_TMT` set to `-1`. + - `MIS_YAW_TMT` set to `0` used to wait indefinitely, like `-1`. It now means not to wait. - Set `MIS_YAW_TMT` to `-1` to keep waiting indefinitely for headings that are awaited. See [Mission Mode > Waypoint Heading Timeout](../flight_modes_mc/mission.md#waypoint-heading-timeout). diff --git a/src/modules/navigator/mission_block.cpp b/src/modules/navigator/mission_block.cpp index 01121af2312..df66cafc12c 100644 --- a/src/modules/navigator/mission_block.cpp +++ b/src/modules/navigator/mission_block.cpp @@ -410,7 +410,7 @@ MissionBlock::is_mission_item_reached_or_completed() && _navigator->get_local_position()->heading_good_for_control) { const float yaw_err = wrap_pi(_mission_item.yaw - _navigator->get_local_position()->heading); - const bool yaw_timed_out = (_navigator->get_yaw_timeout() >= FLT_EPSILON) + const bool yaw_timed_out = (_navigator->get_yaw_timeout() >= 0.f) // negative disables the timeout && (now > _time_item_started + (hrt_abstime)(_navigator->get_yaw_timeout() * 1_s)); // Accept yaw if reached, VTOLs only care about forced headings diff --git a/src/modules/navigator/mission_params.yaml b/src/modules/navigator/mission_params.yaml index 570f0fa3994..c4a1096f73e 100644 --- a/src/modules/navigator/mission_params.yaml +++ b/src/modules/navigator/mission_params.yaml @@ -69,7 +69,7 @@ parameters: A forced heading (e.g. before a VTOL transition) is never skipped: a mission fails instead, other modes keep waiting. VTOLs only wait for forced headings. - -1: wait indefinitely + 0: don't wait, -1: wait indefinitely type: float default: 10.0 unit: s diff --git a/src/modules/navigator/test/test_mission_block_yaw.cpp b/src/modules/navigator/test/test_mission_block_yaw.cpp index 735eff939dc..88525565620 100644 --- a/src/modules/navigator/test/test_mission_block_yaw.cpp +++ b/src/modules/navigator/test/test_mission_block_yaw.cpp @@ -284,6 +284,13 @@ TEST_F(MissionBlockYawTest, DisabledTimeoutWaitsIndefinitely) EXPECT_FALSE(_block.reached()); } +TEST_F(MissionBlockYawTest, ZeroTimeoutDoesNotWait) +{ + setYawTimeout(0.f); + _block.reached(); // first check is when the heading got commanded + EXPECT_TRUE(_block.reached()); +} + TEST_F(MissionBlockYawTest, ResetRestartsTimeout) { EXPECT_FALSE(_block.reached());