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 // Forward declarations
44 class AMCLSensorData;
45 
46 // Base class for all AMCL sensors
47 class AMCLSensor
48 {
49  // Default constructor
50 public:
51  AMCLSensor();
52 
53  // Default destructor
54 public:
55  virtual ~AMCLSensor();
56 
57  // Update the filter based on the action model. Returns true if the filter
58  // has been updated.
59 public:
60  virtual bool UpdateAction(pf_t *pf, AMCLSensorData *data);
61 
62  // Initialize the filter based on the sensor model. Returns true if the
63  // filter has been initialized.
64 public:
65  virtual bool InitSensor(pf_t *pf, AMCLSensorData *data);
66 
67  // Update the filter based on the sensor model. Returns true if the
68  // filter has been updated.
69 public:
70  virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data);
71 
72  // Action pose (action sensors only)
73 public:
74  pf_vector_t pose;
75 
76  // AMCL Base
77  //protected: AdaptiveMCL & AMCL;
78 
79 #ifdef INCLUDE_RTKGUI
80  // Setup the GUI
81 public:
82  virtual void SetupGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
83 
84  // Finalize the GUI
85 public:
86  virtual void ShutdownGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
87 
88  // Draw sensor data
89 public:
90  virtual void UpdateGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig, AMCLSensorData *data);
91 #endif
92 };
93 
94 // Base class for all AMCL sensor measurements
95 class AMCLSensorData
96 {
97  // Pointer to sensor that generated the data
98 public:
99  AMCLSensor *sensor;
100  virtual ~AMCLSensorData()
101  {
102  }
103 
104  // Data timestamp
105 public:
106  double time;
107 };
108 
109 } // namespace amcl
110 
111 /// @endcond
112 
113 #endif