Path: blob/master/libraries/AP_Airspeed/AP_Airspeed_SITL.cpp
9674 views
#include "AP_Airspeed_SITL.h"12#if AP_AIRSPEED_SITL_ENABLED34#include <AP_Baro/AP_Baro.h>5#include <SITL/SITL.h>67// return the current differential_pressure in Pascal8bool AP_Airspeed_SITL::get_differential_pressure(float &pressure)9{10const uint8_t _instance = get_instance();1112if (_instance >= AIRSPEED_MAX_SENSORS) {13return false;14}1516pressure = AP::sitl()->state.airspeed_raw_pressure[_instance];1718return true;19}2021// get last temperature22bool AP_Airspeed_SITL::get_temperature(float &temperature)23{24const uint8_t _instance = get_instance();2526if (_instance >= AIRSPEED_MAX_SENSORS) {27return false;28}2930const auto *sitl = AP::sitl();3132// this was mostly swiped from SIM_Airspeed_DLVR:33const float sim_alt = sitl->state.altitude;3435// To Do: Add a sensor board temperature offset parameter36temperature = AP_Baro::get_temperatureC_for_alt_amsl(sim_alt);3738return true;39}4041#endif // AP_AIRSPEED_SITL_ENABLED424344