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 <anoshyn.andrii@gmail.com>
This commit is contained in:
Andrii Anoshyn authored and GitHub committed 2026-05-26 16:50:15 -06:00
1 parent 92f0836605
commit 9b25102c2c
1 file changed
+4 -3
+4 -3
View File
@@ -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: