INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
scan_data.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 SCAN_DATA_H__ 00021 #define SCAN_DATA_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 "sensor_info.h" 00039 00040 #include <string> 00041 00046 namespace hokuyo_aist 00047 { 00048 00049 class Sensor; 00050 00052 class HOKUYO_AIST_EXPORT ScanData 00053 { 00054 public: 00055 friend class Sensor; 00056 00059 ScanData(); 00076 ScanData(uint32_t* const ranges_buffer, 00077 unsigned int ranges_length, 00078 uint32_t* const intensities_buffer=0, 00079 unsigned int intensities_length=0); 00081 ScanData(ScanData const& rhs); 00082 ~ScanData(); 00083 00089 const uint32_t* ranges() const 00090 { return ranges_; } 00092 const uint32_t* intensities() const 00093 { return intensities_; } 00095 unsigned int ranges_length() const { return ranges_length_; } 00097 unsigned int intensities_length() const { return intensities_length_; } 00102 bool get_error_status() const { return error_; } 00105 std::string error_code_to_string(uint32_t error_code); 00109 unsigned int laser_time_stamp() const { return laser_time_; } 00113 unsigned long long system_time_stamp() const { return system_time_; } 00115 LaserModel model() const { return model_; } 00117 bool buffers_provided() const { return buffers_provided_; } 00118 00127 ScanData& operator=(ScanData const& rhs); 00131 uint32_t operator[](unsigned int index); 00132 00134 std::string as_string(); 00135 00137 void clean_up(); 00138 00139 protected: 00140 uint32_t* ranges_; 00141 uint32_t* intensities_; 00142 unsigned int ranges_length_; 00143 unsigned int intensities_length_; 00144 bool error_; 00145 unsigned int laser_time_; 00146 unsigned long long system_time_; 00147 LaserModel model_; 00148 bool buffers_provided_; 00149 00150 void allocate_data(unsigned int length, 00151 bool include_intensities = false); 00152 void write_range(unsigned int index, uint32_t value); 00153 void write_intensity(unsigned int index, uint32_t value); 00154 }; // class ScanData 00155 00156 } // namespace hokuyo_aist 00157 00160 #endif // SCAN_DATA_H__ 00161 |