From a8435fcc60c31afbc3ba4314cce881e67ce7036d Mon Sep 17 00:00:00 2001 From: Balduin Date: Mon, 13 Jan 2025 15:41:47 +0100 Subject: [PATCH] fix sign error in appropriate place In PR https://github.com/PX4/PX4-Autopilot/pull/24175 I changed the control surface deflection signs in generate_fw_aerodynamics to make the 1103 airframe work correctly. However, this breaks the 1101 airframe, introducing sing errors there. So, here the change in generate_fw_aerodynamics is reverted to the state before PR #24175. Instead, the signs are set correctly by using the HIL_ACT_REV bitfield in the respective airframe config files. --- ROMFS/px4fmu_common/init.d/airframes/1101_rc_plane_sih.hil | 1 - .../init.d/airframes/1103_standard_vtol_sih.hil | 2 +- src/modules/simulation/simulator_sih/sih.cpp | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/airframes/1101_rc_plane_sih.hil b/ROMFS/px4fmu_common/init.d/airframes/1101_rc_plane_sih.hil index 2bcfc14a2e03..31de322a66fd 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/1101_rc_plane_sih.hil +++ b/ROMFS/px4fmu_common/init.d/airframes/1101_rc_plane_sih.hil @@ -25,7 +25,6 @@ param set-default CA_SV_CS1_TYPE 3 param set-default CA_SV_CS2_TRQ_Y 1 param set-default CA_SV_CS2_TYPE 4 -param set HIL_ACT_REV 1 param set HIL_ACT_FUNC1 201 param set HIL_ACT_FUNC2 202 param set HIL_ACT_FUNC3 203 diff --git a/ROMFS/px4fmu_common/init.d/airframes/1103_standard_vtol_sih.hil b/ROMFS/px4fmu_common/init.d/airframes/1103_standard_vtol_sih.hil index c67cf2cc85f0..99d25b6f9e18 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/1103_standard_vtol_sih.hil +++ b/ROMFS/px4fmu_common/init.d/airframes/1103_standard_vtol_sih.hil @@ -54,7 +54,7 @@ param set-default CA_SV_CS1_TRQ_P 1 param set-default CA_SV_CS1_TYPE 3 param set-default CA_SV_CS2_TRQ_Y 1 -param set HIL_ACT_REV 32 +param set HIL_ACT_REV 16 param set-default FW_AIRSPD_MAX 12 param set-default FW_AIRSPD_MIN 7 diff --git a/src/modules/simulation/simulator_sih/sih.cpp b/src/modules/simulation/simulator_sih/sih.cpp index f90805dd660e..1b114b7f582f 100644 --- a/src/modules/simulation/simulator_sih/sih.cpp +++ b/src/modules/simulation/simulator_sih/sih.cpp @@ -358,10 +358,10 @@ void Sih::generate_fw_aerodynamics(const float roll_cmd, const float pitch_cmd, const Vector3f v_B = _q_E.rotateVectorInverse(_v_E); const float &alt = _lla.altitude(); - _wing_l.update_aero(v_B, _w_B, alt, roll_cmd * FLAP_MAX); - _wing_r.update_aero(v_B, _w_B, alt, -roll_cmd * FLAP_MAX); + _wing_l.update_aero(v_B, _w_B, alt, -roll_cmd * FLAP_MAX); + _wing_r.update_aero(v_B, _w_B, alt, roll_cmd * FLAP_MAX); - _tailplane.update_aero(v_B, _w_B, alt, pitch_cmd * FLAP_MAX, _T_MAX * throttle_cmd); + _tailplane.update_aero(v_B, _w_B, alt, -pitch_cmd * FLAP_MAX, _T_MAX * throttle_cmd); _fin.update_aero(v_B, _w_B, alt, yaw_cmd * FLAP_MAX, _T_MAX * throttle_cmd); _fuselage.update_aero(v_B, _w_B, alt);