Fawkes API  Fawkes Development Version
amcl_sensor.h
00001 /***************************************************************************
00002  *  amcl_sensor.h: Adaptive Monte-Carlo localization
00003  *
00004  *  Created: Thu May 24 18:51:17 2012
00005  *  Copyright  2000  Brian Gerkey
00006  *             2000  Kasper Stoy
00007  *             2012  Tim Niemueller [www.niemueller.de]
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 /*  From:
00024  *  Player - One Hell of a Robot Server (LGPL)
00025  *  Copyright (C) 2000  Brian Gerkey   &  Kasper Stoy
00026  *                      gerkey@usc.edu    kaspers@robotics.usc.edu
00027  */
00028 ///////////////////////////////////////////////////////////////////////////
00029 // Desc: Adaptive Monte-Carlo localization
00030 // Author: Andrew Howard
00031 // Date: 6 Feb 2003
00032 ///////////////////////////////////////////////////////////////////////////
00033 
00034 #ifndef AMCL_SENSOR_H
00035 #define AMCL_SENSOR_H
00036 
00037 #include "../pf/pf.h"
00038 
00039 /// @cond EXTERNAL
00040 
00041 namespace amcl
00042 {
00043 
00044 // Forward declarations
00045 class AMCLSensorData;
00046 
00047 
00048 // Base class for all AMCL sensors
00049 class AMCLSensor
00050 {
00051   // Default constructor
00052   public: AMCLSensor();
00053          
00054   // Default destructor
00055   public: virtual ~AMCLSensor();
00056 
00057   // Update the filter based on the action model.  Returns true if the filter
00058   // has been updated.
00059   public: virtual bool UpdateAction(pf_t *pf, AMCLSensorData *data);
00060 
00061   // Initialize the filter based on the sensor model.  Returns true if the
00062   // filter has been initialized.
00063   public: virtual bool InitSensor(pf_t *pf, AMCLSensorData *data);
00064 
00065   // Update the filter based on the sensor model.  Returns true if the
00066   // filter has been updated.
00067   public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data);
00068 
00069   // Flag is true if this is the action sensor
00070   public: bool is_action;
00071 
00072   // Action pose (action sensors only)
00073   public: pf_vector_t pose;
00074 
00075   // AMCL Base
00076   //protected: AdaptiveMCL & AMCL;
00077 
00078 #ifdef INCLUDE_RTKGUI
00079   // Setup the GUI
00080   public: virtual void SetupGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
00081 
00082   // Finalize the GUI
00083   public: virtual void ShutdownGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
00084 
00085   // Draw sensor data
00086   public: virtual void UpdateGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig, AMCLSensorData *data);
00087 #endif
00088 };
00089 
00090 
00091 
00092 // Base class for all AMCL sensor measurements
00093 class AMCLSensorData
00094 {
00095   // Pointer to sensor that generated the data
00096   public: AMCLSensor *sensor;
00097           virtual ~AMCLSensorData() {}
00098 
00099   // Data timestamp
00100   public: double time;
00101 };
00102 
00103 }
00104 
00105 /// @endcond
00106 
00107 #endif