INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
sickdefines.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This distribution is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 /* AlexB: This code was forked from CARMEN then overhauled */ 00011 /* Tobi: Modified to make it work for 500kbps over RS422 */ 00012 00013 #ifndef SICKDEFINES_H 00014 #define SICKDEFINES_H 00015 00016 #include <string> 00017 #include <assert.h> 00018 00019 #define LASER_BUFFER_SIZE 100000 00020 00021 #define CRC16_GEN_POL 0x8005 00022 #define CRC16_GEN_POL0 0x80 00023 #define CRC16_GEN_POL1 0x05 00024 00025 #define LMS_PASSWORD "SICK_LMS" 00026 #define PLS_PASSWORD "SICK_PLS" 00027 00028 #define BUFFER_SIZE 16000 00029 #define MAX_COMMAND_SIZE 8196 00030 #define MAX_NAME_LENGTH 256 00031 00032 #define MAX_TIME_FOR_CLEAR 0.2 00033 #define MAX_TIME_FOR_DATA 0.3 00034 #define MAX_TIME_FOR_ACK 0.1 00035 #define MAX_TIME_FOR_ANSWER 0.1 00036 #define MAX_TIME_FOR_SENSOR_DATA 0.5 00037 // Tobi: changed MAX_TIME_FOR_CONFIG from 3.0 to 5.0 so that sick_set_config_mode() 00038 // could change from 500kbps to the slower baud rates 00039 #define MAX_TIME_FOR_CONFIG 5.0 00040 #define MAX_TIME_FOR_GETTING_CONF 0.3 00041 #define MAX_TIME_FOR_TESTING_BAUDRATE 1.0 00042 00043 #define INI -1 00044 #define TIO 0 00045 #define STX 0x02 00046 #define UKN 0x05 00047 #define ACK 0x06 00048 #define DLE 0x10 00049 #define NAK 0x15 00050 #define LID 0x80 00051 00052 #define RES_1_00_DEGREE 0 00053 #define RES_0_50_DEGREE 1 00054 #define RES_0_25_DEGREE 2 00055 00056 #ifndef TIOCGETP 00057 #define TIOCGETP 0x5481 00058 #define TIOCSETP 0x5482 00059 #define RAW 1 00060 #define CBREAK 64 00061 #endif 00062 00063 typedef enum { PLS, LMS } laser_model_t; 00064 typedef enum { CM, MM, DM } range_res_t; 00065 typedef enum { RANGE80M, RANGE160M, RANGE320M } range_dist_t; 00066 typedef enum { N, E, O } parity_t; 00067 00068 class laser_device_t { 00069 public: 00070 int fd; 00071 laser_model_t type; 00072 std::string ttyport; 00073 int baudrate; 00074 parity_t parity; 00075 std::string passwd; 00076 int databits; 00077 int stopbits; 00078 int hwf; 00079 int swf; 00080 int laser_num; 00081 }; 00082 00083 typedef laser_device_t *laser_device_p; 00084 00085 class laser_settings_t { 00086 public: 00087 00088 // May throw std::strings on dodgy settings. 00089 laser_settings_t( const char *device, 00090 const char *laserType, // eg "LMS" 00091 int baudrate, 00092 double resolutionInDegrees, 00093 range_res_t rangeResolution ); 00094 00095 std::string device_name; 00096 laser_model_t type; 00097 range_res_t range_res; 00098 range_dist_t range_dist; 00099 std::string password; 00100 int laser_num; 00101 int detect_baudrate, use_highspeed; 00102 int start_baudrate, set_baudrate; 00103 int databits, stopbits; 00104 parity_t parity; 00105 int swf, hwf; 00106 int angle_range, angle_resolution; 00107 int num_values; 00108 int laser_flipped; 00109 00110 // Throws std::strings if something's fucked up 00111 void checkValid() const; 00112 00113 // for debugging 00114 void print() const; 00115 }; 00116 00117 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)