Skip to content

Commit

Permalink
SITL: fix json airspeed
Browse files Browse the repository at this point in the history
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 <[email protected]>
Update libraries/SITL/SIM_JSON.cpp

Co-authored-by: Peter Hall <[email protected]>

comment changes

remove redundant airspeed calculation
  • Loading branch information
eppravitra authored and peterbarker committed Jul 9, 2024
1 parent 9924462 commit f3d55d8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions libraries/SITL/SIM_JSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,15 @@ void JSON::recv_fdm(const struct sitl_input &input)

airspeed_pitot = state.airspeed;
} else {
// velocity relative to airmass in body frame
velocity_air_bf = dcm.transposed() * velocity_ef;

// wind is not supported yet for JSON sim, assume zero for now
wind_ef.zero();

// airspeed
airspeed = velocity_air_bf.length();
// velocity relative to airmass in Earth's frame
velocity_air_ef = velocity_ef - wind_ef;

// 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 relative to airmass in body frame
velocity_air_bf = dcm.transposed() * velocity_air_ef;

// airspeed fix for eas2tas
update_eas_airspeed();
Expand Down

0 comments on commit f3d55d8

Please sign in to comment.