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