00001 /* 00002 * Player - One Hell of a Robot Server 00003 * Copyright (C) 2000 Brian Gerkey et al. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library 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 GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00020 // 00021 // Desc: Adaptive Monte-Carlo localization 00022 // Author: Andrew Howard 00023 // Date: 6 Feb 2003 00024 // CVS: $Id: amcl_sensor.h 6443 2008-05-15 19:46:11Z gerkey $ 00025 // 00027 00028 #ifndef AMCL_SENSOR_H 00029 #define AMCL_SENSOR_H 00030 00031 #include "../pf/pf.h" 00032 00033 namespace amcl 00034 { 00035 00036 // Forward declarations 00037 class AMCLSensorData; 00038 00039 00040 // Base class for all AMCL sensors 00041 class AMCLSensor 00042 { 00043 // Default constructor 00044 public: AMCLSensor(); 00045 00046 // Default destructor 00047 public: virtual ~AMCLSensor(); 00048 00049 // Update the filter based on the action model. Returns true if the filter 00050 // has been updated. 00051 public: virtual bool UpdateAction(pf_t *pf, AMCLSensorData *data); 00052 00053 // Initialize the filter based on the sensor model. Returns true if the 00054 // filter has been initialized. 00055 public: virtual bool InitSensor(pf_t *pf, AMCLSensorData *data); 00056 00057 // Update the filter based on the sensor model. Returns true if the 00058 // filter has been updated. 00059 public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data); 00060 00061 // Flag is true if this is the action sensor 00062 public: bool is_action; 00063 00064 // Action pose (action sensors only) 00065 public: pf_vector_t pose; 00066 00067 // AMCL Base 00068 //protected: AdaptiveMCL & AMCL; 00069 00070 #ifdef INCLUDE_RTKGUI 00071 // Setup the GUI 00072 public: virtual void SetupGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig); 00073 00074 // Finalize the GUI 00075 public: virtual void ShutdownGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig); 00076 00077 // Draw sensor data 00078 public: virtual void UpdateGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig, AMCLSensorData *data); 00079 #endif 00080 }; 00081 00082 00083 00084 // Base class for all AMCL sensor measurements 00085 class AMCLSensorData 00086 { 00087 // Pointer to sensor that generated the data 00088 public: AMCLSensor *sensor; 00089 virtual ~AMCLSensorData() {} 00090 00091 // Data timestamp 00092 public: double time; 00093 }; 00094 00095 } 00096 00097 #endif