2018-05-25 22:59:36 -03:00
|
|
|
#pragma once
|
|
|
|
|
2019-11-10 22:47:38 -04:00
|
|
|
#include "AP_RangeFinder.h"
|
2022-03-12 06:37:29 -04:00
|
|
|
|
|
|
|
#ifndef AP_RANGEFINDER_BENEWAKE_ENABLED
|
|
|
|
#define AP_RANGEFINDER_BENEWAKE_ENABLED AP_RANGEFINDER_ENABLED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if AP_RANGEFINDER_BENEWAKE_ENABLED
|
|
|
|
|
2019-11-10 22:47:38 -04:00
|
|
|
#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
|
2021-10-18 02:45:33 -03:00
|
|
|
// distance returned in reading_m
|
|
|
|
bool get_reading(float &reading_m) 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;
|
|
|
|
};
|
2022-03-12 06:37:29 -04:00
|
|
|
|
|
|
|
#endif // AP_RANGEFINDER_BENEWAKE_ENABLED
|