From d7e05b603735a694895ffc22fb65941e5fd4bc42 Mon Sep 17 00:00:00 2001 From: chobits tai Date: Mon, 17 Jun 2024 09:30:41 +0800 Subject: [PATCH] Copter: fix MAV_CMD_CONDITION_YAW with relative angle when WP_YAW_BEHAVIOR = 0 --- ArduCopter/autoyaw.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ArduCopter/autoyaw.cpp b/ArduCopter/autoyaw.cpp index 749a830f4d..287cb8e4f9 100644 --- a/ArduCopter/autoyaw.cpp +++ b/ArduCopter/autoyaw.cpp @@ -110,6 +110,9 @@ void Mode::AutoYaw::set_fixed_yaw(float angle_deg, float turn_rate_ds, int8_t di // calculate final angle as relative to vehicle heading or absolute if (relative_angle) { + if (_mode == Mode::HOLD) { + _yaw_angle_cd = copter.ahrs.yaw_sensor; + } _fixed_yaw_offset_cd = angle_deg * 100.0 * (direction >= 0 ? 1.0 : -1.0); } else { // absolute angle