説明を見る。00001 #ifndef QRK_URG_DRIVER_H
00002 #define QRK_URG_DRIVER_H
00003
00016 #include <memory>
00017 #include <string>
00018 #include "Lidar.h"
00019
00020 namespace qrk
00021 {
00023 class Urg_driver : public Lidar
00024 {
00025 public:
00026 enum {
00027 Default_baudrate = 115200,
00028 Default_port = 10940,
00029 Infinity_times = -1,
00030 };
00031
00032 Urg_driver(void);
00033 virtual ~Urg_driver(void);
00034
00035 static std::vector<std::string> find_ports(void);
00036 static std::vector<std::string> find_ports(std::vector<int>&
00037 is_urg_ports);
00038 const char* what(void) const;
00039
00040 bool open(const char* device_name, long baudrate = Default_baudrate,
00041 connection_type_t type = Serial);
00042 void close(void);
00043 bool is_open(void) const;
00044
00045 void set_timeout_msec(int msec);
00046
00047 bool laser_on(void);
00048 bool laser_off(void);
00049
00050 void reboot(void);
00051
00052 void sleep(void);
00053 void wakeup(void);
00054 bool is_stable(void);
00055
00057 bool start_measurement(measurement_type_t type = Distance,
00058 int scan_times = Infinity_times,
00059 int skip_scan = 0);
00060
00062 bool get_distance(std::vector<long>& data, long *time_stamp = NULL);
00063 bool get_distance_intensity(std::vector<long>& data,
00064 std::vector<unsigned short>& intensity,
00065 long *time_stamp = NULL);
00066
00067 bool get_multiecho(std::vector<long>& data_multi,
00068 long* time_stamp = NULL);
00069
00070 bool get_multiecho_intensity(std::vector<long>& data_multiecho,
00071 std::vector<unsigned short>&
00072 intensity_multiecho,
00073 long* time_stamp = NULL);
00074
00075 bool set_scanning_parameter(int first_step, int last_step,
00076 int skip_step = 1);
00077
00079 void stop_measurement(void);
00080
00082 bool set_sensor_time_stamp(long time_stamp);
00083 long get_sensor_time_stamp(void);
00084
00086 double index2rad(int index) const;
00087 double index2deg(int index) const;
00088 int rad2index(double radian) const;
00089 int deg2index(double degree) const;
00090 int rad2step(double radian) const;
00091 int deg2step(double degree) const;
00092 double step2rad(int step) const;
00093 double step2deg(int step) const;
00094 int step2index(int step) const;
00095
00096 int min_step(void) const;
00097 int max_step(void) const;
00098 long min_distance(void) const;
00099 long max_distance(void) const;
00100 long scan_usec(void) const;
00101 int max_data_size(void) const;
00102 int max_echo_size(void) const;
00103
00104 const char* product_type(void) const;
00105 const char* firmware_version(void) const;
00106 const char* serial_id(void) const;
00107 const char* status(void) const;
00108 const char* state(void) const;
00109
00110 int raw_write(const char* data, size_t data_size);
00111 int raw_read(char* data, size_t max_data_size, int timeout);
00112 int raw_readline(char* data, size_t max_data_size, int timeout);
00113 void* raw_urg(void);
00114 void set_measurement_type(measurement_type_t type);
00115
00116 private:
00117 Urg_driver(const Urg_driver& rhs);
00118 Urg_driver& operator = (const Urg_driver& rhs);
00119
00120 struct pImpl;
00121 std::auto_ptr<pImpl> pimpl;
00122 };
00123 }
00124
00125 #endif