APM:Libraries
AP_Proximity_TeraRangerTower.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "AP_Proximity.h"
4 #include "AP_Proximity_Backend.h"
5 
6 #define PROXIMITY_TRTOWER_TIMEOUT_MS 300 // requests timeout after 0.3 seconds
7 
9 {
10 
11 public:
12  // constructor
14 
15  // static detection function
16  static bool detect(AP_SerialManager &serial_manager);
17 
18  // update state
19  void update(void);
20 
21  // get maximum and minimum distances (in meters) of sensor
22  float distance_max() const;
23  float distance_min() const;
24 
25 private:
26 
27  // check and process replies from sensor
28  bool read_sensor_data();
29  void update_sector_data(int16_t angle_deg, uint16_t distance_cm);
30  uint16_t process_distance(uint8_t buf1, uint8_t buf2);
31 
32  // reply related variables
34  uint8_t buffer[20]; // buffer where to store data from serial
35  uint8_t buffer_count;
36 
37  // request related variables
38  uint32_t _last_distance_received_ms; // system time of last distance measurement received from sensor
39 };
static AP_SerialManager serial_manager
Definition: AHRS_Test.cpp:24
void update_sector_data(int16_t angle_deg, uint16_t distance_cm)
uint16_t process_distance(uint8_t buf1, uint8_t buf2)
AP_Proximity_TeraRangerTower(AP_Proximity &_frontend, AP_Proximity::Proximity_State &_state, AP_SerialManager &serial_manager)
static bool detect(AP_SerialManager &serial_manager)