AP_RangeFinder_Lanbao.h 781 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include "RangeFinder.h"
  3. #include "RangeFinder_Backend.h"
  4. class AP_RangeFinder_Lanbao : public AP_RangeFinder_Backend
  5. {
  6. public:
  7. // constructor
  8. AP_RangeFinder_Lanbao(RangeFinder::RangeFinder_State &_state,
  9. AP_RangeFinder_Params &_params,
  10. uint8_t serial_instance);
  11. // static detection function
  12. static bool detect(uint8_t serial_instance);
  13. // update state
  14. void update(void) override;
  15. protected:
  16. virtual MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
  17. return MAV_DISTANCE_SENSOR_LASER;
  18. }
  19. private:
  20. // get a reading
  21. bool get_reading(uint16_t &reading_cm);
  22. AP_HAL::UARTDriver *uart = nullptr;
  23. uint8_t buf[6];
  24. uint8_t buf_len = 0;
  25. };