From d0439ebef8c4f4353960182e0387b2d483fa7d4b Mon Sep 17 00:00:00 2001 From: Dimitris Date: Tue, 19 May 2026 09:48:36 +0300 Subject: [PATCH] fix(simulation): correct apparent wind sign and fixed-wing pitot model in SIH (#27376) * fix(simulation): correct apparent wind sign and fixed-wing pitot model in SIH * fix(simulation): simplify pitot model to always use body-x airspeed --------- Co-authored-by: 0xDI <0xDI@users.noreply.github.com> --- src/modules/simulation/simulator_sih/sih.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/simulation/simulator_sih/sih.cpp b/src/modules/simulation/simulator_sih/sih.cpp index befa63a584e..e46b7ec3571 100644 --- a/src/modules/simulation/simulator_sih/sih.cpp +++ b/src/modules/simulation/simulator_sih/sih.cpp @@ -625,7 +625,7 @@ void Sih::ecefToNed() // Transform velocity to NED frame _v_N = C_SE * _v_E; - _v_apparent_N = _v_N + _v_wind_N; + _v_apparent_N = _v_N - _v_wind_N; _q = Quatf(C_SE) * _q_E; _q.normalize(); @@ -669,8 +669,8 @@ void Sih::send_airspeed(const hrt_abstime &time_now_us) airspeed_s airspeed{}; airspeed.timestamp_sample = time_now_us; - // Assume the pitot tube always points against the wind to not have tailsitter edge cases - airspeed.true_airspeed_m_s = fmaxf(0.1f, _v_apparent_N.norm() + generate_wgn() * 0.2f); + // pitot tube measures forward (body-x) airspeed + airspeed.true_airspeed_m_s = fmaxf(0.1f, _v_B(0) + generate_wgn() * 0.2f); airspeed.indicated_airspeed_m_s = airspeed.true_airspeed_m_s * sqrtf(_wing_l.get_rho() / RHO); airspeed.confidence = 0.7f; airspeed.timestamp = hrt_absolute_time();