2018-05-25 22:59:36 -03:00
|
|
|
#pragma once
|
|
|
|
|
2019-11-10 22:47:38 -04:00
|
|
|
#include "AP_RangeFinder.h"
|
|
|
|
#include "AP_RangeFinder_Backend_Serial.h"
|
2018-05-25 22:59:36 -03:00
|
|
|
|
2019-11-01 04:03:17 -03:00
|
|
|
class AP_RangeFinder_Benewake : public AP_RangeFinder_Backend_Serial
|
2018-05-25 22:59:36 -03:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2019-11-01 04:03:17 -03:00
|
|
|
using AP_RangeFinder_Backend_Serial::AP_RangeFinder_Backend_Serial;
|
2018-05-25 22:59:36 -03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
|
|
|
|
return MAV_DISTANCE_SENSOR_LASER;
|
|
|
|
}
|
|
|
|
|
2019-11-01 04:03:17 -03:00
|
|
|
virtual float model_dist_max_cm() const = 0;
|
|
|
|
virtual bool has_signal_byte() const { return false; }
|
|
|
|
|
2018-05-25 22:59:36 -03:00
|
|
|
private:
|
|
|
|
|
|
|
|
// get a reading
|
2018-11-07 21:04:03 -04:00
|
|
|
// distance returned in reading_cm
|
2019-11-01 07:59:50 -03:00
|
|
|
bool get_reading(uint16_t &reading_cm) override;
|
2018-05-25 22:59:36 -03:00
|
|
|
|
2018-11-18 21:31:24 -04:00
|
|
|
uint8_t linebuf[10];
|
2018-05-25 22:59:36 -03:00
|
|
|
uint8_t linebuf_len;
|
|
|
|
};
|