2013-09-28 05:40:29 -03:00
|
|
|
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
|
|
|
|
/*
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2016-02-17 21:25:14 -04:00
|
|
|
#pragma once
|
2013-09-28 05:40:29 -03:00
|
|
|
|
|
|
|
/*
|
2016-01-29 07:38:33 -04:00
|
|
|
backend driver for airspeed from PX4Firmware
|
2013-09-28 05:40:29 -03:00
|
|
|
*/
|
|
|
|
|
2015-08-11 03:28:42 -03:00
|
|
|
#include <AP_HAL/AP_HAL.h>
|
2016-06-08 21:10:54 -03:00
|
|
|
#include <AP_Param/AP_Param.h>
|
2015-08-11 03:28:42 -03:00
|
|
|
#include "AP_Airspeed_Backend.h"
|
2013-09-28 05:40:29 -03:00
|
|
|
|
|
|
|
class AP_Airspeed_PX4 : public AP_Airspeed_Backend {
|
|
|
|
public:
|
|
|
|
// constructor
|
2016-06-08 21:10:54 -03:00
|
|
|
AP_Airspeed_PX4(const AP_Float &psi_range) :
|
|
|
|
_psi_range(psi_range) {}
|
2013-09-28 05:40:29 -03:00
|
|
|
|
|
|
|
// probe and initialise the sensor
|
|
|
|
bool init(void);
|
|
|
|
|
|
|
|
// return the current differential_pressure in Pascal
|
|
|
|
bool get_differential_pressure(float &pressure);
|
|
|
|
|
|
|
|
// return the current temperature in degrees C, if available
|
|
|
|
bool get_temperature(float &temperature);
|
|
|
|
|
|
|
|
private:
|
2016-06-08 21:10:54 -03:00
|
|
|
int _fd = -1;
|
2013-09-28 05:40:29 -03:00
|
|
|
uint64_t _last_timestamp;
|
|
|
|
float _temperature;
|
2016-06-08 21:10:54 -03:00
|
|
|
const AP_Float &_psi_range;
|
2013-09-28 05:40:29 -03:00
|
|
|
};
|