Skip to content

Commit

Permalink
simulator: Use baro pressure direct from simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
priseborough authored and dagar committed Dec 21, 2017
1 parent 93d57c3 commit 603d950
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/simulator/simulator_mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ void Simulator::update_sensors(mavlink_hil_sensor_t *imu)
perf_begin(_perf_mag);

RawBaroData baro = {};
// calculate air pressure from altitude (valid for low altitude)
baro.pressure = (PRESS_GROUND - CONSTANTS_ONE_G * DENSITY * imu->pressure_alt) / 100.0f; // convert from Pa to mbar

// Get air pressure and pressure altitude
// valid for troposphere (below 11km AMSL)
baro.pressure = imu->abs_pressure;
baro.altitude = imu->pressure_alt;
baro.temperature = imu->temperature;

Expand Down

0 comments on commit 603d950

Please sign in to comment.