RS4Leuze_laser.h
1 /*
2 * Player - One Hell of a Robot Server
3 * Copyright (C) 2000 Brian Gerkey et al.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
28#ifndef RS4Leuze_laser_h
29#define RS4Leuze_laser_h
30
31#include <termios.h>
32#include <sys/types.h>
33#include <sys/stat.h>
34#include <fcntl.h>
35#include <time.h>
36#include <sys/time.h>
37#include <stdlib.h>
38
39using namespace std;
40
41#define MAX_SCAN_POINTS 529
42
43
44typedef struct RS4Leuze_laser_readings {
45 double Reading[MAX_SCAN_POINTS];
47
48//classes
52class Claser
53{
54 private:
55 char *portName;
57 termios ttyset;
58 fd_set rfds;
60 unsigned char byte;
61 unsigned char checksum;
62 unsigned char option1;
63 long unsigned int scan_number;
64 unsigned int output_start;
65 unsigned int output_stop;
66 unsigned int scanedPoint;
67 unsigned char controlByte;
68 unsigned int points_to_scan;
69 struct timeval tv;
70 timeval timeStamp;
72 public:
73
74 //Claser(ClogMsg *lgMsg, bool *laser_ON, char dir_name[80]); /**<Opens serial port*/
75 Claser(int scan_points);
76 ~Claser();
77 void closeLaser();
78 unsigned char readByte();
79 void sync();
80 //void readScan(); /**<Sets to scanData array values of last laser scanner*/
81 void writeConfig();
82 int scanRead();
83 void runLaser();
84 void closeSerial();
85 void openSerial(bool *laser_ON,int Baud_rate, const char * Port);
87
88};
89
90#endif
91
92
Claser implements functions to read data from a laser scanner ROTOSCAN RS4-4 (Leuze corp....
Definition RS4Leuze_laser.h:53
void closeLaser()
Closes serial Port and data file.
void runLaser()
Return the scan reading from the laser.
Definition RS4Leuze_laser.cc:219
void writeConfig()
Write configuration parameters to laser scanner device.
int scanRead()
reads one scan and puts it in scanData array
Definition RS4Leuze_laser.cc:131
struct timeval tv
termios variable time interval
Definition RS4Leuze_laser.h:69
unsigned char readByte()
Reads one byte and updates checksum message.
Definition RS4Leuze_laser.cc:103
void sync()
sync function synchronizes with the start of the laser data
Definition RS4Leuze_laser.cc:114
Claser(int scan_points)
Opens serial port.
Definition RS4Leuze_laser.cc:37
~Claser()
Destructor.
Definition RS4Leuze_laser.cc:46
int serialFD
Serial port file descriptor.
Definition RS4Leuze_laser.h:56
void closeSerial()
Closes serial Port.
Definition RS4Leuze_laser.cc:54
char * portName
Serial Port where laser is connected.
Definition RS4Leuze_laser.h:55
timeval timeStamp
Time in microseconds resolution.
Definition RS4Leuze_laser.h:70
void openSerial(bool *laser_ON, int Baud_rate, const char *Port)
Opens serial Port and get the default paarameters or those given in the .cfg file.
Definition RS4Leuze_laser.cc:59
termios ttyset
termios variable to configure serial port
Definition RS4Leuze_laser.h:57
int selectResult
Laser Message fields.
Definition RS4Leuze_laser.h:59
Definition RS4Leuze_laser.h:44