趣味で作ってるロボット用ソフトウェア
 All Classes Files Functions Enumerations Enumerator Friends Pages
Lidar.h
Go to the documentation of this file.
1 #ifndef HRK_LIDAR_H
2 #define HRK_LIDAR_H
3 
9 #include <vector>
10 #include <string>
11 
12 
13 namespace hrk
14 {
15  class Connection;
16 
18  class Lidar
19  {
20  public:
21  enum {
22  Infinity_scan_times = -1,
23  };
24 
25  typedef enum {
26  Serial,
27  Ethernet,
28  } connection_t;
29 
30  typedef enum {
35  } measurement_t;
36 
37  virtual ~Lidar() {}
38 
44  virtual const char* what() const = 0;
45 
46  virtual bool open(const std::string& device_name_or_ip_address,
47  long baudrate_or_port_number,
48  connection_t type = Serial) = 0;
49  virtual bool open(Connection* connection) = 0;
50 
52  virtual void close() = 0;
53 
55  virtual bool is_booting() = 0;
56 
58  virtual bool is_open() const = 0;
59 
61  virtual void set_connection(Connection* connection) = 0;
62 
64  virtual Connection* connection() = 0;
65 
66  virtual bool start_measurement(measurement_t type = Distance,
67  int scan_times = Infinity_scan_times,
68  int skip_scan = 0) = 0;
69  virtual bool get_distance(std::vector<long>& data,
70  long *time_stamp) = 0;
71  virtual bool get_distance_intensity(std::vector<long>& data,
72  std::vector<unsigned short>&
73  intensity,
74  long *time_stamp) = 0;
75  virtual bool get_multiecho(std::vector<long>& data_multi,
76  long* time_stamp) = 0;
77  virtual bool get_multiecho_intensity(std::vector<long>& data_multiecho,
78  std::vector<unsigned short>&
79  intensity_multiecho,
80  long* time_stamp) = 0;
81  virtual bool set_scanning_parameter(int first_step, int last_step,
82  int skip_step) = 0;
83  virtual void stop_measurement() = 0;
84  virtual bool set_sensor_time_stamp(long time_stamp) = 0;
85 
86  virtual double index2rad(int index) const = 0;
87  virtual double index2deg(int index) const = 0;
88  virtual int rad2index(double radian) const = 0;
89  virtual int deg2index(double degree) const = 0;
90 
91  virtual double step2rad(int step) const = 0;
92  virtual double step2deg(int step) const = 0;
93  virtual int rad2step(double radian) const = 0;
94  virtual int deg2step(double degree) const = 0;
95 
96  virtual int min_step() const = 0;
97  virtual int max_step() const = 0;
98  virtual int front_step() const = 0;
99  virtual int total_steps() const = 0;
100  virtual long min_distance() const = 0;
101  virtual long max_distance() const = 0;
102  virtual long scan_usec() const = 0;
103  virtual int max_data_size() const = 0;
104  virtual int max_echo_size() const = 0;
105 
106  virtual std::string sensor_series_name() const = 0;
107  virtual std::string sensor_product_name() const = 0;
108  virtual std::string sensor_product_version() const = 0;
109  virtual std::string serial_id() const = 0;
110  };
111 }
112 
113 #endif
virtual bool is_booting()=0
センサが起動中かどうかを返す
Lidar インターフェース
Definition: Lidar.h:18
virtual void close()=0
接続を閉じる
virtual void set_connection(Connection *connection)=0
接続オブジェクトを設定する
シリアル接続クラス
Definition: Serial.h:18
距離
Definition: Lidar.h:31
virtual bool is_open() const =0
接続しているかを返す
measurement_t
Definition: Lidar.h:30
virtual const char * what() const =0
状態を示すメッセージを返す
距離 + 強度
Definition: Lidar.h:32
マルチエコーの距離
Definition: Lidar.h:33
virtual Connection * connection()=0
接続オブジェクトを返す
マルチエコーの(距離 + 強度)
Definition: Lidar.h:34