From 9b25102c2cdbbba5563cb50e0cd9712d1877fbe3 Mon Sep 17 00:00:00 2001 From: Andrii Anoshyn <116808454+anoshyn@users.noreply.github.com> Date: Wed, 27 May 2026 01:50:15 +0300 Subject: [PATCH] fix(mavlink): don't derive multicopter yaw from LOITER_TIME param4 (#27455) For MAV_CMD_NAV_LOITER_TIME the parser used param4 both as the loiter exit cross-track flag and as a multicopter yaw setpoint (wrap_2pi(radians(param4))). Per the MAVLink spec param4 only selects the loiter-circle exit behavior for forward-only vehicles and is not a yaw field, so a ground station following the spec (e.g. param4=1 to request a tangent exit) unintentionally forced a multicopter heading and could trip the yaw-reached timeout. Set yaw to NAN instead, so multicopters keep their current heading and no heading is enforced; get_yaw_to_be_accepted() already treats a non-finite yaw as reached. The exit cross-track flag is unchanged, and fixed-wing behavior is unaffected (yaw is always considered reached there). The download path already maps param4 to the exit cross-track flag, so it stays consistent. Fixes #27287 Signed-off-by: Andrii Anoshyn --- src/modules/mavlink/mavlink_mission.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/mavlink/mavlink_mission.cpp b/src/modules/mavlink/mavlink_mission.cpp index 601109653a6..3a2cf35594d 100644 --- a/src/modules/mavlink/mavlink_mission.cpp +++ b/src/modules/mavlink/mavlink_mission.cpp @@ -1464,9 +1464,10 @@ MavlinkMissionManager::parse_mavlink_mission_item(const mavlink_mission_item_t * mission_item->force_heading = (mavlink_mission_item->param2 > 0); mission_item->loiter_radius = mavlink_mission_item->param3; mission_item->loiter_exit_xtrack = (mavlink_mission_item->param4 > 0); - // Yaw is only valid for multicopter but we set it always because - // it's just ignored for fixedwing. - mission_item->yaw = wrap_2pi(math::radians(mavlink_mission_item->param4)); + // Per the MAVLink spec param4 selects the loiter-circle exit cross-track behavior + // (forward-only vehicles), not a yaw setpoint. Don't derive a heading from it, so + // multicopters keep their current heading instead of being forced to ~param4 degrees. + mission_item->yaw = NAN; break; case MAV_CMD_NAV_LAND: