sensor_info.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SENSOR_INFO_H__
00030 #define SENSOR_INFO_H__
00031
00032 #if defined(WIN32)
00033 typedef unsigned char uint8_t;
00034 typedef unsigned int uint32_t;
00035 #if defined(HOKUYOAIST_STATIC)
00036 #define HOKUYOAIST_EXPORT
00037 #elif defined(hokuyoaist_EXPORTS)
00038 #define HOKUYOAIST_EXPORT __declspec(dllexport)
00039 #else
00040 #define HOKUYOAIST_EXPORT __declspec(dllimport)
00041 #endif
00042 #else
00043 #include <stdint.h>
00044 #define HOKUYOAIST_EXPORT
00045 #endif
00046
00047 #include <cstring>
00048 #include <string>
00049
00054 namespace hokuyoaist
00055 {
00056
00058 enum LaserModel
00059 {
00060 MODEL_URG04LX,
00061 MODEL_UBG04LXF01,
00062 MODEL_UHG08LX,
00063 MODEL_UTM30LX,
00064 MODEL_UXM30LXE,
00065 MODEL_UNKNOWN
00066 };
00067
00068
00069 HOKUYOAIST_EXPORT inline char const* model_to_string(LaserModel model)
00070 {
00071 switch(model)
00072 {
00073 case MODEL_URG04LX:
00074 return "URG-04LX";
00075 case MODEL_UBG04LXF01:
00076 return "UBG-04LX-F01";
00077 case MODEL_UHG08LX:
00078 return "UHG-08LX";
00079 case MODEL_UTM30LX:
00080 return "UTM-30LX";
00081 case MODEL_UXM30LXE:
00082 return "UXM-30LX-E";
00083 default:
00084 return "Unknown model";
00085 }
00086 }
00087
00088
00089 HOKUYOAIST_EXPORT inline LaserModel string_to_model(char const* model)
00090 {
00091 if(strncmp(model, "URG-04LX", 8) == 0)
00092 return MODEL_URG04LX;
00093 else if(strncmp(model, "UBG-04LX-F01", 8) == 0)
00094 return MODEL_UBG04LXF01;
00095 else if(strncmp(model, "UHG-08LX", 8) == 0)
00096 return MODEL_UHG08LX;
00097 else if(strncmp(model, "UTM-30LX", 8) == 0)
00098 return MODEL_UTM30LX;
00099 else if(strncmp(model, "UXM-30LX-E", 8) == 0)
00100 return MODEL_UXM30LXE;
00101 else
00102 return MODEL_UNKNOWN;
00103 }
00104
00105
00107 enum RotationDirection
00108 {
00109 CLOCKWISE,
00110 COUNTERCLOCKWISE
00111 };
00112
00113
00114 HOKUYOAIST_EXPORT inline char const* rot_dir_to_string(RotationDirection dir)
00115 {
00116 switch(dir)
00117 {
00118 case CLOCKWISE:
00119 return "Clockwise";
00120 case COUNTERCLOCKWISE:
00121 return "Counter-clockwise";
00122 default:
00123 return "Unknown";
00124 }
00125 }
00126
00127
00128
00129 class Sensor;
00130
00131
00137 class HOKUYOAIST_EXPORT SensorInfo
00138 {
00139 public:
00140 friend class Sensor;
00141
00142 SensorInfo();
00143 SensorInfo(SensorInfo const& rhs);
00144
00146 SensorInfo& operator=(SensorInfo const& rhs);
00147
00149 std::string as_string();
00150
00151
00153 std::string vendor;
00155 std::string product;
00157 std::string firmware;
00159 std::string protocol;
00161 std::string serial;
00162
00163
00165 std::string model;
00167 unsigned int min_range;
00169 unsigned int max_range;
00171 unsigned int steps;
00173 unsigned int first_step;
00175 unsigned int last_step;
00178 unsigned int front_step;
00180 unsigned int standard_speed;
00182 RotationDirection rot_dir;
00183
00184
00186 bool power;
00188 unsigned int speed;
00190 unsigned short speed_level;
00192 std::string measure_state;
00194 unsigned int baud;
00196 unsigned int time;
00198 std::string sensor_diagnostic;
00199
00200
00203 double min_angle;
00206 double max_angle;
00208 double resolution;
00210 double time_resolution;
00212 unsigned int scanable_steps;
00214 unsigned int max_step;
00216 LaserModel detected_model;
00217
00218 private:
00219 void set_defaults();
00220 void calculate_values();
00221 };
00222
00223 };
00224
00227 #endif // SENSOR_INFO_H__
00228