lasertransform.h
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000  Brian Gerkey   &  Kasper Stoy
00004  *                      gerkey@usc.edu    kaspers@robotics.usc.edu
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00022 //
00023 // Desc: Base class for laser transformations (i.e. cspace etc)
00024 // Author: Andrew Howard
00025 // Date: 1 Sep 2002
00026 // CVS: $Id: lasertransform.h 8003 2009-07-13 10:34:37Z thjc $
00027 //
00028 // Theory of operation - 
00029 //
00030 // Requires - Laser device.
00031 //
00033 
00034 
00035 
00036 #include <errno.h>
00037 #include <string.h>
00038 #include <math.h>
00039 #include <stdlib.h>       // for atoi(3)
00040 #if !defined (WIN32)
00041   #include <unistd.h>
00042 #endif
00043 
00044 #include <libplayercore/playercore.h>
00045 
00046 // Driver for computing the free c-space from a laser scan.
00047 class LaserTransform : public Driver
00048 {
00049   // Constructor
00050   public: LaserTransform( ConfigFile* cf, int section);
00051 
00052     // MessageHandler
00053   public: virtual int ProcessMessage(QueuePointer & resp_queue, 
00054                               player_msghdr * hdr, 
00055                               void * data);
00056 
00057   // Setup/shutdown routines.
00058   public: virtual int Setup();
00059   public: virtual int Shutdown();
00060 
00061   protected:
00062   // Process laser data.  Returns non-zero if the laser data has been
00063   // updated.
00064   virtual int UpdateLaser(player_laser_data_t * data) = 0;
00065 
00066   // Process requests.  Returns 1 if the configuration has changed.
00067   int HandleRequests();
00068 
00069   // Handle geometry requests.
00070   void HandleGetGeom(void *client, void *req, int reqlen);
00071 
00072   // Laser stuff.
00073   Device *laser_device;
00074   player_devaddr_t laser_addr;
00075   struct timeval laser_timestamp;
00076 
00077   // Fiducila stuff (the data we generate).
00078   player_laser_data_t data;
00079   struct timeval time;
00080 };
00081