趣味で作ってるロボット用ソフトウェア
 All Classes Files Functions Enumerations Enumerator Friends Pages
Urg_driver.h
Go to the documentation of this file.
1 #ifndef HRK_URG_DRIVER_H
2 #define HRK_URG_DRIVER_H
3 
9 #include <memory>
10 #include "Lidar.h"
11 
12 
13 namespace hrk
14 {
15  class Urg_driver : public Lidar
16  {
17  public:
18  enum {
19  Default_baudrate = 115200,
20  Default_port = 10940,
21  };
22 
23  Urg_driver();
24  virtual ~Urg_driver();
25 
26  static std::vector<std::string> find_ports();
27  static bool is_urg_port(const std::string& port);
28 
29  const char* what() const;
30 
31  bool open(const std::string& device_name_or_ip_address,
32  long baudrate_or_port_number, connection_t type = Serial);
33  bool open(Connection* connection);
34 
35  bool is_booting();
36 
37  void close();
38  bool is_open() const;
39  void set_connection(Connection* connection);
41 
42  void set_timeout_msec(int msec);
43 
44  bool reboot();
45 
46  bool sleep();
47  void wakeup();
48 
49  bool start_measurement(measurement_t type = Distance,
50  int scan_times = Infinity_scan_times,
51  int skip_scan = 0);
52  bool get_distance(std::vector<long>& data, long *time_stamp = NULL);
53  bool get_distance_intensity(std::vector<long>& data,
54  std::vector<unsigned short>& intensity,
55  long *time_stamp = NULL);
56  bool get_multiecho(std::vector<long>& data_multiecho,
57  long* time_stamp = NULL);
58  bool get_multiecho_intensity(std::vector<long>& data_multiecho,
59  std::vector<unsigned short>&
60  intensity_multiecho,
61  long* time_stamp = NULL);
62  bool set_scanning_parameter(int first_step, int last_step,
63  int skip_step = 1);
64  void stop_measurement();
65  bool set_sensor_time_stamp(long time_stamp);
66 
67  double index2rad(int index) const;
68  double index2deg(int index) const;
69  int rad2index(double radian) const;
70  int deg2index(double degree) const;
71 
72  double step2rad(int step) const;
73  double step2deg(int step) const;
74  int rad2step(double radian) const;
75  int deg2step(double degree) const;
76 
77  int min_step() const;
78  int max_step() const;
79  int front_step() const;
80  int total_steps() const;
81  long min_distance() const;
82  long max_distance() const;
83  long scan_usec() const;
84  int max_data_size() const;
85  int max_echo_size() const;
86 
87  std::string sensor_series_name() const;
88  std::string sensor_product_name() const;
89  std::string sensor_product_version() const;
90  std::string serial_id() const;
91  static long decode_scip(const char* data, int data_byte);
92 
93  private:
94  Urg_driver(const Urg_driver& rhs);
95  Urg_driver& operator = (const Urg_driver& rhs);
96 
97  struct pImpl;
98  std::auto_ptr<pImpl> pimpl;
99  };
100 }
101 
102 #endif
Lidar インターフェース
bool is_booting()
センサが起動中かどうかを返す
Definition: Urg_driver.cpp:1219
bool is_open() const
接続しているかを返す
Definition: Urg_driver.cpp:1231
Lidar インターフェース
Definition: Lidar.h:18
const char * what() const
状態を示すメッセージを返す
Definition: Urg_driver.cpp:1196
Connection * connection()
接続オブジェクトを返す
Definition: Urg_driver.cpp:1244
void close()
接続を閉じる
Definition: Urg_driver.cpp:1225
シリアル接続クラス
Definition: Serial.h:18
距離
Definition: Lidar.h:31
接続のインターフェース
Definition: Connection.h:21
measurement_t
Definition: Lidar.h:30
Definition: Urg_driver.h:15
void set_connection(Connection *connection)
接続オブジェクトを設定する
Definition: Urg_driver.cpp:1237