00001 
00017 #ifndef SICK_LD_HH
00018 #define SICK_LD_HH
00019 
00020 
00021 #define DEFAULT_SICK_IP_ADDRESS                          "192.168.1.10"  ///< Default Sick LD INet 4 address
00022 #define DEFAULT_SICK_TCP_PORT                                   (49152)  ///< Default TCP port
00023 #define DEFAULT_SICK_MESSAGE_TIMEOUT                (unsigned int)(5e6)  ///< The max time to wait for a message reply (usecs)
00024 #define DEFAULT_SICK_CONNECT_TIMEOUT                (unsigned int)(1e6)  ///< The max time to wait before considering a connection attempt as failed (usecs)
00025 #define DEFAULT_SICK_NUM_SCAN_PROFILES                              (0)  ///< Setting this value to 0 will tell the Sick LD to stream measurements when measurement data is requested (NOTE: A profile is a single scans worth of range measurements)
00026 #define DEFAULT_SICK_SIGNAL_SET                                     (0)  ///< Default Sick signal configuration
00027 
00032 #define SWAP_VALUES(x,y,t) (t=x,x=y,y=t);
00033 
00034 
00035 #include <string>
00036 #include <vector>
00037 #include <pthread.h>
00038 #include <arpa/inet.h>
00039 
00040 #include "SickLIDAR.hh"
00041 #include "SickLDBufferMonitor.hh"
00042 #include "SickLDMessage.hh"
00043 #include "SickException.hh"
00044 
00049 namespace SickToolbox {
00050 
00056   class SickLD : public SickLIDAR< SickLDBufferMonitor, SickLDMessage > {
00057 
00058   public:
00059 
00060     
00061     static const uint16_t SICK_MAX_NUM_MEASUREMENTS = 2881;                             
00062     static const uint16_t SICK_MAX_NUM_SECTORS = 8;                                     
00063     static const uint16_t SICK_MAX_NUM_MEASURING_SECTORS = 4;                           
00064     static const uint16_t SICK_MAX_SCAN_AREA = 360;                                     
00065     static const uint16_t SICK_MIN_MOTOR_SPEED = 5;                                     
00066     static const uint16_t SICK_MAX_MOTOR_SPEED = 20;                                    
00067     static const uint16_t SICK_MIN_VALID_SENSOR_ID = 1;                                 
00068     static const uint16_t SICK_MAX_VALID_SENSOR_ID = 254;                               
00069     static const uint16_t SICK_MAX_MEAN_PULSE_FREQUENCY = 10800;                        
00070     static const uint16_t SICK_MAX_PULSE_FREQUENCY = 14400;                             
00071     static const uint16_t SICK_NUM_TICKS_PER_MOTOR_REV = 5760;                          
00072     static const double SICK_MAX_SCAN_ANGULAR_RESOLUTION = 0.125;                       
00073     static const double SICK_DEGREES_PER_MOTOR_STEP = 0.0625;                           
00074     
00075     
00076     static const uint8_t SICK_SENSOR_MODE_IDLE = 0x01;                                  
00077     static const uint8_t SICK_SENSOR_MODE_ROTATE = 0x02;                                
00078     static const uint8_t SICK_SENSOR_MODE_MEASURE = 0x03;                               
00079     static const uint8_t SICK_SENSOR_MODE_ERROR = 0x04;                                 
00080     static const uint8_t SICK_SENSOR_MODE_UNKNOWN = 0xFF;                               
00081   
00082     
00083     static const uint8_t SICK_MOTOR_MODE_OK = 0x00;                                     
00084     static const uint8_t SICK_MOTOR_MODE_SPIN_TOO_HIGH = 0x09;                          
00085     static const uint8_t SICK_MOTOR_MODE_SPIN_TOO_LOW = 0x04;                           
00086     static const uint8_t SICK_MOTOR_MODE_ERROR = 0x0B;                                  
00087     static const uint8_t SICK_MOTOR_MODE_UNKNOWN = 0xFF;                                
00088   
00089     
00090     static const uint8_t SICK_STAT_SERV_CODE = 0x01;                                    
00091     static const uint8_t SICK_CONF_SERV_CODE = 0x02;                                    
00092     static const uint8_t SICK_MEAS_SERV_CODE = 0x03;                                    
00093     static const uint8_t SICK_WORK_SERV_CODE = 0x04;                                    
00094     static const uint8_t SICK_ROUT_SERV_CODE = 0x06;                                    
00095     static const uint8_t SICK_FILE_SERV_CODE = 0x07;                                    
00096     static const uint8_t SICK_MONR_SERV_CODE = 0x08;                                    
00097   
00098     
00099     static const uint8_t SICK_STAT_SERV_GET_ID = 0x01;                                  
00100     static const uint8_t SICK_STAT_SERV_GET_STATUS = 0x02;                              
00101     static const uint8_t SICK_STAT_SERV_GET_SIGNAL = 0x04;                              
00102     static const uint8_t SICK_STAT_SERV_SET_SIGNAL = 0x05;                              
00103     static const uint8_t SICK_STAT_SERV_LD_REGISTER_APPLICATION = 0x06;                 
00104 
00105     
00106     static const uint8_t SICK_STAT_SERV_GET_ID_SENSOR_PART_NUM = 0x00;                  
00107     static const uint8_t SICK_STAT_SERV_GET_ID_SENSOR_NAME = 0x01;                      
00108     static const uint8_t SICK_STAT_SERV_GET_ID_SENSOR_VERSION = 0x02;                   
00109     static const uint8_t SICK_STAT_SERV_GET_ID_SENSOR_SERIAL_NUM = 0x03;                
00110     static const uint8_t SICK_STAT_SERV_GET_ID_SENSOR_EDM_SERIAL_NUM = 0x04;            
00111     static const uint8_t SICK_STAT_SERV_GET_ID_FIRMWARE_PART_NUM = 0x10;                
00112     static const uint8_t SICK_STAT_SERV_GET_ID_FIRMWARE_NAME = 0x11;                    
00113     static const uint8_t SICK_STAT_SERV_GET_ID_FIRMWARE_VERSION = 0x12;                 
00114     static const uint8_t SICK_STAT_SERV_GET_ID_APP_PART_NUM = 0x20;                     
00115     static const uint8_t SICK_STAT_SERV_GET_ID_APP_NAME = 0x21;                         
00116     static const uint8_t SICK_STAT_SERV_GET_ID_APP_VERSION = 0x22;                      
00117   
00118     
00119     static const uint8_t SICK_CONF_SERV_SET_CONFIGURATION = 0x01;                       
00120     static const uint8_t SICK_CONF_SERV_GET_CONFIGURATION = 0x02;                       
00121     static const uint8_t SICK_CONF_SERV_SET_TIME_ABSOLUTE = 0x03;                       
00122     static const uint8_t SICK_CONF_SERV_SET_TIME_RELATIVE = 0x04;                       
00123     static const uint8_t SICK_CONF_SERV_GET_SYNC_CLOCK = 0x05;                          
00124     static const uint8_t SICK_CONF_SERV_SET_FILTER = 0x09;                              
00125     static const uint8_t SICK_CONF_SERV_SET_FUNCTION = 0x0A;                            
00126     static const uint8_t SICK_CONF_SERV_GET_FUNCTION = 0x0B;                            
00127 
00128     
00129     static const uint8_t SICK_CONF_SERV_SET_FILTER_NEARFIELD = 0x01;                    
00130   
00131     
00132     static const uint8_t SICK_CONF_SERV_SET_FILTER_NEARFIELD_OFF = 0x00;                
00133     static const uint8_t SICK_CONF_SERV_SET_FILTER_NEARFIELD_ON = 0x01;                 
00134   
00135     
00136     static const uint8_t SICK_MEAS_SERV_GET_PROFILE = 0x01;                             
00137     static const uint8_t SICK_MEAS_SERV_CANCEL_PROFILE = 0x02;                          
00138 
00139     
00140     static const uint8_t SICK_WORK_SERV_RESET = 0x01;                                   
00141     static const uint8_t SICK_WORK_SERV_TRANS_IDLE = 0x02;                              
00142     static const uint8_t SICK_WORK_SERV_TRANS_ROTATE = 0x03;                            
00143     static const uint8_t SICK_WORK_SERV_TRANS_MEASURE = 0x04;                           
00144 
00145     
00146     static const uint8_t SICK_WORK_SERV_RESET_INIT_CPU = 0x00;                          
00147     static const uint8_t SICK_WORK_SERV_RESET_KEEP_CPU = 0x01;                          
00148     static const uint8_t SICK_WORK_SERV_RESET_HALT_APP = 0x02;                          
00149 
00150     
00151     static const uint8_t SICK_WORK_SERV_TRANS_MEASURE_RET_OK = 0x00;                    
00152     static const uint8_t SICK_WORK_SERV_TRANS_MEASURE_RET_ERR_MAX_PULSE = 0x01;         
00153     static const uint8_t SICK_WORK_SERV_TRANS_MEASURE_RET_ERR_MEAN_PULSE = 0x02;        
00154     static const uint8_t SICK_WORK_SERV_TRANS_MEASURE_RET_ERR_SECT_BORDER = 0x03;       
00155     static const uint8_t SICK_WORK_SERV_TRANS_MEASURE_RET_ERR_SECT_BORDER_MULT = 0x04;  
00156   
00157     
00158     static const uint8_t SICK_ROUT_SERV_COM_ATTACH = 0x01;                              
00159     static const uint8_t SICK_ROUT_SERV_COM_DETACH = 0x02;                              
00160     static const uint8_t SICK_ROUT_SERV_COM_INITIALIZE = 0x03;                          
00161     static const uint8_t SICK_ROUT_SERV_COM_OUTPUT = 0x04;                              
00162     static const uint8_t SICK_ROUT_SERV_COM_DATA = 0x05;                                
00163 
00164     
00165     static const uint8_t SICK_FILE_SERV_DIR = 0x01;                                     
00166     static const uint8_t SICK_FILE_SERV_SAVE = 0x02;                                    
00167     static const uint8_t SICK_FILE_SERV_LOAD = 0x03;                                    
00168     static const uint8_t SICK_FILE_SERV_DELETE = 0x04;                                  
00169 
00170     
00171     static const uint8_t SICK_MONR_SERV_MONITOR_RUN = 0x01;                             
00172     static const uint8_t SICK_MONR_SERV_MONITOR_PROFILE_LOG = 0x02;                     
00173 
00174     
00175     static const uint8_t SICK_CONF_KEY_RS232_RS422 = 0x01;                              
00176     static const uint8_t SICK_CONF_KEY_CAN = 0x02;                                      
00177     static const uint8_t SICK_CONF_KEY_ETHERNET = 0x05;                                 
00178     static const uint8_t SICK_CONF_KEY_GLOBAL = 0x10;                                   
00179 
00180     
00181     static const uint8_t SICK_CONF_SECTOR_NOT_INITIALIZED = 0x00;                       
00182     static const uint8_t SICK_CONF_SECTOR_NO_MEASUREMENT = 0x01;                        
00183     static const uint8_t SICK_CONF_SECTOR_RESERVED = 0x02;                              
00184     static const uint8_t SICK_CONF_SECTOR_NORMAL_MEASUREMENT = 0x03;                    
00185     static const uint8_t SICK_CONF_SECTOR_REFERENCE_MEASUREMENT = 0x04;                 
00186 
00187     
00188     static const uint16_t SICK_SCAN_PROFILE_RANGE = 0x39FF;                             
00189     
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207 
00208 
00209 
00210 
00211     
00212     static const uint16_t SICK_SCAN_PROFILE_RANGE_AND_ECHO = 0x3DFF;                    
00213     
00214 
00215 
00216 
00217 
00218 
00219 
00220 
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 
00231 
00232 
00233 
00234   
00235     
00236 
00237 
00238 
00239 
00240 
00241 
00242     static const uint8_t SICK_SIGNAL_LED_YELLOW_A = 0x01;                               
00243     static const uint8_t SICK_SIGNAL_LED_YELLOW_B = 0x02;                               
00244     static const uint8_t SICK_SIGNAL_LED_GREEN = 0x04;                                  
00245     static const uint8_t SICK_SIGNAL_LED_RED = 0x08;                                    
00246     static const uint8_t SICK_SIGNAL_SWITCH_0 = 0x10;                                   
00247     static const uint8_t SICK_SIGNAL_SWITCH_1 = 0x20;                                   
00248     static const uint8_t SICK_SIGNAL_SWITCH_2 = 0x40;                                   
00249     static const uint8_t SICK_SIGNAL_SWITCH_3 = 0x80;                                   
00250 
00260     typedef struct sick_ld_config_global_tag {
00261       uint16_t sick_sensor_id;                                                            
00262       uint16_t sick_motor_speed;                                                          
00263       double sick_angle_step;                                                             
00264     } sick_ld_config_global_t;
00265     
00277     typedef struct sick_ld_config_ethernet_tag {
00278       uint16_t sick_ip_address[4];                                                        
00279       uint16_t sick_subnet_mask[4];                                                       
00280       uint16_t sick_gateway_ip_address[4];                                                
00281       uint16_t sick_node_id;                                                              
00282       uint16_t sick_transparent_tcp_port;                                                 
00283     } sick_ld_config_ethernet_t;
00284     
00294     typedef struct sick_ld_config_sector_tag {
00295       uint8_t sick_num_active_sectors;                                                    
00296       uint8_t sick_num_initialized_sectors;                                               
00297       uint8_t sick_active_sector_ids[SICK_MAX_NUM_SECTORS];                               
00298       uint8_t sick_sector_functions[SICK_MAX_NUM_SECTORS];                                
00299       double sick_sector_start_angles[SICK_MAX_NUM_SECTORS];                              
00300       double sick_sector_stop_angles[SICK_MAX_NUM_SECTORS];                               
00301     } sick_ld_config_sector_t;
00302     
00312     typedef struct sick_ld_identity_tag {
00313       std::string sick_part_number;                                                       
00314       std::string sick_name;                                                              
00315       std::string sick_version;                                                           
00316       std::string sick_serial_number;                                                     
00317       std::string sick_edm_serial_number;                                                 
00318       std::string sick_firmware_part_number;                                              
00319       std::string sick_firmware_name;                                                     
00320       std::string sick_firmware_version;                                                  
00321       std::string sick_application_software_part_number;                                  
00322       std::string sick_application_software_name;                                         
00323       std::string sick_application_software_version;                                      
00324     } sick_ld_identity_t;
00325     
00335     typedef struct sick_ld_sector_data_tag {
00336       unsigned int sector_num;                                                            
00337       unsigned int num_data_points;                                                       
00338       unsigned int timestamp_start;                                                       
00339       unsigned int timestamp_stop;                                                        
00340       unsigned int echo_values[SICK_MAX_NUM_MEASUREMENTS];                                
00341       double angle_step;                                                                  
00342       double angle_start;                                                                 
00343       double angle_stop;                                                                  
00344       double range_values[SICK_MAX_NUM_MEASUREMENTS];                                     
00345       double scan_angles[SICK_MAX_NUM_MEASUREMENTS];                                      
00346     } sick_ld_sector_data_t;
00347     
00358     typedef struct sick_ld_scan_profile_tag {
00359       unsigned int profile_number;                                                        
00360       unsigned int profile_counter;                                                       
00361       unsigned int layer_num;                                                             
00362       unsigned int sensor_status;                                                         
00363       unsigned int motor_status;                                                          
00364       unsigned int num_sectors;                                                           
00365       sick_ld_sector_data_t sector_data[SICK_MAX_NUM_SECTORS];                            
00366     } sick_ld_scan_profile_t;
00367     
00369     SickLD( const std::string sick_ip_address = DEFAULT_SICK_IP_ADDRESS,
00370             const uint16_t sick_tcp_port = DEFAULT_SICK_TCP_PORT );
00371     
00373     void Initialize( )  throw( SickIOException, SickThreadException, SickTimeoutException, SickErrorException );
00374 
00376     void GetSickStatus( unsigned int &sick_sensor_mode, unsigned int &sick_motor_mode )
00377       throw( SickIOException, SickTimeoutException );
00378 
00380     void SetSickTempScanAreas( const double * active_sector_start_angles, const double * const active_sector_stop_angles,
00381                                const unsigned int num_active_sectors )
00382       throw( SickTimeoutException, SickIOException, SickConfigException );
00383     
00385     void SetSickTimeAbsolute( const uint16_t absolute_clock_time, uint16_t &new_sick_clock_time )
00386       throw( SickErrorException, SickTimeoutException, SickIOException, SickConfigException );
00387 
00389     void SetSickTimeRelative( const int16_t time_delta, uint16_t &new_sick_clock_time )
00390       throw( SickErrorException, SickTimeoutException, SickIOException, SickConfigException );
00391 
00393     void GetSickTime( uint16_t &sick_time )
00394       throw( SickIOException, SickTimeoutException, SickErrorException );
00395   
00397     void SetSickSignals( const uint8_t sick_signal_flags = DEFAULT_SICK_SIGNAL_SET )
00398       throw( SickIOException, SickTimeoutException, SickErrorException );
00399 
00401     void GetSickSignals( uint8_t &sick_signal_flags ) throw( SickIOException, SickTimeoutException );
00402   
00404     void EnableNearfieldSuppression( ) throw( SickErrorException, SickTimeoutException, SickIOException );
00405 
00407     void DisableNearfieldSuppression( ) throw( SickErrorException, SickTimeoutException, SickIOException );
00408 
00410     void GetSickMeasurements( double * const range_measurements,
00411                               unsigned int * const echo_measurements = NULL,
00412                               unsigned int * const num_measurements = NULL,
00413                               unsigned int * const sector_ids = NULL,
00414                               unsigned int * const sector_data_offsets = NULL,
00415                               double * const sector_step_angles = NULL,
00416                               double * const sector_start_angles = NULL,
00417                               double * const sector_stop_angles = NULL,
00418                               unsigned int * const sector_start_timestamps = NULL,
00419                               unsigned int * const sector_stop_timestamps = NULL )
00420       throw( SickErrorException, SickIOException, SickTimeoutException, SickConfigException );
00421 
00423     void SetSickSensorID( const unsigned int sick_sensor_id )
00424       throw( SickErrorException, SickTimeoutException, SickIOException );
00425 
00427     void SetSickMotorSpeed( const unsigned int sick_motor_speed )
00428       throw( SickErrorException, SickTimeoutException, SickIOException );
00429 
00431     void SetSickScanResolution( const double sick_step_angle )
00432       throw( SickTimeoutException, SickIOException, SickConfigException );
00433 
00435     void SetSickGlobalParamsAndScanAreas( const unsigned int sick_motor_speed,
00436                                           const double sick_step_angle,
00437                                           const double * const active_sector_start_angles,
00438                                           const double * const active_sector_stop_angles,
00439                                           const unsigned int num_active_sectors )
00440       throw( SickTimeoutException, SickIOException, SickConfigException, SickErrorException );
00441 
00443     void SetSickScanAreas( const double * const active_sector_start_angles,
00444                            const double * const active_sector_stop_angles,
00445                            const unsigned int num_active_sectors )
00446       throw( SickTimeoutException, SickIOException, SickConfigException, SickErrorException );
00447 
00449     void ResetSick( const unsigned int reset_level = SICK_WORK_SERV_RESET_INIT_CPU )
00450       throw( SickErrorException, SickTimeoutException, SickIOException, SickConfigException );
00451 
00453     unsigned int GetSickNumActiveSectors( ) const;
00454   
00456     unsigned int GetSickSensorID( ) const;
00457 
00459     unsigned int GetSickMotorSpeed( ) const;
00460 
00462     double GetSickScanResolution( ) const;
00463   
00465     std::string GetSickIPAddress( ) const;
00466   
00468     std::string GetSickSubnetMask( ) const;
00469   
00471     std::string GetSickGatewayIPAddress( ) const;
00472   
00474     std::string GetSickPartNumber( ) const;
00475 
00477     std::string GetSickName( ) const;
00478 
00480     std::string GetSickVersion( ) const;
00481 
00483     std::string GetSickSerialNumber( ) const;
00484 
00486     std::string GetSickEDMSerialNumber( ) const;
00487 
00489     std::string GetSickFirmwarePartNumber( ) const;
00490 
00492     std::string GetSickFirmwareName( ) const;
00493 
00495     std::string GetSickFirmwareVersion( ) const;
00496 
00498     std::string GetSickAppSoftwarePartNumber( ) const;
00499 
00501     std::string GetSickAppSoftwareName( ) const;
00502 
00504     std::string GetSickAppSoftwareVersionNumber( ) const;
00505 
00507     std::string GetSickStatusAsString() const;
00508 
00510     std::string GetSickIdentityAsString() const;
00511 
00513     std::string GetSickGlobalConfigAsString() const;
00514 
00516     std::string GetSickEthernetConfigAsString() const;
00517 
00519     std::string GetSickSectorConfigAsString() const;
00520     
00522     double GetSickScanArea( ) const;
00523   
00525     void PrintSickStatus( ) const;
00526 
00528     void PrintSickIdentity( ) const;
00529 
00531     void PrintSickGlobalConfig( ) const;
00532 
00534     void PrintSickEthernetConfig( ) const;
00535 
00537     void PrintSickSectorConfig( ) const;
00538   
00540     void Uninitialize( ) throw( SickIOException, SickTimeoutException, SickErrorException, SickThreadException );
00541 
00543     ~SickLD();
00544 
00545   private:
00546 
00548     std::string _sick_ip_address;
00549 
00551     uint16_t _sick_tcp_port;
00552 
00554     unsigned int _socket;
00555   
00557     struct sockaddr_in _sick_inet_address_info;
00558 
00560     uint8_t _sick_sensor_mode;
00561 
00563     uint8_t _sick_motor_mode;
00564 
00566     bool _sick_streaming_range_data;
00567 
00569     bool _sick_streaming_range_and_echo_data;
00570   
00572     sick_ld_identity_t _sick_identity;
00573 
00575     sick_ld_config_global_t _sick_global_config;
00576   
00578     sick_ld_config_ethernet_t _sick_ethernet_config;
00579 
00581     sick_ld_config_sector_t _sick_sector_config;
00582 
00584     void _setupConnection( ) throw( SickIOException, SickTimeoutException );
00585   
00587     void _syncDriverWithSick( ) throw( SickIOException, SickTimeoutException, SickErrorException );
00588 
00590     void _setSickSectorFunction( const uint8_t sector_number, const uint8_t sector_function,
00591                                  const double sector_angle_stop, const bool write_to_flash = false )
00592        throw( SickErrorException, SickTimeoutException, SickIOException, SickConfigException );
00593   
00595     void _getSickSectorFunction( const uint8_t sector_num, uint8_t §or_function, double §or_stop_angle )
00596       throw( SickErrorException, SickTimeoutException, SickIOException );
00597   
00599     void _setSickSensorModeToIdle( ) throw( SickErrorException, SickTimeoutException, SickIOException );
00600 
00602     void _setSickSensorModeToRotate( ) throw( SickErrorException, SickTimeoutException, SickIOException );
00603 
00605     void _setSickSensorModeToMeasure( ) throw( SickErrorException, SickTimeoutException, SickIOException );
00606   
00608     void _setSickSensorMode( const uint8_t new_sick_sensor_mode )
00609       throw( SickErrorException, SickTimeoutException, SickIOException );
00610   
00612     void _getSickScanProfiles( const uint16_t profile_format, const uint16_t num_profiles = DEFAULT_SICK_NUM_SCAN_PROFILES )
00613       throw( SickErrorException, SickTimeoutException, SickIOException, SickConfigException );
00614 
00616     void _parseScanProfile( uint8_t * const src_buffer, sick_ld_scan_profile_t &profile_data ) const;
00617 
00619     void _cancelSickScanProfiles( ) throw( SickErrorException, SickTimeoutException, SickIOException );
00620 
00622     void _setSickFilter( const uint8_t suppress_code )
00623       throw( SickErrorException, SickTimeoutException, SickIOException );
00624   
00626     void _getSickIdentity( ) throw( SickTimeoutException, SickIOException );
00627 
00629     void _getSickStatus( ) throw( SickTimeoutException, SickIOException );
00630 
00632     void _setSickGlobalConfig( const uint8_t sick_sensor_id, const uint8_t sick_motor_speed, const double sick_angle_step )
00633       throw( SickErrorException, SickTimeoutException, SickIOException );
00634 
00636     void _getSickGlobalConfig( ) throw( SickErrorException, SickTimeoutException, SickIOException );
00637 
00639     void _getSickEthernetConfig( ) throw( SickErrorException, SickTimeoutException, SickIOException );
00640 
00642     void _getSickSectorConfig( ) throw( SickErrorException, SickTimeoutException, SickIOException );
00643   
00645     void _getIdentificationString( const uint8_t id_request_code, std::string &id_return_string )
00646       throw( SickTimeoutException, SickIOException );
00647   
00649     void _getSensorPartNumber( ) throw( SickTimeoutException, SickIOException );
00650 
00652     void _getSensorName( ) throw( SickTimeoutException, SickIOException );
00653 
00655     void _getSensorVersion( ) throw( SickTimeoutException, SickIOException );
00656 
00658     void _getSensorSerialNumber( ) throw( SickTimeoutException, SickIOException );
00659 
00661     void _getSensorEDMSerialNumber( ) throw( SickTimeoutException, SickIOException );
00662 
00664     void _getFirmwarePartNumber( ) throw( SickTimeoutException, SickIOException );
00665 
00667     void _getFirmwareName( ) throw( SickTimeoutException, SickIOException );
00668 
00670     void _getFirmwareVersion( ) throw( SickTimeoutException, SickIOException );
00671 
00673     void _getApplicationSoftwarePartNumber( ) throw( SickTimeoutException, SickIOException );
00674 
00676     void _getApplicationSoftwareName( ) throw( SickTimeoutException, SickIOException );
00677 
00679     void _getApplicationSoftwareVersion( ) throw( SickTimeoutException, SickIOException );
00680 
00682     void _setSickGlobalParamsAndScanAreas( const unsigned int sick_motor_speed, const double sick_step_angle,
00683                                            const double * const active_sector_start_angles,
00684                                            const double * const active_sector_stop_angles,
00685                                            const unsigned int num_active_sectors )
00686        throw( SickTimeoutException, SickIOException, SickConfigException, SickErrorException );
00687 
00689     void _setSickTemporaryScanAreas( const double * const active_sector_start_angles,
00690                                      const double * const active_sector_stop_angles,
00691                                      const unsigned int num_active_sectors )
00692       throw( SickTimeoutException, SickIOException, SickConfigException );
00693 
00695     void _setSickSectorConfig( const unsigned int * const sector_functions, const double * const sector_stop_angles,
00696                                const unsigned int num_sectors, const bool write_to_flash = false )
00697       throw( SickErrorException, SickTimeoutException, SickIOException, SickConfigException );
00698 
00700     void _setSickSignals( const uint8_t sick_signal_flags = DEFAULT_SICK_SIGNAL_SET )
00701       throw( SickIOException, SickTimeoutException, SickErrorException );
00702   
00704     void _sendMessageAndGetReply( const SickLDMessage &send_message, SickLDMessage &recv_message,
00705                                   const unsigned int timeout_value = DEFAULT_SICK_MESSAGE_TIMEOUT ) 
00706       throw( SickIOException, SickTimeoutException );
00707 
00709     void _flushTCPRecvBuffer( ) throw ( SickIOException, SickThreadException );
00710     
00712     void _teardownConnection( ) throw( SickIOException );
00713 
00715     void _generateSickSectorConfig( const double * const active_sector_start_angles,
00716                                     const double * const active_sector_stop_angles,
00717                                     const unsigned int num_active_sectors,
00718                                     const double sick_step_angle,
00719                                     unsigned int * const sector_functions, 
00720                                     double * const sector_stop_angles,
00721                                     unsigned int &num_sectors ) const;
00722   
00724     double _ticksToAngle( const uint16_t ticks ) const;
00725 
00727     uint16_t _angleToTicks( const double angle ) const;
00728 
00730     double _computeMeanPulseFrequency( const double active_scan_area, const double curr_motor_speed,
00731                                        const double curr_angular_resolution ) const;
00732   
00734     double _computeMaxPulseFrequency( const double total_scan_area, const double curr_motor_speed,
00735                                       const double curr_angular_resolution ) const;
00736 
00738     bool _validSickSensorID( const unsigned int sick_sensor_id ) const;
00739 
00741     bool _validSickMotorSpeed( const unsigned int sick_motor_speed ) const;
00742 
00744     bool _validSickScanResolution( const double sick_step_angle, const double * const active_sector_start_angles,
00745                                    const double * const active_sector_stop_angles, const unsigned int num_active_sectors ) const;
00746 
00748     bool _validPulseFrequency( const unsigned int sick_motor_speed, const double sick_step_angle ) const;
00749   
00751     bool _validPulseFrequency( const unsigned int sick_motor_speed, const double sick_step_angle,
00752                                const double * const active_sector_start_angles,
00753                                const double * const active_sector_stop_angles,
00754                                const unsigned int num_active_sectors ) const;
00755   
00757     double _computeScanArea( const double sick_step_angle, const double * const sector_start_angles,
00758                              const double * const sector_stop_angles, const unsigned int num_sectors ) const;
00759 
00761     void _sortScanAreas( double * const sector_start_angles, double * const sector_stop_angles,
00762                          const unsigned int num_sectors ) const;
00763 
00765     bool _validActiveSectors( const double * const sector_start_angles, const double * const sector_stop_angles,
00766                               const unsigned int num_active_sectors ) const;
00767     
00769     bool _supportedScanProfileFormat( const uint16_t profile_format ) const; 
00770 
00772     void _printSectorProfileData( const sick_ld_sector_data_t §or_data ) const;
00773 
00775     void _printSickScanProfile( const sick_ld_scan_profile_t profile_data, const bool print_sector_data = true ) const;
00776 
00778     uint8_t _sickSensorModeToWorkServiceSubcode( const uint8_t sick_sensor_mode ) const;
00779 
00781     std::string _sickSensorModeToString( const uint8_t sick_sensor_mode ) const;
00782  
00784     std::string _sickMotorModeToString( const uint8_t sick_motor_mode ) const;
00785 
00787     std::string _sickTransMeasureReturnToString( const uint8_t return_value ) const;
00788   
00790     std::string _sickResetLevelToString( const uint16_t reset_level ) const;
00791   
00793     std::string _sickSectorFunctionToString( const uint16_t sick_sector_function ) const;
00794   
00796     std::string _sickProfileFormatToString( const uint16_t profile_format ) const;
00797 
00799     void _printInitFooter( ) const;
00800 
00801   };
00802 
00803 } 
00804   
00805 #endif