00001 /*************************************************************** 00002 00003 Mini Grand Challenge 2010 00004 Pennsylvania State University - Robotics Club 00005 Learn more at www.psurobotics.org 00006 Protected by the GNU General Public License 00007 LaserInterface.h 00008 ***************************************************************/ 00009 00010 #ifndef __LASERINTERFACE_H_ 00011 #define __LASERINTERFACE_H_ 00012 00013 // Includes 00014 #include <stdio.h> 00015 #include <stdlib.h> 00016 #include "../Shared/BaseComponent.h" 00017 #include <string.h> 00018 #include <vector> 00019 #include <fstream> 00020 00021 #include <hokuyo_aist/hokuyo_aist.h> 00022 00023 using namespace std; 00024 00025 const int MAX_SIZE = 1024; 00026 00028 class LaserInterface : public BaseComponent 00029 { 00030 public: 00031 LaserInterface(); 00032 ~LaserInterface(); 00033 int Update(); 00034 void setBaudRate(unsigned int baud); 00035 vector<uint32_t> getCollisionPoints(); 00036 void powerOn(bool on); 00037 00038 private: 00039 void initialize(); 00040 double stepToAngle(int step); 00041 int angleToStep(double angle); 00042 00043 char theBuffer[MAX_SIZE]; 00044 int bytesRead; 00045 char* theDevice; 00046 string portOptions; 00047 char* type; 00048 char* timeout; 00049 hokuyo_aist::HokuyoLaser laser; 00050 hokuyo_aist::HokuyoSensorInfo sensorInfo; 00051 hokuyo_aist::HokuyoData laserData; 00052 int baudRate; 00053 bool writeToFile; 00054 ofstream outFile; 00055 00056 //the collisionPoints 00057 //the index of of the vector represents the step index 00058 //the element @ that index represents the distance to the collision points 00059 vector<uint32_t> collisionPoints; 00060 00061 00062 }; 00063 00064 #endif
1.5.5