SITL: fix json airspeed

Airspeed calculation for JSON was not quite working because velocity_air_ef was not updated in SIM_JSON.cpp

Update libraries/SITL/SIM_JSON.cpp

Co-authored-by: Peter Hall <33176108+IamPete1@users.noreply.github.com>
Update libraries/SITL/SIM_JSON.cpp

Co-authored-by: Peter Hall <33176108+IamPete1@users.noreply.github.com>

comment changes

remove redundant airspeed calculation
This commit is contained in:
Ep Pravitra 2024-07-07 09:36:33 +07:00 committed by Peter Barker
parent 9924462618
commit f3d55d821e

View File

@ -323,14 +323,15 @@ void JSON::recv_fdm(const struct sitl_input &input)
airspeed_pitot = state.airspeed;
} else {
// wind is not supported yet for JSON sim, assume zero for now
wind_ef.zero();
// velocity relative to airmass in Earth's frame
velocity_air_ef = velocity_ef - wind_ef;
// velocity relative to airmass in body frame
velocity_air_bf = dcm.transposed() * velocity_ef;
// airspeed
airspeed = velocity_air_bf.length();
// airspeed as seen by a fwd pitot tube (limited to 120m/s)
airspeed_pitot = constrain_float(velocity_air_bf * Vector3f(1.0f, 0.0f, 0.0f), 0.0f, 120.0f);
velocity_air_bf = dcm.transposed() * velocity_air_ef;
// airspeed fix for eas2tas
update_eas_airspeed();