mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-25 08:36:08 +08:00
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>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user