00001 #ifndef BRICS_OODL_SICKS300_H 00002 #define BRICS_OODL_SICKS300_H 00003 00004 00005 #include <vector> 00006 #include <boost/thread.hpp> 00007 #include "cob_sick_s300/Logger.hpp" 00008 #include "cob_sick_s300/Units.hpp" 00009 #include "cob_sick_s300/Errors.hpp" 00010 //#include "cob_sick_s300/LaserScanner.hpp" 00011 //#include "cob_sick_s300/LaserScannerData.hpp" 00012 //#include "cob_sick_s300/LaserScannerDataWithIntensities.hpp" 00013 #include "cob_sick_s300/LaserScannerConfiguration.hpp" 00014 #include "cob_sick_s300/ScannerSickS300.h" 00015 00016 00017 namespace brics_oodl { 00018 00023 class SickS300 { 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(std::vector< double >& ranges_, std::vector< double >& rangeAngles_, std::vector< double >& intensities_, unsigned int& timestamp_, unsigned int& timeNow_, Errors& error); 00038 00039 bool resetDevice(Errors& error); 00040 00041 00042 private: 00043 void receiveScan(); 00044 00045 static const unsigned int numberOfScanPoints = 541; 00046 00047 //in milliseconds 00048 static const unsigned int timeTillNextPollForData = 20; 00049 00050 LaserScannerConfiguration* config; 00051 00052 bool isConnected; 00053 00054 ScannerSickS300* sickS300; 00055 00056 std::vector<double> distanceBufferOne; 00057 00058 std::vector<double> angleBufferOne; 00059 00060 std::vector<double> intensityBufferOne; 00061 00062 std::vector<double> distanceBufferTwo; 00063 00064 std::vector<double> angleBufferTwo; 00065 00066 std::vector<double> intensityBufferTwo; 00067 00068 unsigned int timestampBufferOne; 00069 00070 unsigned int timeNowBufferOne; 00071 00072 unsigned int timestampBufferTwo; 00073 00074 unsigned int timeNowBufferTwo; 00075 00076 volatile bool stopThread; 00077 00078 volatile bool newDataFlagOne; 00079 00080 volatile bool newDataFlagTwo; 00081 00082 boost::thread_group threads; 00083 00084 boost::mutex mutexData1; 00085 00086 boost::mutex mutexData2; 00087 00088 boost::mutex mutexSickS300; 00089 00090 }; 00091 00092 } // namespace brics_oodl 00093 #endif