INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
sensor_info.h00001 /* 00002 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics 00003 * http://gearbox.sf.net/ 00004 * Copyright (c) 2008-2010 Geoffrey Biggs 00005 * 00006 * hokuyo_aist Hokuyo laser scanner driver. 00007 * 00008 * This distribution is licensed to you under the terms described in the 00009 * LICENSE file included in this distribution. 00010 * 00011 * This work is a product of the National Institute of Advanced Industrial 00012 * Science and Technology, Japan. Registration number: H22PRO-1086. 00013 * 00014 * This file is part of hokuyo_aist. 00015 * 00016 * This software is licensed under the Eclipse Public License -v 1.0 (EPL). See 00017 * http://www.opensource.org/licenses/eclipse-1.0.txt 00018 */ 00019 00020 #ifndef SENSOR_INFO_H__ 00021 #define SENSOR_INFO_H__ 00022 00023 #if defined(WIN32) 00024 typedef unsigned char uint8_t; 00025 typedef unsigned int uint32_t; 00026 #if defined(HOKUYO_AIST_STATIC) 00027 #define HOKUYO_AIST_EXPORT 00028 #elif defined(HOKUYO_AIST_EXPORTS) 00029 #define HOKUYO_AIST_EXPORT __declspec(dllexport) 00030 #else 00031 #define HOKUYO_AIST_EXPORT __declspec(dllimport) 00032 #endif 00033 #else 00034 #include <stdint.h> 00035 #define HOKUYO_AIST_EXPORT 00036 #endif 00037 00038 #include <string> 00039 #include <cstring> 00040 00045 namespace hokuyo_aist 00046 { 00047 00049 enum LaserModel 00050 { 00051 MODEL_URG04LX, // Classic-URG 00052 MODEL_UBG04LXF01, // Rapid-URG 00053 MODEL_UHG08LX, // Hi-URG 00054 MODEL_UTM30LX, // Top-URG 00055 MODEL_UXM30LXE, // Tough-URG 00056 MODEL_UNKNOWN 00057 }; 00058 00059 00060 HOKUYO_AIST_EXPORT inline char const* model_to_string(LaserModel model) 00061 { 00062 switch(model) 00063 { 00064 case MODEL_URG04LX: 00065 return "URG-04LX"; 00066 case MODEL_UBG04LXF01: 00067 return "UBG-04LX-F01"; 00068 case MODEL_UHG08LX: 00069 return "UHG-08LX"; 00070 case MODEL_UTM30LX: 00071 return "UTM-30LX"; 00072 case MODEL_UXM30LXE: 00073 return "UXM-30LX-E"; 00074 default: 00075 return "Unknown model"; 00076 } 00077 } 00078 00079 00080 HOKUYO_AIST_EXPORT inline LaserModel string_to_model(char const* model) 00081 { 00082 if(strncmp(model, "URG-04LX", 8) == 0) 00083 return MODEL_URG04LX; 00084 else if(strncmp(model, "UBG-04LX-F01", 8) == 0) 00085 return MODEL_UBG04LXF01; 00086 else if(strncmp(model, "UHG-08LX", 8) == 0) 00087 return MODEL_UHG08LX; 00088 else if(strncmp(model, "UTM-30LX", 8) == 0) 00089 return MODEL_UTM30LX; 00090 else if(strncmp(model, "UXM-30LX-E", 8) == 0) 00091 return MODEL_UXM30LXE; 00092 else 00093 return MODEL_UNKNOWN; 00094 } 00095 00096 00098 enum RotationDirection 00099 { 00100 CLOCKWISE, 00101 COUNTERCLOCKWISE 00102 }; 00103 00104 00105 HOKUYO_AIST_EXPORT inline char const* rot_dir_to_string(RotationDirection dir) 00106 { 00107 switch(dir) 00108 { 00109 case CLOCKWISE: 00110 return "Clockwise"; 00111 case COUNTERCLOCKWISE: 00112 return "Counter-clockwise"; 00113 default: 00114 return "Unknown"; 00115 } 00116 } 00117 00118 00119 // Forward declaration 00120 class Sensor; 00121 00122 00127 class HOKUYO_AIST_EXPORT SensorInfo 00128 { 00129 public: 00130 friend class Sensor; 00131 00132 SensorInfo(); 00133 SensorInfo(SensorInfo const& rhs); 00134 00136 SensorInfo& operator=(SensorInfo const& rhs); 00137 00139 std::string as_string(); 00140 00141 // Version details. 00143 std::string vendor; 00145 std::string product; 00147 std::string firmware; 00149 std::string protocol; 00151 std::string serial; 00152 00153 // Specification details. 00155 std::string model; 00157 unsigned int min_range; 00159 unsigned int max_range; 00161 unsigned int steps; 00163 unsigned int first_step; 00165 unsigned int last_step; 00168 unsigned int front_step; 00170 unsigned int standard_speed; 00172 RotationDirection rot_dir; 00173 00174 // Status details. 00176 bool power; 00178 unsigned int speed; 00180 unsigned short speed_level; 00182 std::string measure_state; 00184 unsigned int baud; 00186 unsigned int time; 00188 std::string sensor_diagnostic; 00189 00190 // Calculated details 00193 double min_angle; 00196 double max_angle; 00198 double resolution; 00200 double time_resolution; 00202 unsigned int scanable_steps; 00204 unsigned int max_step; 00206 LaserModel detected_model; 00207 00208 private: 00209 void set_defaults(); 00210 void calculate_values(); 00211 }; // class SensorInfo 00212 00213 }; // namespace hokuyo_aist 00214 00217 #endif // SENSOR_INFO_H__ 00218 |