00001 #ifndef BRICS_OODL_SICKS300_H 00002 #define BRICS_OODL_SICKS300_H 00003 00004 00005 #include <vector> 00006 #include <boost/thread.hpp> 00007 #include "generic/Logger.hpp" 00008 #include "generic/Units.hpp" 00009 #include "generic/Errors.hpp" 00010 #include "generic-laser-scanner/LaserScanner.hpp" 00011 #include "generic-laser-scanner/LaserScannerData.hpp" 00012 #include "generic-laser-scanner/LaserScannerDataWithIntensities.hpp" 00013 #include "generic-laser-scanner/LaserScannerConfiguration.hpp" 00014 #include "sick-s300/ScannerSickS300.hpp" 00015 00016 00017 namespace brics_oodl { 00018 00023 class SickS300 : public LaserScanner { 00024 public: 00025 SickS300(); 00026 00027 virtual ~SickS300(); 00028 00029 bool open(Errors& error); 00030 00031 bool close(Errors& error); 00032 00033 bool setConfiguration(const LaserScannerConfiguration& configuration, Errors& error); 00034 00035 bool getConfiguration(LaserScannerConfiguration& configuration, Errors& error); 00036 00037 bool getData(LaserScannerData& data, Errors& error); 00038 00039 bool getData(LaserScannerDataWithIntensities& data, Errors& error); 00040 00041 bool resetDevice(Errors& error); 00042 00043 00044 private: 00045 void receiveScan(); 00046 00047 static const unsigned int numberOfScanPoints = 541; 00048 00049 //in milliseconds 00050 static const unsigned int timeTillNextPollForData = 20; 00051 00052 LaserScannerConfiguration* config; 00053 00054 bool isConnected; 00055 00056 ScannerSickS300* sickS300; 00057 00058 std::vector<double> distanceBufferOne; 00059 00060 std::vector<double> angleBufferOne; 00061 00062 std::vector<double> intensityBufferOne; 00063 00064 std::vector<double> distanceBufferTwo; 00065 00066 std::vector<double> angleBufferTwo; 00067 00068 std::vector<double> intensityBufferTwo; 00069 00070 volatile bool stopThread; 00071 00072 volatile bool newDataFlagOne; 00073 00074 volatile bool newDataFlagTwo; 00075 00076 boost::thread_group threads; 00077 00078 boost::mutex mutexData1; 00079 00080 boost::mutex mutexData2; 00081 00082 boost::mutex mutexSickS300; 00083 00084 }; 00085 00086 } // namespace brics_oodl 00087 #endif