2016-04-19 18:32:17 -03:00
|
|
|
#pragma once
|
|
|
|
|
2023-07-06 01:25:14 -03:00
|
|
|
#include "AP_RangeFinder_config.h"
|
2022-03-12 06:37:29 -04:00
|
|
|
|
|
|
|
#if AP_RANGEFINDER_MAXBOTIX_SERIAL_ENABLED
|
|
|
|
|
2023-07-06 01:25:14 -03:00
|
|
|
#include "AP_RangeFinder.h"
|
|
|
|
#include "AP_RangeFinder_Backend_Serial.h"
|
|
|
|
|
2019-11-01 03:29:03 -03:00
|
|
|
class AP_RangeFinder_MaxsonarSerialLV : public AP_RangeFinder_Backend_Serial
|
2016-04-19 18:32:17 -03:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2022-06-22 08:03:22 -03:00
|
|
|
static AP_RangeFinder_Backend_Serial *create(
|
|
|
|
RangeFinder::RangeFinder_State &_state,
|
|
|
|
AP_RangeFinder_Params &_params) {
|
|
|
|
return new AP_RangeFinder_MaxsonarSerialLV(_state, _params);
|
|
|
|
}
|
2019-11-01 04:03:17 -03:00
|
|
|
|
2017-08-08 04:32:53 -03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
|
|
|
|
return MAV_DISTANCE_SENSOR_ULTRASOUND;
|
|
|
|
}
|
|
|
|
|
2016-04-19 18:32:17 -03:00
|
|
|
private:
|
2022-06-22 08:03:22 -03:00
|
|
|
|
|
|
|
AP_RangeFinder_MaxsonarSerialLV(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params);
|
|
|
|
|
2016-04-19 18:32:17 -03:00
|
|
|
// get a reading
|
2021-10-18 02:45:33 -03:00
|
|
|
bool get_reading(float &reading_m) override;
|
2016-04-19 18:32:17 -03:00
|
|
|
|
2019-11-01 08:00:04 -03:00
|
|
|
uint16_t read_timeout_ms() const override { return 500; }
|
|
|
|
|
2016-04-19 18:32:17 -03:00
|
|
|
char linebuf[10];
|
|
|
|
uint8_t linebuf_len = 0;
|
|
|
|
};
|
2022-03-12 06:37:29 -04:00
|
|
|
|
|
|
|
#endif // AP_RANGEFINDER_MAXBOTIX_SERIAL_ENABLED
|