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 4135 2007-08-23 19:58:48Z gerkey $
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 #include <unistd.h>
00041 
00042 #include <libplayercore/playercore.h>
00043 #include <libplayercore/error.h>
00044 
00045 // Driver for computing the free c-space from a laser scan.
00046 class LaserTransform : public Driver
00047 {
00048   // Constructor
00049   public: LaserTransform( ConfigFile* cf, int section);
00050 
00051     // MessageHandler
00052   public: virtual int ProcessMessage(QueuePointer & resp_queue, 
00053                               player_msghdr * hdr, 
00054                               void * data);
00055 
00056   // Setup/shutdown routines.
00057   public: virtual int Setup();
00058   public: virtual int Shutdown();
00059 
00060   protected:
00061   // Process laser data.  Returns non-zero if the laser data has been
00062   // updated.
00063   virtual int UpdateLaser(player_laser_data_t * data) = 0;
00064 
00065   // Process requests.  Returns 1 if the configuration has changed.
00066   int HandleRequests();
00067 
00068   // Handle geometry requests.
00069   void HandleGetGeom(void *client, void *req, int reqlen);
00070 
00071   // Laser stuff.
00072   Device *laser_device;
00073   player_devaddr_t laser_addr;
00074   struct timeval laser_timestamp;
00075 
00076   // Fiducila stuff (the data we generate).
00077   player_laser_data_t data;
00078   struct timeval time;
00079 };
00080 

Last updated 12 September 2005 21:38:45