RS4Leuze_laser.h
00001 /* 00002 * Player - One Hell of a Robot Server 00003 * Copyright (C) 2000 Brian Gerkey et al. 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 */ 00020 00028 #ifndef RS4Leuze_laser_h 00029 #define RS4Leuze_laser_h 00030 00031 #include <termios.h> 00032 #include <sys/types.h> 00033 #include <sys/stat.h> 00034 #include <fcntl.h> 00035 #include <time.h> 00036 #include <sys/time.h> 00037 #include <stdlib.h> 00038 00039 using namespace std; 00040 00041 #define MAX_SCAN_POINTS 529 00042 00043 00044 typedef struct RS4Leuze_laser_readings { 00045 double Reading[MAX_SCAN_POINTS]; 00046 } RS4Leuze_laser_readings_t; 00047 00048 //classes 00052 class Claser 00053 { 00054 private: 00055 char *portName; 00056 int serialFD; 00057 termios ttyset; 00058 fd_set rfds; 00059 int selectResult; 00060 unsigned char byte; 00061 unsigned char checksum; 00062 unsigned char option1; 00063 long unsigned int scan_number; 00064 unsigned int output_start; 00065 unsigned int output_stop; 00066 unsigned int scanedPoint; 00067 unsigned char controlByte; 00068 unsigned int points_to_scan; 00069 struct timeval tv; 00070 timeval timeStamp; 00072 public: 00073 00074 //Claser(ClogMsg *lgMsg, bool *laser_ON, char dir_name[80]); /**<Opens serial port*/ 00075 Claser(int scan_points); 00076 ~Claser(); 00077 void closeLaser(); 00078 unsigned char readByte(); 00079 void sync(); 00080 //void readScan(); /**<Sets to scanData array values of last laser scanner*/ 00081 void writeConfig(); 00082 int scanRead(); 00083 void runLaser(); 00084 void closeSerial(); 00085 void openSerial(bool *laser_ON,int Baud_rate, const char * Port); 00086 RS4Leuze_laser_readings_t scanData; 00087 00088 }; 00089 00090 #endif 00091 00092