amcl_sensor.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  */
00021 //
00022 // Desc: Adaptive Monte-Carlo localization
00023 // Author: Andrew Howard
00024 // Date: 6 Feb 2003
00025 // CVS: $Id: amcl_sensor.h 6443 2008-05-15 19:46:11Z gerkey $
00026 //
00028 
00029 #ifndef AMCL_SENSOR_H
00030 #define AMCL_SENSOR_H
00031 
00032 #include "amcl.h"
00033 
00034 #include <libplayercore/playercore.h>
00035 #include "pf/pf.h"
00036 
00037 
00038 // Forward declarations
00039 class AMCLSensorData;
00040 
00041 
00042 // Base class for all AMCL sensors
00043 class AMCLSensor
00044 {
00045   // Default constructor
00046   public: AMCLSensor(AdaptiveMCL & aAMCL);
00047          
00048   // Default destructor
00049   public: virtual ~AMCLSensor();
00050 
00051   // Load the model
00052   public: virtual int Load(ConfigFile* cf, int section);
00053 
00054   // Unload the model
00055   public: virtual int Unload(void);
00056 
00057   // Initialize the model
00058   public: virtual int Setup(void);
00059 
00060   // Finalize the model
00061   public: virtual int Shutdown(void);
00062 
00063   // Process message for this interface
00064   public: virtual int ProcessMessage(QueuePointer &resp_queue, 
00065                                      player_msghdr * hdr, 
00066                                      void * data) = 0;  
00067 //  public: virtual AMCLSensorData *GetData(void);
00068   
00069   // Update the filter based on the action model.  Returns true if the filter
00070   // has been updated.
00071   public: virtual bool UpdateAction(pf_t *pf, AMCLSensorData *data);
00072 
00073   // Initialize the filter based on the sensor model.  Returns true if the
00074   // filter has been initialized.
00075   public: virtual bool InitSensor(pf_t *pf, AMCLSensorData *data);
00076 
00077   // Update the filter based on the sensor model.  Returns true if the
00078   // filter has been updated.
00079   public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data);
00080 
00081   // Flag is true if this is the action sensor
00082   public: bool is_action;
00083 
00084   // Action pose (action sensors only)
00085   public: pf_vector_t pose;
00086 
00087   // AMCL Base
00088   protected: AdaptiveMCL & AMCL;
00089 
00090 #ifdef INCLUDE_RTKGUI
00091   // Setup the GUI
00092   public: virtual void SetupGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
00093 
00094   // Finalize the GUI
00095   public: virtual void ShutdownGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
00096 
00097   // Draw sensor data
00098   public: virtual void UpdateGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig, AMCLSensorData *data);
00099 #endif
00100 };
00101 
00102 
00103 
00104 // Base class for all AMCL sensor measurements
00105 class AMCLSensorData
00106 {
00107   // Pointer to sensor that generated the data
00108   public: AMCLSensor *sensor;
00109           virtual ~AMCLSensorData() {}
00110 
00111   // Data timestamp
00112   public: double time;
00113 };
00114 
00115 
00116 
00117 #endif

Last updated 25 May 2011 21:17:00