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
  • Loading branch information
eppravitra committed Jul 7, 2024
1 parent 9c81759 commit 5093f4e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libraries/SITL/SIM_JSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +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;
velocity_air_bf = dcm.transposed() * velocity_air_ef;

// airspeed
airspeed = velocity_air_bf.length();
Expand Down

0 comments on commit 5093f4e

Please sign in to comment.