HokuyoAIST 3.0.2
sensor_info.h
Go to the documentation of this file.
1/* HokuyoAIST
2 *
3 * Header file for the sensor information object.
4 *
5 * Copyright 2008-2011 Geoffrey Biggs geoffrey.biggs@aist.go.jp
6 * RT-Synthesis Research Group
7 * Intelligent Systems Research Institute,
8 * National Institute of Advanced Industrial Science and Technology (AIST),
9 * Japan
10 * All rights reserved.
11 *
12 * This file is part of HokuyoAIST.
13 *
14 * HokuyoAIST is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU Lesser General Public License as published
16 * by the Free Software Foundation; either version 2.1 of the License,
17 * or (at your option) any later version.
18 *
19 * HokuyoAIST is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with HokuyoAIST. If not, see
26 * <http://www.gnu.org/licenses/>.
27 */
28
29#ifndef SENSOR_INFO_H__
30#define SENSOR_INFO_H__
31
32#if defined(WIN32)
33 typedef unsigned char uint8_t;
34 typedef unsigned int uint32_t;
35 #if defined(HOKUYOAIST_STATIC)
36 #define HOKUYOAIST_EXPORT
37 #elif defined(hokuyoaist_EXPORTS)
38 #define HOKUYOAIST_EXPORT __declspec(dllexport)
39 #else
40 #define HOKUYOAIST_EXPORT __declspec(dllimport)
41 #endif
42#else
43 #include <stdint.h>
44 #define HOKUYOAIST_EXPORT
45#endif
46
47#include <cstring>
48#include <string>
49
54namespace hokuyoaist
55{
56
59{
60 MODEL_URG04LX, // Classic-URG
61 MODEL_UBG04LXF01, // Rapid-URG
62 MODEL_UHG08LX, // Hi-URG
63 MODEL_UTM30LX, // Top-URG
64 MODEL_UXM30LXE, // Tough-URG
66};
67
68
70{
71 switch(model)
72 {
73 case MODEL_URG04LX:
74 return "URG-04LX";
76 return "UBG-04LX-F01";
77 case MODEL_UHG08LX:
78 return "UHG-08LX";
79 case MODEL_UTM30LX:
80 return "UTM-30LX";
81 case MODEL_UXM30LXE:
82 return "UXM-30LX-E";
83 default:
84 return "Unknown model";
85 }
86}
87
88
90{
91 if(strncmp(model, "URG-04LX", 8) == 0)
92 return MODEL_URG04LX;
93 else if(strncmp(model, "UBG-04LX-F01", 8) == 0)
94 return MODEL_UBG04LXF01;
95 else if(strncmp(model, "UHG-08LX", 8) == 0)
96 return MODEL_UHG08LX;
97 else if(strncmp(model, "UTM-30LX", 8) == 0)
98 return MODEL_UTM30LX;
99 else if(strncmp(model, "UXM-30LX-E", 8) == 0)
100 return MODEL_UXM30LXE;
101 else
102 return MODEL_UNKNOWN;
103}
104
105
112
113
115{
116 switch(dir)
117 {
118 case CLOCKWISE:
119 return "Clockwise";
120 case COUNTERCLOCKWISE:
121 return "Counter-clockwise";
122 default:
123 return "Unknown";
124 }
125}
126
127
128// Forward declaration
129class Sensor;
130
131
138{
139 public:
140 friend class Sensor;
141
144
147
149 std::string as_string();
150
151 // Version details.
153 std::string vendor;
155 std::string product;
157 std::string firmware;
159 std::string protocol;
161 std::string serial;
162
163 // Specification details.
165 std::string model;
167 unsigned int min_range;
169 unsigned int max_range;
171 unsigned int steps;
173 unsigned int first_step;
175 unsigned int last_step;
178 unsigned int front_step;
180 unsigned int standard_speed;
183
184 // Status details.
186 bool power;
188 unsigned int speed;
190 unsigned short speed_level;
192 std::string measure_state;
194 unsigned int baud;
196 unsigned int time;
198 std::string sensor_diagnostic;
199
200 // Calculated details
203 double min_angle;
206 double max_angle;
212 unsigned int scanable_steps;
214 unsigned int max_step;
217
218 private:
219 void set_defaults();
220 void calculate_values();
221}; // class SensorInfo
222
223}; // namespace hokuyoaist
224
227#endif // SENSOR_INFO_H__
228
Hokuyo laser scanner class.
Definition sensor.h:131
Sensor information.
double max_angle
Maximum possible scan angle (radians).
unsigned short speed_level
Speed level (0 for default)
double resolution
Angle between two scan points (radians).
double min_angle
Minimum possible scan angle (radians).
std::string sensor_diagnostic
Diagnostic status string.
unsigned int speed
Current motor speed (rpm).
SensorInfo(SensorInfo const &rhs)
std::string serial
Serial number of this device.
SensorInfo & operator=(SensorInfo const &rhs)
Assignment operator.
std::string measure_state
Measurement state.
bool power
Operational status - illuminated or not.
LaserModel detected_model
Detected model of the laser.
double time_resolution
Time between two scan points (milliseconds).
unsigned int time
Current sensor time (s).
std::string product
Product name.
unsigned int front_step
Step number that points forward (typically the centre of a full scan).
unsigned int steps
Number of steps in a 360-degree scan.
unsigned int min_range
Minimum detectable range (mm).
unsigned int max_range
Maximum detectable range (mm).
std::string protocol
Protocol version in use.
std::string vendor
Vendor name.
unsigned int baud
Baud rate.
unsigned int scanable_steps
Total number of steps in a full scan (lastStep - firstStep).
std::string as_string()
Format the entire object into a string.
unsigned int first_step
First scanable step of a full scan.
std::string firmware
Firmware version.
std::string model
Sensor model number.
unsigned int max_step
Absolute maximum commandable step.
RotationDirection rot_dir
Rotation direction.
unsigned int standard_speed
Standard motor speed (rpm).
unsigned int last_step
Last scanable step of a full scan.
#define HOKUYOAIST_EXPORT
HOKUYOAIST_EXPORT char const * rot_dir_to_string(RotationDirection dir)
RotationDirection
Sensor direction of rotation.
LaserModel
Laser models.
Definition sensor_info.h:59
HOKUYOAIST_EXPORT char const * model_to_string(LaserModel model)
Definition sensor_info.h:69
HOKUYOAIST_EXPORT LaserModel string_to_model(char const *model)
Definition sensor_info.h:89