Browse Source

AP_Airspeed: expose raw pressure for logging

mission-4.1.18
Andrew Tridgell 10 years ago
parent
commit
9c631944f7
  1. 3
      libraries/AP_Airspeed/AP_Airspeed.cpp
  2. 14
      libraries/AP_Airspeed/AP_Airspeed.h

3
libraries/AP_Airspeed/AP_Airspeed.cpp

@ -208,6 +208,9 @@ void AP_Airspeed::read(void)
} }
airspeed_pressure = get_pressure() - _offset; airspeed_pressure = get_pressure() - _offset;
// remember raw pressure for logging
_raw_pressure = airspeed_pressure;
/* /*
we support different pitot tube setups so used can choose if we support different pitot tube setups so used can choose if
they want to be able to detect pressure on the static port they want to be able to detect pressure on the static port

14
libraries/AP_Airspeed/AP_Airspeed.h

@ -44,6 +44,7 @@ public:
_raw_airspeed(0.0f), _raw_airspeed(0.0f),
_airspeed(0.0f), _airspeed(0.0f),
_last_pressure(0.0f), _last_pressure(0.0f),
_raw_pressure(0.0f),
_EAS2TAS(1.0f), _EAS2TAS(1.0f),
_healthy(false), _healthy(false),
_hil_set(false), _hil_set(false),
@ -116,7 +117,17 @@ public:
// return the differential pressure in Pascal for the last // return the differential pressure in Pascal for the last
// airspeed reading. Used by the calibration code // airspeed reading. Used by the calibration code
float get_differential_pressure(void) const { float get_differential_pressure(void) const {
return max(_last_pressure, 0); return _last_pressure;
}
// return the current offset
float get_offset(void) const {
return _offset;
}
// return the current raw pressure
float get_raw_pressure(void) const {
return _raw_pressure;
} }
// set the apparent to true airspeed ratio // set the apparent to true airspeed ratio
@ -162,6 +173,7 @@ private:
float _raw_airspeed; float _raw_airspeed;
float _airspeed; float _airspeed;
float _last_pressure; float _last_pressure;
float _raw_pressure;
float _EAS2TAS; float _EAS2TAS;
bool _healthy:1; bool _healthy:1;
bool _hil_set:1; bool _hil_set:1;

Loading…
Cancel
Save