Fawkes API  Fawkes Development Version
amcl_sensor.h
1 /***************************************************************************
2  * amcl_sensor.h: Adaptive Monte-Carlo localization
3  *
4  * Created: Thu May 24 18:51:17 2012
5  * Copyright 2000 Brian Gerkey
6  * 2000 Kasper Stoy
7  * 2012 Tim Niemueller [www.niemueller.de]
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 /* From:
24  * Player - One Hell of a Robot Server (LGPL)
25  * Copyright (C) 2000 Brian Gerkey & Kasper Stoy
26  * gerkey@usc.edu kaspers@robotics.usc.edu
27  */
28 ///////////////////////////////////////////////////////////////////////////
29 // Desc: Adaptive Monte-Carlo localization
30 // Author: Andrew Howard
31 // Date: 6 Feb 2003
32 ///////////////////////////////////////////////////////////////////////////
33 
34 #ifndef AMCL_SENSOR_H
35 #define AMCL_SENSOR_H
36 
37 #include "../pf/pf.h"
38 
39 /// @cond EXTERNAL
40 
41 namespace amcl
42 {
43 
44 // Forward declarations
45 class AMCLSensorData;
46 
47 
48 // Base class for all AMCL sensors
49 class AMCLSensor
50 {
51  // Default constructor
52  public: AMCLSensor();
53 
54  // Default destructor
55  public: virtual ~AMCLSensor();
56 
57  // Update the filter based on the action model. Returns true if the filter
58  // has been updated.
59  public: virtual bool UpdateAction(pf_t *pf, AMCLSensorData *data);
60 
61  // Initialize the filter based on the sensor model. Returns true if the
62  // filter has been initialized.
63  public: virtual bool InitSensor(pf_t *pf, AMCLSensorData *data);
64 
65  // Update the filter based on the sensor model. Returns true if the
66  // filter has been updated.
67  public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data);
68 
69  // Flag is true if this is the action sensor
70  public: bool is_action;
71 
72  // Action pose (action sensors only)
73  public: pf_vector_t pose;
74 
75  // AMCL Base
76  //protected: AdaptiveMCL & AMCL;
77 
78 #ifdef INCLUDE_RTKGUI
79  // Setup the GUI
80  public: virtual void SetupGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
81 
82  // Finalize the GUI
83  public: virtual void ShutdownGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
84 
85  // Draw sensor data
86  public: virtual void UpdateGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig, AMCLSensorData *data);
87 #endif
88 };
89 
90 
91 
92 // Base class for all AMCL sensor measurements
93 class AMCLSensorData
94 {
95  // Pointer to sensor that generated the data
96  public: AMCLSensor *sensor;
97  virtual ~AMCLSensorData() {}
98 
99  // Data timestamp
100  public: double time;
101 };
102 
103 }
104 
105 /// @endcond
106 
107 #endif