SickLMS2xx.hh
Go to the documentation of this file.
00001 
00015 #ifndef SICK_LMS_2XX_HH
00016 #define SICK_LMS_2XX_HH
00017 
00018 /* Implementation dependencies */
00019 #include <string>
00020 #include <iostream>
00021 #include <termios.h>
00022 
00023 #include "SickLIDAR.hh"
00024 #include "SickException.hh"
00025 
00026 #include "SickLMS2xxBufferMonitor.hh"
00027 #include "SickLMS2xxMessage.hh"
00028 
00029 /* Macro definitions */
00030 #define DEFAULT_SICK_LMS_2XX_SICK_BAUD                                       (B9600)  ///< Initial baud rate of the LMS (whatever is set in flash)
00031 #define DEFAULT_SICK_LMS_2XX_HOST_ADDRESS                                     (0x80)  ///< Client/host default serial address
00032 #define DEFAULT_SICK_LMS_2XX_SICK_ADDRESS                                     (0x00)  ///< Sick LMS default serial address
00033 #define DEFAULT_SICK_LMS_2XX_SICK_PASSWORD                                "SICK_LMS"  ///< Password for entering installation mode
00034 #define DEFAULT_SICK_LMS_2XX_SICK_MESSAGE_TIMEOUT                (unsigned int)(1e6)  ///< The max time to wait for a message reply (usecs)
00035 #define DEFAULT_SICK_LMS_2XX_SICK_SWITCH_MODE_TIMEOUT            (unsigned int)(3e6)  ///< Can take the Sick LD up to 3 seconds to reply (usecs)
00036 #define DEFAULT_SICK_LMS_2XX_SICK_MEAN_VALUES_MESSAGE_TIMEOUT   (unsigned int)(15e6)  ///< When using mean values, the Sick can sometimes take more than 10s to respond
00037 #define DEFAULT_SICK_LMS_2XX_SICK_CONFIG_MESSAGE_TIMEOUT        (unsigned int)(15e6)  ///< The sick can take some time to respond to config commands (usecs)
00038 #define DEFAULT_SICK_LMS_2XX_BYTE_INTERVAL                                      (55)  ///< Minimum time in microseconds between transmitted bytes
00039 #define DEFAULT_SICK_LMS_2XX_NUM_TRIES                                           (3)  ///< The max number of tries before giving up on a request
00040     
00041 /* Associate the namespace */
00042 namespace SickToolbox {
00043 
00050   class SickLMS2xx : public SickLIDAR< SickLMS2xxBufferMonitor, SickLMS2xxMessage >
00051   { 
00052 
00053   public:
00054     
00056     static const uint16_t SICK_MAX_NUM_MEASUREMENTS = 721;                     
00057 
00063     enum sick_lms_2xx_type_t {
00064       
00065       /* Supported 200 models */
00066       SICK_LMS_TYPE_200_30106,                                                 
00067       
00068       /* Supported 211 models */
00069       SICK_LMS_TYPE_211_30106,                                                 
00070       SICK_LMS_TYPE_211_30206,                                                 
00071       SICK_LMS_TYPE_211_S07,                                                   
00072       SICK_LMS_TYPE_211_S14,                                                   
00073       SICK_LMS_TYPE_211_S15,                                                   
00074       SICK_LMS_TYPE_211_S19,                                                   
00075       SICK_LMS_TYPE_211_S20,                                                   
00076 
00077       /* Supported 220 models */
00078       SICK_LMS_TYPE_220_30106,                                                 
00079 
00080       /* Supported 221 models */
00081       SICK_LMS_TYPE_221_30106,                                                 
00082       SICK_LMS_TYPE_221_30206,                                                 
00083       SICK_LMS_TYPE_221_S07,                                                   
00084       SICK_LMS_TYPE_221_S14,                                                   
00085       SICK_LMS_TYPE_221_S15,                                                   
00086       SICK_LMS_TYPE_221_S16,                                                   
00087       SICK_LMS_TYPE_221_S19,                                                   
00088       SICK_LMS_TYPE_221_S20,                                                   
00089 
00090       /* Supported 291 models */
00091       SICK_LMS_TYPE_291_S05,                                                   
00092       SICK_LMS_TYPE_291_S14,                                                   
00093       SICK_LMS_TYPE_291_S15,                                                   
00094 
00095       /* Any unknown model */
00096       SICK_LMS_TYPE_UNKNOWN = 0xFF                                             
00097 
00098     };
00099     
00104     enum sick_lms_2xx_variant_t {
00105       SICK_LMS_VARIANT_2XX_TYPE_6 = 0x00,                                      
00106       SICK_LMS_VARIANT_SPECIAL = 0x01,                                         
00107       SICK_LMS_VARIANT_UNKNOWN = 0xFF                                          
00108     };
00109 
00114     enum sick_lms_2xx_scan_angle_t {
00115       SICK_SCAN_ANGLE_90 = 90,                                                 
00116       SICK_SCAN_ANGLE_100 = 100,                                               
00117       SICK_SCAN_ANGLE_180 = 180,                                               
00118       SICK_SCAN_ANGLE_UNKNOWN = 0xFF                                           
00119     };
00120     
00125     enum sick_lms_2xx_scan_resolution_t {
00126       SICK_SCAN_RESOLUTION_25 = 25,                                            
00127       SICK_SCAN_RESOLUTION_50 = 50,                                            
00128       SICK_SCAN_RESOLUTION_100 = 100,                                          
00129       SICK_SCAN_RESOLUTION_UNKNOWN = 0xFF                                      
00130     };
00131 
00136     enum sick_lms_2xx_measuring_units_t {
00137       SICK_MEASURING_UNITS_CM = 0x00,                                          
00138       SICK_MEASURING_UNITS_MM = 0x01,                                          
00139       SICK_MEASURING_UNITS_UNKNOWN = 0xFF                                      
00140     };
00141 
00146     enum sick_lms_2xx_sensitivity_t {
00147       SICK_SENSITIVITY_STANDARD = 0x00,                                        
00148       SICK_SENSITIVITY_MEDIUM = 0x01,                                          
00149       SICK_SENSITIVITY_LOW = 0x02,                                             
00150       SICK_SENSITIVITY_HIGH = 0x03,                                            
00151       SICK_SENSITIVITY_UNKNOWN = 0xFF                                          
00152     };
00153 
00158     enum sick_lms_2xx_peak_threshold_t {
00159       SICK_PEAK_THRESHOLD_DETECTION_WITH_NO_BLACK_EXTENSION = 0x00,            
00160       SICK_PEAK_THRESHOLD_DETECTION_WITH_BLACK_EXTENSION = 0x01,               
00161       SICK_PEAK_THRESHOLD_NO_DETECTION_WITH_NO_BLACK_EXTENSION = 0x02,         
00162       SICK_PEAK_THRESHOLD_NO_DETECTION_WITH_BLACK_EXTENSION = 0x03,            
00163       SICK_PEAK_THRESHOLD_UNKNOWN = 0xFF                                       
00164     };
00165 
00170     enum sick_lms_2xx_status_t {
00171       SICK_STATUS_OK = 0x00,                                                   
00172       SICK_STATUS_ERROR = 0x01,                                                
00173       SICK_STATUS_UNKNOWN = 0xFF                                               
00174     };
00175     
00180     enum sick_lms_2xx_measuring_mode_t { 
00181       SICK_MS_MODE_8_OR_80_FA_FB_DAZZLE = 0x00,                                
00182       SICK_MS_MODE_8_OR_80_REFLECTOR = 0x01,                                   
00183       SICK_MS_MODE_8_OR_80_FA_FB_FC = 0x02,                                    
00184       SICK_MS_MODE_16_REFLECTOR = 0x03,                                        
00185       SICK_MS_MODE_16_FA_FB = 0x04,                                            
00186       SICK_MS_MODE_32_REFLECTOR = 0x05,                                        
00187       SICK_MS_MODE_32_FA = 0x06,                                               
00188       SICK_MS_MODE_32_IMMEDIATE = 0x0F,                                        
00189       SICK_MS_MODE_REFLECTIVITY = 0x3F,                                        
00190       SICK_MS_MODE_UNKNOWN = 0xFF                                              
00191     };
00192     
00198     enum sick_lms_2xx_operating_mode_t {
00199       SICK_OP_MODE_INSTALLATION = 0x00,                                        
00200       SICK_OP_MODE_DIAGNOSTIC = 0x10,                                          
00201       SICK_OP_MODE_MONITOR_STREAM_MIN_VALUE_FOR_EACH_SEGMENT = 0x20,           
00202       SICK_OP_MODE_MONITOR_TRIGGER_MIN_VALUE_ON_OBJECT = 0x21,                 
00203       SICK_OP_MODE_MONITOR_STREAM_MIN_VERT_DIST_TO_OBJECT = 0x22,              
00204       SICK_OP_MODE_MONITOR_TRIGGER_MIN_VERT_DIST_TO_OBJECT = 0x23,             
00205       SICK_OP_MODE_MONITOR_STREAM_VALUES = 0x24,                               
00206       SICK_OP_MODE_MONITOR_REQUEST_VALUES = 0x25,                              
00207       SICK_OP_MODE_MONITOR_STREAM_MEAN_VALUES = 0x26,                          
00208       SICK_OP_MODE_MONITOR_STREAM_VALUES_SUBRANGE = 0x27,                      
00209       SICK_OP_MODE_MONITOR_STREAM_MEAN_VALUES_SUBRANGE = 0x28,                 
00210       SICK_OP_MODE_MONITOR_STREAM_VALUES_WITH_FIELDS = 0x29,                   
00211       SICK_OP_MODE_MONITOR_STREAM_VALUES_FROM_PARTIAL_SCAN = 0x2A,             
00212       SICK_OP_MODE_MONITOR_STREAM_RANGE_AND_REFLECT_FROM_PARTIAL_SCAN = 0x2B,  
00213       SICK_OP_MODE_MONITOR_STREAM_MIN_VALUES_FOR_EACH_SEGMENT_SUBRANGE = 0x2C, 
00214       SICK_OP_MODE_MONITOR_NAVIGATION = 0x2E,                                  
00215       SICK_OP_MODE_MONITOR_STREAM_RANGE_AND_REFLECT = 0x50,                    
00216       SICK_OP_MODE_UNKNOWN = 0xFF                                              
00217     };
00218 
00223     enum sick_lms_2xx_baud_t {
00224       SICK_BAUD_9600 = 0x42,                                                   
00225       SICK_BAUD_19200 = 0x41,                                                  
00226       SICK_BAUD_38400 = 0x40,                                                  
00227       SICK_BAUD_500K = 0x48,                                                   
00228       SICK_BAUD_UNKNOWN = 0xFF                                                 
00229     };
00230 
00232     static const uint8_t SICK_FLAG_AVAILABILITY_DEFAULT = 0x00;                
00233     static const uint8_t SICK_FLAG_AVAILABILITY_HIGH = 0x01;                   
00234     static const uint8_t SICK_FLAG_AVAILABILITY_REAL_TIME_INDICES = 0x02;      
00235     static const uint8_t SICK_FLAG_AVAILABILITY_DAZZLE_NO_EFFECT = 0x04;       
00236   
00247     typedef struct sick_lms_2xx_operating_status_tag {
00248       uint16_t sick_scan_angle;                                                
00249       uint16_t sick_scan_resolution;                                           
00250       uint16_t sick_num_motor_revs;                                            
00251       uint8_t sick_operating_mode;                                             
00252       uint8_t sick_measuring_mode;                                             
00253       uint8_t sick_laser_mode;                                                 
00254       uint8_t sick_device_status;                                              
00255       uint8_t sick_measuring_units;                                            
00256       uint8_t sick_address;                                                    
00257       uint8_t sick_variant;                                                    
00258     } sick_lms_2xx_operating_status_t;
00259     
00270     typedef struct sick_lms_2xx_software_status_tag {
00271       uint8_t sick_system_software_version[8];                                 
00272       uint8_t sick_prom_software_version[8];                                   
00273     } sick_lms_2xx_software_status_t;
00274     
00281     typedef struct sick_lms_2xx_restart_status_tag {
00282       uint16_t sick_restart_time;                                              
00283       uint8_t sick_restart_mode;                                               
00284     } sick_lms_2xx_restart_status_t;
00285     
00296     typedef struct sick_lms_2xx_pollution_status_tag {
00297       uint16_t sick_pollution_vals[8];                                         
00298       uint16_t sick_pollution_calibration_vals[8];                             
00299       uint16_t sick_reference_pollution_vals[4];                               
00300       uint16_t sick_reference_pollution_calibration_vals[4];                   
00301     } sick_lms_2xx_pollution_status_t;
00302     
00313     typedef struct sick_lms_2xx_signal_status_tag {
00314       uint16_t sick_reference_scale_1_dark_100;                                
00315       uint16_t sick_reference_scale_2_dark_100;                                
00316       uint16_t sick_reference_scale_1_dark_66;                                 
00317       uint16_t sick_reference_scale_2_dark_66;                                 
00318       uint16_t sick_signal_amplitude;                                          
00319       uint16_t sick_current_angle;                                             
00320       uint16_t sick_peak_threshold;                                            
00321       uint16_t sick_angle_of_measurement;                                      
00322       uint16_t sick_signal_amplitude_calibration_val;                          
00323       uint16_t sick_stop_threshold_target_value;                               
00324       uint16_t sick_peak_threshold_target_value;                               
00325       uint16_t sick_stop_threshold_actual_value;                               
00326       uint16_t sick_peak_threshold_actual_value;                               
00327       uint16_t sick_reference_target_single_measured_vals;                     
00328       uint16_t sick_reference_target_mean_measured_vals;                       
00329     } sick_lms_2xx_signal_status_t;
00330     
00341     typedef struct sick_lms_2xx_field_status_tag {
00342       uint8_t sick_field_evaluation_number;                                    
00343       uint8_t sick_field_set_number;                                           
00344       uint8_t sick_multiple_evaluation_offset_field_2;                         
00345     } sick_lms_2xx_field_status_t;
00346     
00356     typedef struct sick_lms_2xx_baud_status_tag {
00357       uint16_t sick_baud_rate;                                                 
00358       uint8_t sick_permanent_baud_rate;                                        
00359     } sick_lms_2xx_baud_status_t;
00360     
00370     typedef struct sick_lms_2xx_device_config_tag {
00371       uint16_t sick_blanking;                                                  
00372       uint16_t sick_fields_b_c_restart_times;                                  
00373       uint16_t sick_dazzling_multiple_evaluation;                              
00374       uint8_t sick_peak_threshold;                                             
00375       uint8_t sick_stop_threshold;                                             
00376       uint8_t sick_availability_level;                                         
00377       uint8_t sick_measuring_mode;                                             
00378       uint8_t sick_measuring_units;                                            
00379       uint8_t sick_temporary_field;                                            
00380       uint8_t sick_subtractive_fields;                                         
00381       uint8_t sick_multiple_evaluation;                                        
00382       uint8_t sick_restart;                                                    
00383       uint8_t sick_restart_time;                                               
00384       uint8_t sick_multiple_evaluation_suppressed_objects;                     
00385       uint8_t sick_contour_a_reference;                                        
00386       uint8_t sick_contour_a_positive_tolerance_band;                          
00387       uint8_t sick_contour_a_negative_tolerance_band;                          
00388       uint8_t sick_contour_a_start_angle;                                      
00389       uint8_t sick_contour_a_stop_angle;                                       
00390       uint8_t sick_contour_b_reference;                                        
00391       uint8_t sick_contour_b_positive_tolerance_band;                          
00392       uint8_t sick_contour_b_negative_tolerance_band;                          
00393       uint8_t sick_contour_b_start_angle;                                      
00394       uint8_t sick_contour_b_stop_angle;                                       
00395       uint8_t sick_contour_c_reference;                                        
00396       uint8_t sick_contour_c_positive_tolerance_band;                          
00397       uint8_t sick_contour_c_negative_tolerance_band;                          
00398       uint8_t sick_contour_c_start_angle;                                      
00399       uint8_t sick_contour_c_stop_angle;                                       
00400       uint8_t sick_pixel_oriented_evaluation;                                  
00401       uint8_t sick_single_measured_value_evaluation_mode;                      
00402     } sick_lms_2xx_device_config_t;
00403     
00414     typedef struct sick_lms_2xx_scan_profile_b0_tag {
00415       uint16_t sick_num_measurements;                                          
00416       uint16_t sick_measurements[SICK_MAX_NUM_MEASUREMENTS];                   
00417       uint8_t sick_field_a_values[SICK_MAX_NUM_MEASUREMENTS];                  
00418       uint8_t sick_field_b_values[SICK_MAX_NUM_MEASUREMENTS];                  
00419       uint8_t sick_field_c_values[SICK_MAX_NUM_MEASUREMENTS];                  
00420       uint8_t sick_telegram_index;                                             
00421       uint8_t sick_real_time_scan_index;                                       
00422       uint8_t sick_partial_scan_index;                                         
00423     } sick_lms_2xx_scan_profile_b0_t;
00424     
00435     typedef struct sick_lms_2xx_scan_profile_b6_tag {
00436       uint16_t sick_num_measurements;                                          
00437       uint16_t sick_measurements[SICK_MAX_NUM_MEASUREMENTS];                   
00438       uint8_t sick_sample_size;                                                
00439       uint8_t sick_telegram_index;                                             
00440       uint8_t sick_real_time_scan_index;                                       
00441     } sick_lms_2xx_scan_profile_b6_t;
00442     
00453     typedef struct sick_lms_2xx_scan_profile_b7_tag {
00454       uint16_t sick_subrange_start_index;                                      
00455       uint16_t sick_subrange_stop_index;                                       
00456       uint16_t sick_num_measurements;                                          
00457       uint16_t sick_measurements[SICK_MAX_NUM_MEASUREMENTS];                   
00458       uint8_t sick_field_a_values[SICK_MAX_NUM_MEASUREMENTS];                  
00459       uint8_t sick_field_b_values[SICK_MAX_NUM_MEASUREMENTS];                  
00460       uint8_t sick_field_c_values[SICK_MAX_NUM_MEASUREMENTS];                  
00461       uint8_t sick_telegram_index;                                             
00462       uint8_t sick_real_time_scan_index;                                       
00463       uint8_t sick_partial_scan_index;                                         
00464     } sick_lms_2xx_scan_profile_b7_t;
00465     
00476     typedef struct sick_lms_2xx_scan_profile_bf_tag {
00477       uint16_t sick_subrange_start_index;                                      
00478       uint16_t sick_subrange_stop_index;                                       
00479       uint16_t sick_num_measurements;                                          
00480       uint16_t sick_measurements[SICK_MAX_NUM_MEASUREMENTS];                   
00481       uint8_t sick_sample_size;                                                
00482       uint8_t sick_telegram_index;                                             
00483       uint8_t sick_real_time_scan_index;                                       
00484     } sick_lms_2xx_scan_profile_bf_t;
00485     
00496     typedef struct sick_lms_2xx_scan_profile_c4_tag {
00497       uint16_t sick_num_range_measurements;                                    
00498       uint16_t sick_num_reflect_measurements;                                  
00499       uint16_t sick_range_measurements[SICK_MAX_NUM_MEASUREMENTS];             
00500       uint16_t sick_reflect_measurements[SICK_MAX_NUM_MEASUREMENTS];           
00501       uint16_t sick_reflect_subrange_start_index;                              
00502       uint16_t sick_reflect_subrange_stop_index;                               
00503       uint8_t sick_field_a_values[SICK_MAX_NUM_MEASUREMENTS];                  
00504       uint8_t sick_field_b_values[SICK_MAX_NUM_MEASUREMENTS];                  
00505       uint8_t sick_field_c_values[SICK_MAX_NUM_MEASUREMENTS];                  
00506       uint8_t sick_telegram_index;                                             
00507       uint8_t sick_real_time_scan_index;                                       
00508     } sick_lms_2xx_scan_profile_c4_t;
00509     
00511     SickLMS2xx( const std::string sick_device_path );
00512     
00514     ~SickLMS2xx( );
00515     
00517     void Initialize( const sick_lms_2xx_baud_t desired_baud_rate, const uint32_t delay = 0 )
00518       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00519 
00521     void Uninitialize( ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00522 
00524     std::string GetSickDevicePath( ) const;
00525     
00527     sick_lms_2xx_type_t GetSickType( ) const throw( SickConfigException );
00528 
00530     double GetSickScanAngle( ) const throw( SickConfigException );
00531 
00533     double GetSickScanResolution( ) const throw( SickConfigException );
00534 
00536     void SetSickMeasuringUnits( const sick_lms_2xx_measuring_units_t sick_units = SICK_MEASURING_UNITS_MM )
00537       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00538 
00540     SickLMS2xx::sick_lms_2xx_measuring_units_t GetSickMeasuringUnits( ) const throw( SickConfigException );
00541     
00543     void SetSickSensitivity( const sick_lms_2xx_sensitivity_t sick_sensitivity = SICK_SENSITIVITY_STANDARD )
00544       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00545 
00547     sick_lms_2xx_sensitivity_t GetSickSensitivity( ) const throw( SickConfigException );
00548 
00550     void SetSickPeakThreshold( const sick_lms_2xx_peak_threshold_t sick_peak_threshold = SICK_PEAK_THRESHOLD_DETECTION_WITH_NO_BLACK_EXTENSION )
00551       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00552     
00554     sick_lms_2xx_peak_threshold_t GetSickPeakThreshold( ) const throw( SickConfigException );;
00555     
00557     void SetSickMeasuringMode( const sick_lms_2xx_measuring_mode_t sick_measuring_mode = SICK_MS_MODE_8_OR_80_FA_FB_DAZZLE )
00558       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00559 
00561     sick_lms_2xx_measuring_mode_t GetSickMeasuringMode( ) const throw( SickConfigException );
00562 
00564     sick_lms_2xx_operating_mode_t GetSickOperatingMode( ) const throw( SickConfigException );
00565     
00567     void SetSickAvailability( const uint8_t sick_availability_flags = SICK_FLAG_AVAILABILITY_DEFAULT )
00568       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00569 
00571     uint8_t GetSickAvailability( ) const throw( SickConfigException );
00572     
00574     void SetSickVariant( const sick_lms_2xx_scan_angle_t scan_angle, const sick_lms_2xx_scan_resolution_t scan_resolution )
00575       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00576 
00578     void GetSickScan( unsigned int * const measurement_values,
00579                       unsigned int & num_measurement_values,
00580                       unsigned int * const sick_field_a_values = NULL,
00581                       unsigned int * const sick_field_b_values = NULL,
00582                       unsigned int * const sick_field_c_values = NULL,
00583                       unsigned int * const sick_telegram_index = NULL,
00584                       unsigned int * const sick_real_time_scan_index = NULL ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00585 
00587     void GetSickScan( unsigned int * const range_values,
00588                       unsigned int * const reflect_values,
00589                       unsigned int & num_range_measurements,
00590                       unsigned int & num_reflect_measurements,
00591                       unsigned int * const sick_field_a_values = NULL,
00592                       unsigned int * const sick_field_b_values = NULL,
00593                       unsigned int * const sick_field_c_values = NULL,
00594                       unsigned int * const sick_telegram_index = NULL,
00595                       unsigned int * const sick_real_time_scan_index = NULL ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00596 
00598     void GetSickScanSubrange( const uint16_t sick_subrange_start_index,
00599                               const uint16_t sick_subrange_stop_index,
00600                               unsigned int * const measurement_values,
00601                               unsigned int & num_measurement_values,
00602                               unsigned int * const sick_field_a_values = NULL,
00603                               unsigned int * const sick_field_b_values = NULL,
00604                               unsigned int * const sick_field_c_values = NULL,
00605                               unsigned int * const sick_telegram_index = NULL,
00606                               unsigned int * const sick_real_time_scan_index = NULL ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00607     
00609     void GetSickPartialScan( unsigned int * const measurement_values,
00610                              unsigned int & num_measurement_values,
00611                              unsigned int & partial_scan_index,
00612                              unsigned int * const sick_field_a_values = NULL,
00613                              unsigned int * const sick_field_b_values = NULL,
00614                              unsigned int * const sick_field_c_values = NULL,
00615                              unsigned int * const sick_telegram_index = NULL,
00616                              unsigned int * const sick_real_time_scan_index = NULL ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00617 
00619     void GetSickMeanValues( const uint8_t sick_sample_size,
00620                             unsigned int * const measurement_values,
00621                             unsigned int & num_measurement_values,
00622                             unsigned int * const sick_telegram_index = NULL,
00623                             unsigned int * const sick_real_time_index = NULL ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00624 
00626     void GetSickMeanValuesSubrange( const uint8_t sick_sample_size,
00627                                     const uint16_t sick_subrange_start_index,
00628                                     const uint16_t sick_subrange_stop_index,
00629                                     unsigned int * const measurement_values,
00630                                     unsigned int & num_measurement_values,
00631                                     unsigned int * const sick_telegram_index = NULL,
00632                                     unsigned int * const sick_real_time_index = NULL ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00633 
00635     sick_lms_2xx_status_t GetSickStatus( ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00636 
00638     bool IsSickLMS2xxFast( ) const throw( SickConfigException );
00639     
00641     void ResetSick( ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00642     
00644     std::string GetSickStatusAsString( ) const;
00645     
00647     std::string GetSickSoftwareVersionAsString( ) const;
00648     
00650     std::string GetSickConfigAsString( ) const;
00651     
00653     void PrintSickStatus( ) const;
00654 
00656     void PrintSickSoftwareVersion( ) const;
00657 
00659     void PrintSickConfig( ) const;
00660 
00661     /*
00662      * NOTE: The following methods are given to make working with our
00663      *       predefined types a bit more manageable.
00664      */
00665 
00667     static std::string SickTypeToString( const sick_lms_2xx_type_t sick_type );
00668 
00670     static sick_lms_2xx_scan_angle_t IntToSickScanAngle( const int scan_angle_int );
00671 
00673     static sick_lms_2xx_scan_resolution_t IntToSickScanResolution( const int scan_resolution_int );
00674     
00676     static sick_lms_2xx_scan_resolution_t DoubleToSickScanResolution( const double scan_resolution_double );
00677     
00679     static std::string SickBaudToString( const sick_lms_2xx_baud_t baud_rate );
00680 
00682     static sick_lms_2xx_baud_t IntToSickBaud( const int baud_int );
00683     
00685     static sick_lms_2xx_baud_t StringToSickBaud( const std::string baud_str );
00686 
00688     static std::string SickStatusToString( const sick_lms_2xx_status_t sick_status );
00689     
00691     static std::string SickMeasuringModeToString( const sick_lms_2xx_measuring_mode_t sick_measuring_mode );
00692 
00694     static std::string SickOperatingModeToString( const sick_lms_2xx_operating_mode_t sick_operating_mode );
00695     
00697     static std::string SickSensitivityToString( const sick_lms_2xx_sensitivity_t sick_sensitivity );
00698 
00700     static std::string SickPeakThresholdToString( const sick_lms_2xx_peak_threshold_t sick_peak_threshold );
00701     
00703     static std::string SickMeasuringUnitsToString( const sick_lms_2xx_measuring_units_t sick_units );    
00704 
00705   protected:
00706 
00708     std::string _sick_device_path;
00709 
00711     sick_lms_2xx_baud_t _curr_session_baud;
00712 
00714     sick_lms_2xx_baud_t _desired_session_baud;
00715     
00717     sick_lms_2xx_type_t _sick_type;
00718 
00720     sick_lms_2xx_operating_status_t _sick_operating_status;
00721 
00723     sick_lms_2xx_software_status_t _sick_software_status;
00724 
00726     sick_lms_2xx_restart_status_t _sick_restart_status;
00727 
00729     sick_lms_2xx_pollution_status_t _sick_pollution_status;
00730 
00732     sick_lms_2xx_signal_status_t _sick_signal_status;
00733 
00735     sick_lms_2xx_field_status_t _sick_field_status;
00736 
00738     sick_lms_2xx_baud_status_t _sick_baud_status;
00739 
00741     sick_lms_2xx_device_config_t _sick_device_config;
00742 
00744     uint8_t _sick_mean_value_sample_size;
00745 
00747     uint16_t _sick_values_subrange_start_index;
00748 
00750     uint16_t _sick_values_subrange_stop_index;
00751     
00753     struct termios _old_term;
00754 
00756     void _setupConnection() throw( SickIOException, SickThreadException );
00757     void _setupConnection(const uint32_t delay ) throw( SickIOException, SickThreadException );
00758 
00760     void _teardownConnection( ) throw( SickIOException );
00761 
00763     void _sendMessageAndGetReply( const SickLMS2xxMessage &sick_send_message,
00764                                   SickLMS2xxMessage &sick_recv_message,
00765                                   const unsigned int timeout_value,
00766                                   const unsigned int num_tries ) throw( SickIOException, SickThreadException, SickTimeoutException ); 
00767 
00769     void _sendMessageAndGetReply( const SickLMS2xxMessage &sick_send_message,
00770                                   SickLMS2xxMessage &sick_recv_message,
00771                                   const uint8_t reply_code,
00772                                   const unsigned int timeout_value,
00773                                   const unsigned int num_tries ) throw( SickIOException, SickThreadException, SickTimeoutException ); 
00774     
00776     void _flushTerminalBuffer( ) throw ( SickThreadException );
00777     
00779     void _setSessionBaud( const sick_lms_2xx_baud_t baud_rate ) throw( SickIOException, SickThreadException, SickTimeoutException );
00780 
00782     bool _testSickBaud( const sick_lms_2xx_baud_t baud_rate ) throw( SickIOException, SickThreadException );
00783 
00785     void _setTerminalBaud( const sick_lms_2xx_baud_t sick_baud ) throw( SickIOException, SickThreadException );
00786 
00788     void _getSickType( ) throw( SickTimeoutException, SickIOException, SickThreadException );
00789 
00791     void _getSickConfig( ) throw( SickTimeoutException, SickIOException, SickThreadException );
00792 
00794     void _setSickConfig( const sick_lms_2xx_device_config_t &sick_config ) throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException );
00795     
00797     void _getSickStatus( ) throw( SickTimeoutException, SickIOException, SickThreadException );
00798 
00800     void _getSickErrors( unsigned int * const num_sick_errors = NULL,
00801                          uint8_t * const error_type_buffer = NULL,
00802                          uint8_t * const error_num_buffer = NULL ) throw( SickTimeoutException, SickIOException, SickThreadException );
00803 
00805     void _setSickOpModeInstallation( )
00806       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00807 
00809     void _setSickOpModeDiagnostic( )
00810       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00811 
00813     void _setSickOpModeMonitorRequestValues( )
00814       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00815 
00817     void _setSickOpModeMonitorStreamValues( )
00818       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00819 
00821     void _setSickOpModeMonitorStreamRangeAndReflectivity( )
00822       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00823 
00825     void _setSickOpModeMonitorStreamValuesFromPartialScan( )
00826       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00827 
00829     void _setSickOpModeMonitorStreamMeanValues( const uint8_t sample_size )
00830       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00831 
00833     void _setSickOpModeMonitorStreamValuesSubrange( const uint16_t subrange_start_index, const uint16_t subrange_stop_index )
00834       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00835 
00837     void _setSickOpModeMonitorStreamMeanValuesSubrange( const uint16_t sample_size, const uint16_t subrange_start_index, const uint16_t subrange_stop_index )
00838       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00839     
00841     void _switchSickOperatingMode( const uint8_t sick_mode, const uint8_t * const mode_params = NULL )
00842       throw( SickConfigException, SickTimeoutException, SickIOException, SickThreadException);
00843     
00845     void _parseSickScanProfileB0( const uint8_t * const src_buffer, sick_lms_2xx_scan_profile_b0_t &sick_scan_profile ) const;
00846 
00848     void _parseSickScanProfileB6( const uint8_t * const src_buffer, sick_lms_2xx_scan_profile_b6_t &sick_scan_profile ) const;
00849 
00851     void _parseSickScanProfileB7( const uint8_t * const src_buffer, sick_lms_2xx_scan_profile_b7_t &sick_scan_profile ) const;
00852 
00854     void _parseSickScanProfileBF( const uint8_t * const src_buffer, sick_lms_2xx_scan_profile_bf_t &sick_scan_profile ) const;
00855     
00857     void _parseSickScanProfileC4( const uint8_t * const src_buffer, sick_lms_2xx_scan_profile_c4_t &sick_scan_profile ) const;
00858 
00860     void _parseSickConfigProfile( const uint8_t * const src_buffer, sick_lms_2xx_device_config_t &sick_device_config ) const;
00861 
00863     void _extractSickMeasurementValues( const uint8_t * const byte_sequence, const uint16_t num_measurements, uint16_t * const measured_values,
00864                                         uint8_t * const field_a_values = NULL, uint8_t * const field_b_values = NULL, uint8_t * const field_c_values = NULL ) const;
00865     
00867     bool _returningRealTimeIndices( ) const { return _sick_device_config.sick_availability_level & SICK_FLAG_AVAILABILITY_REAL_TIME_INDICES; }
00868 
00870     bool _validSickMeasuringUnits( const sick_lms_2xx_measuring_units_t sick_units ) const;
00871 
00873     bool _validSickScanAngle( const sick_lms_2xx_scan_angle_t sick_scan_angle ) const;
00874 
00876     bool _validSickScanResolution( const sick_lms_2xx_scan_resolution_t sick_scan_resolution ) const;
00877 
00879     bool _validSickSensitivity( const sick_lms_2xx_sensitivity_t sick_sensitivity ) const;
00880 
00882     bool _validSickPeakThreshold( const sick_lms_2xx_peak_threshold_t sick_peak_threshold ) const;
00883     
00885     bool _validSickMeasuringMode( const sick_lms_2xx_measuring_mode_t sick_measuring_mode ) const;
00886 
00888     bool _isSickLMS200( ) const;
00889     
00891     bool _isSickLMS211( ) const;
00892     
00894     bool _isSickLMS220( ) const;
00895     
00897     bool _isSickLMS221( ) const;
00898     
00900     bool _isSickLMS291( ) const;
00901 
00903     bool _isSickUnknown( ) const;
00904     
00906     sick_lms_2xx_baud_t _baudToSickBaud( const int baud_rate ) const;
00907 
00909     std::string _sickAvailabilityToString( const uint8_t availability_code ) const;
00910 
00912     std::string _sickRestartToString( const uint8_t restart_code ) const;
00913     
00915     std::string _sickTemporaryFieldToString( const uint8_t temp_field_code ) const;
00916 
00918     std::string _sickSubtractiveFieldsToString( const uint8_t subt_field_code ) const;
00919 
00921     std::string _sickContourFunctionToString( const uint8_t contour_function_code ) const;
00922     
00924     std::string _sickVariantToString( const unsigned int sick_variant ) const;
00925 
00926   };
00927 
00932   typedef SickLMS2xx::sick_lms_2xx_type_t sick_lms_2xx_type_t;
00933 
00938   typedef SickLMS2xx::sick_lms_2xx_variant_t sick_lms_2xx_variant_t;
00939 
00944   typedef SickLMS2xx::sick_lms_2xx_scan_angle_t sick_lms_2xx_scan_angle_t;
00945 
00950   typedef SickLMS2xx::sick_lms_2xx_scan_resolution_t sick_lms_2xx_scan_resolution_t;
00951 
00956   typedef SickLMS2xx::sick_lms_2xx_measuring_units_t sick_lms_2xx_measuring_units_t;
00957 
00962   typedef SickLMS2xx::sick_lms_2xx_sensitivity_t sick_lms_2xx_sensitivity_t;
00963 
00968   typedef SickLMS2xx::sick_lms_2xx_peak_threshold_t sick_lms_2xx_peak_threshold_t;
00969   
00974   typedef SickLMS2xx::sick_lms_2xx_status_t sick_lms_2xx_status_t;
00975 
00980   typedef SickLMS2xx::sick_lms_2xx_measuring_mode_t sick_lms_2xx_measuring_mode_t;
00981 
00986   typedef SickLMS2xx::sick_lms_2xx_operating_mode_t sick_lms_2xx_operating_mode_t;
00987 
00992   typedef SickLMS2xx::sick_lms_2xx_baud_t sick_lms_2xx_baud_t;
00993   
00994 } //namespace SickToolbox
00995   
00996 #endif //SICK_LMS_2XX_HH


sicktoolbox
Author(s): Jason Derenick , Thomas Miller
autogenerated on Thu Aug 27 2015 15:17:16