lasertransform.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000 Brian Gerkey & Kasper Stoy
4  * gerkey@usc.edu kaspers@robotics.usc.edu
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  */
22 //
23 // Desc: Base class for laser transformations (i.e. cspace etc)
24 // Author: Andrew Howard
25 // Date: 1 Sep 2002
26 // CVS: $Id: lasertransform.h 9120 2013-01-07 00:18:52Z jpgr87 $
27 //
28 // Theory of operation -
29 //
30 // Requires - Laser device.
31 //
33 
34 
35 
36 #include <errno.h>
37 #include <string.h>
38 #include <math.h>
39 #include <stdlib.h> // for atoi(3)
40 #if !defined (WIN32)
41  #include <unistd.h>
42 #endif
43 
44 #include <libplayercore/playercore.h>
45 
46 // Driver for computing the free c-space from a laser scan.
47 class LaserTransform : public Driver
48 {
49  // Constructor
50  public: LaserTransform( ConfigFile* cf, int section);
51 
52  // MessageHandler
53  public: virtual int ProcessMessage(QueuePointer & resp_queue,
54  player_msghdr * hdr,
55  void * data);
56 
57  // Setup/shutdown routines.
58  public: virtual int Setup();
59  public: virtual int Shutdown();
60 
61  protected:
62  // Process laser data. Returns non-zero if the laser data has been
63  // updated.
64  virtual int UpdateLaser(player_laser_data_t * data) = 0;
65 
66  // Process requests. Returns 1 if the configuration has changed.
67  int HandleRequests();
68 
69  // Handle geometry requests.
70  void HandleGetGeom(void *client, void *req, int reqlen);
71 
72  // Laser stuff.
73  Device *laser_device;
74  player_devaddr_t laser_addr;
75  struct timeval laser_timestamp;
76 
77  // Fiducila stuff (the data we generate).
79  struct timeval time;
80 };
81 
Class for loading configuration file information.
Definition: configfile.h:196
Generic message header.
Definition: player.h:161
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
Definition: lasertransform.cc:86
A device address.
Definition: player.h:145
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:74
An autopointer for the message queue.
Definition: message.h:73
Base class for all drivers.
Definition: driver.h:108
virtual int Setup()
Initialize the driver.
Definition: lasertransform.cc:52
Definition: lasertransform.h:47
Data: scan (PLAYER_LASER_DATA_SCAN)
Definition: player_interfaces.h:883
virtual int Shutdown()
Finalize the driver.
Definition: lasertransform.cc:76