Go to the documentation of this file.00001 #ifndef URG_SENSOR_H
00002 #define URG_SENSOR_H
00003
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026
00027 #include "urg_c/urg_connection.h"
00028 #include "urg_c/urg_time.h"
00029
00030
00035 typedef enum {
00036 URG_DISTANCE,
00037 URG_DISTANCE_INTENSITY,
00038 URG_MULTIECHO,
00039 URG_MULTIECHO_INTENSITY,
00040 URG_STOP,
00041 URG_UNKNOWN,
00042 } urg_measurement_type_t;
00043
00048 typedef enum {
00049 URG_COMMUNICATION_3_BYTE,
00050 URG_COMMUNICATION_2_BYTE,
00051 } urg_range_data_byte_t;
00052
00053
00054 enum {
00055 URG_SCAN_INFINITY = 0,
00056 URG_MAX_ECHO = 3,
00057 };
00058
00059
00061 typedef urg_measurement_type_t
00062 (*urg_error_handler)(const char *status, void *urg);
00063
00064
00072 typedef struct
00073 {
00074 int is_active;
00075 int last_errno;
00076 urg_connection_t connection;
00077
00078 int first_data_index;
00079 int last_data_index;
00080 int front_data_index;
00081 int area_resolution;
00082 long scan_usec;
00083 int min_distance;
00084 int max_distance;
00085 int scanning_first_step;
00086 int scanning_last_step;
00087 int scanning_skip_step;
00088 int scanning_skip_scan;
00089 urg_range_data_byte_t range_data_byte;
00090
00091 int timeout;
00092 int specified_scan_times;
00093 int scanning_remain_times;
00094 int is_laser_on;
00095
00096 int received_first_index;
00097 int received_last_index;
00098 int received_skip_step;
00099 urg_range_data_byte_t received_range_data_byte;
00100 int is_sending;
00101
00102 urg_error_handler error_handler;
00103
00104 char return_buffer[80];
00105 } urg_t;
00106
00107
00147 extern int urg_open(urg_t *urg, urg_connection_type_t connection_type,
00148 const char *device_or_address,
00149 long baudrate_or_port);
00150
00151
00163 extern void urg_close(urg_t *urg);
00164
00165
00174 extern void urg_set_timeout_msec(urg_t *urg, int msec);
00175
00176
00178 extern int urg_start_time_stamp_mode(urg_t *urg);
00179
00180
00205 extern long urg_time_stamp(urg_t *urg);
00206
00207
00209 extern int urg_stop_time_stamp_mode(urg_t *urg);
00210
00211
00257 extern int urg_start_measurement(urg_t *urg, urg_measurement_type_t type,
00258 int scan_times, int skip_scan);
00259
00260
00298 extern int urg_get_distance(urg_t *urg, long data[], long *time_stamp, unsigned long long *system_time_stamp);
00299
00300
00336 extern int urg_get_distance_intensity(urg_t *urg, long data[],
00337 unsigned short intensity[],
00338 long *time_stamp, unsigned long long *system_time_stamp);
00339
00340
00387 extern int urg_get_multiecho(urg_t *urg, long data_multi[], long *time_stamp, unsigned long long *system_time_stamp);
00388
00389
00424 extern int urg_get_multiecho_intensity(urg_t *urg, long data_multi[],
00425 unsigned short intensity_multi[],
00426 long *time_stamp, unsigned long long *system_time_stamp);
00427
00428
00452 extern int urg_stop_measurement(urg_t *urg);
00453
00454
00505 extern int urg_set_scanning_parameter(urg_t *urg, int first_step,
00506 int last_step, int skip_step);
00507
00508
00529 extern int urg_set_communication_data_size(urg_t *urg,
00530 urg_range_data_byte_t data_byte);
00531
00532
00534 extern int urg_laser_on(urg_t *urg);
00535
00536
00538 extern int urg_laser_off(urg_t *urg);
00539
00540
00542 extern int urg_reboot(urg_t *urg);
00543
00544
00559 extern void urg_sleep(urg_t *urg);
00560
00561
00568 extern void urg_wakeup(urg_t *urg);
00569
00579 extern int urg_is_stable(urg_t *urg);
00580
00581
00592 extern const char *urg_sensor_product_type(urg_t *urg);
00593
00594
00605 extern const char *urg_sensor_serial_id(urg_t *urg);
00606
00614 extern const char *urg_sensor_vendor(urg_t *urg);
00615
00616
00627 extern const char *urg_sensor_firmware_version(urg_t *urg);
00628
00629 extern const char *urg_sensor_firmware_date(urg_t *urg);
00630
00638 extern const char *urg_sensor_protocol_version(urg_t *urg);
00639
00649 extern const char *urg_sensor_status(urg_t *urg);
00650
00651
00663 extern const char *urg_sensor_state(urg_t *urg);
00664
00665
00672 extern void urg_set_error_handler(urg_t *urg, urg_error_handler handler);
00673
00674
00684 extern long urg_scip_decode(const char data[], int size);
00685
00686
00687 #ifdef __cplusplus
00688 }
00689 #endif
00690
00691 #endif