From fca3df865af36124a28c9d607e850f111dbaaea9 Mon Sep 17 00:00:00 2001 From: UnderMind0x41 <71922334+UnderMind0x41@users.noreply.github.com> Date: Thu, 10 Sep 2026 15:42:20 +0700 Subject: [PATCH] fix(fw_lat_lon_control): use tailsitter fixed-wing heading (#28656) Use the fixed-wing-frame yaw already computed from vehicle attitude for the no-wind heading and track quality check. Use the same adapted yaw when capturing the no-position backtransition heading. Assisted-by: Codex:gpt-5 Signed-off-by: Kirill Co-authored-by: Kirill (cherry picked from commit 3599328bae4bd986d861499f6528b3c523128331) --- .../FwLateralLongitudinalControl.cpp | 2 +- src/modules/fw_mode_manager/FixedWingModeManager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp index 40d4fa08fbd..018d4b9e33b 100644 --- a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp +++ b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp @@ -754,7 +754,7 @@ float FwLateralLongitudinalControl::getGuidanceQualityFactor(const vehicle_local 0.f, 1.f)); // Check that the angle between heading and track is not off too much. if it is greater than 90° we will be pushed back from the wind and the npfg will propably give a roll command in the wrong direction. - const Vector2f heading_vector(matrix::Dcm2f(local_pos.heading)*Vector2f({1.f, 0.f})); + const Vector2f heading_vector(matrix::Dcm2f(_yaw)*Vector2f({1.f, 0.f})); const Vector2f ground_vel_norm(ground_vel.normalized()); const float flying_forward_factor(math::constrain((heading_vector.dot(ground_vel_norm) - COS_HEADING_TRACK_ANGLE_PUSHED_BACK) / ((COS_HEADING_TRACK_ANGLE_NOT_PUSHED_BACK - diff --git a/src/modules/fw_mode_manager/FixedWingModeManager.cpp b/src/modules/fw_mode_manager/FixedWingModeManager.cpp index b69330a5e79..41af5d102f4 100644 --- a/src/modules/fw_mode_manager/FixedWingModeManager.cpp +++ b/src/modules/fw_mode_manager/FixedWingModeManager.cpp @@ -1989,7 +1989,7 @@ float FixedWingModeManager::rollAngleToLateralAccel(float roll_body) const void FixedWingModeManager::control_backtransition_heading_hold() { if (!PX4_ISFINITE(_backtrans_heading)) { - _backtrans_heading = _local_pos.heading; + _backtrans_heading = _yaw; } fixed_wing_lateral_setpoint_s fw_lateral_ctrl_sp{empty_lateral_control_setpoint};