説明を見る。00001 #ifndef URG_SENSOR_H
00002 #define URG_SENSOR_H
00003
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00026 #include "urg_connection.h"
00027
00034 typedef enum {
00035 URG_DISTANCE,
00036 URG_DISTANCE_INTENSITY,
00037 URG_MULTIECHO,
00038 URG_MULTIECHO_INTENSITY,
00039 URG_STOP,
00040 URG_UNKNOWN,
00041 } urg_measurement_type_t;
00042
00049 typedef enum {
00050 URG_COMMUNICATION_3_BYTE,
00051 URG_COMMUNICATION_2_BYTE,
00052 } urg_range_data_byte_t;
00053
00054
00055 enum {
00056 URG_SCAN_INFINITY = 0,
00057 URG_MAX_ECHO = 3,
00058 };
00059
00060
00067 typedef urg_measurement_type_t
00068 (*urg_error_handler)(const char *status, void *urg);
00069
00070
00078 typedef struct
00079 {
00080 int is_active;
00081 int last_errno;
00082 urg_connection_t connection;
00083
00084 int first_data_index;
00085 int last_data_index;
00086 int front_data_index;
00087 int area_resolution;
00088 long scan_usec;
00089 int min_distance;
00090 int max_distance;
00091 int scanning_first_step;
00092 int scanning_last_step;
00093 int scanning_skip_step;
00094 int scanning_skip_scan;
00095 urg_range_data_byte_t range_data_byte;
00096
00097 int timeout;
00098 int specified_scan_times;
00099 int scanning_remain_times;
00100 int is_laser_on;
00101
00102 int received_first_index;
00103 int received_last_index;
00104 int received_skip_step;
00105 urg_range_data_byte_t received_range_data_byte;
00106 int is_sending;
00107
00108 urg_error_handler error_handler;
00109
00110 char return_buffer[80];
00111 } urg_t;
00112
00113
00177 extern int urg_open(urg_t *urg, urg_connection_type_t connection_type,
00178 const char *device_or_address,
00179 long baudrate_or_port);
00180
00181
00199 extern void urg_close(urg_t *urg);
00200
00201
00218 extern void urg_set_timeout_msec(urg_t *urg, int msec);
00219
00220
00227 extern int urg_start_time_stamp_mode(urg_t *urg);
00228
00229
00270 extern long urg_time_stamp(urg_t *urg);
00271
00272
00279 extern int urg_stop_time_stamp_mode(urg_t *urg);
00280
00281
00362 extern int urg_start_measurement(urg_t *urg, urg_measurement_type_t type,
00363 int scan_times, int skip_scan);
00364
00365
00426 extern int urg_get_distance(urg_t *urg, long data[], long *time_stamp);
00427
00428
00483 extern int urg_get_distance_intensity(urg_t *urg, long data[],
00484 unsigned short intensity[],
00485 long *time_stamp);
00486
00487
00566 extern int urg_get_multiecho(urg_t *urg, long data_multi[], long *time_stamp);
00567
00568
00619 extern int urg_get_multiecho_intensity(urg_t *urg, long data_multi[],
00620 unsigned short intensity_multi[],
00621 long *time_stamp);
00622
00623
00657 extern int urg_stop_measurement(urg_t *urg);
00658
00659
00746 extern int urg_set_scanning_parameter(urg_t *urg, int first_step,
00747 int last_step, int skip_step);
00748
00749
00790 extern int urg_set_communication_data_size(urg_t *urg,
00791 urg_range_data_byte_t data_byte);
00792
00793
00800 extern int urg_laser_on(urg_t *urg);
00801
00802
00809 extern int urg_laser_off(urg_t *urg);
00810
00811
00818 extern int urg_reboot(urg_t *urg);
00819
00820
00846 extern void urg_sleep(urg_t *urg);
00847
00848
00857 extern void urg_wakeup(urg_t *urg);
00858
00877 extern int urg_is_stable(urg_t *urg);
00878
00879
00897 extern const char *urg_sensor_product_type(urg_t *urg);
00898
00899
00917 extern const char *urg_sensor_serial_id(urg_t *urg);
00918
00919
00937 extern const char *urg_sensor_firmware_version(urg_t *urg);
00938
00939
00957 extern const char *urg_sensor_status(urg_t *urg);
00958
00959
00981 extern const char *urg_sensor_state(urg_t *urg);
00982
00983
00995 extern void urg_set_error_handler(urg_t *urg, urg_error_handler handler);
00996
00997
01015 extern long urg_scip_decode(const char data[], int size);
01016
01017
01018 #ifdef __cplusplus
01019 }
01020 #endif
01021
01022 #endif