amcl_sensor.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000 Brian Gerkey et al.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  */
21 //
22 // Desc: Adaptive Monte-Carlo localization
23 // Author: Andrew Howard
24 // Date: 6 Feb 2003
25 // CVS: $Id: amcl_sensor.h 9120 2013-01-07 00:18:52Z jpgr87 $
26 //
28 
29 #ifndef AMCL_SENSOR_H
30 #define AMCL_SENSOR_H
31 
32 #include "amcl.h"
33 
34 #include <libplayercore/playercore.h>
35 #include "pf/pf.h"
36 
37 
38 // Forward declarations
39 class AMCLSensorData;
40 
41 
42 // Base class for all AMCL sensors
44 {
45  // Default constructor
46  public: AMCLSensor(AdaptiveMCL & aAMCL);
47 
48  // Default destructor
49  public: virtual ~AMCLSensor();
50 
51  // Load the model
52  public: virtual int Load(ConfigFile* cf, int section);
53 
54  // Unload the model
55  public: virtual int Unload(void);
56 
57  // Initialize the model
58  public: virtual int Setup(void);
59 
60  // Finalize the model
61  public: virtual int Shutdown(void);
62 
63  // Process message for this interface
64  public: virtual int ProcessMessage(QueuePointer &resp_queue,
65  player_msghdr * hdr,
66  void * data) = 0;
67 // public: virtual AMCLSensorData *GetData(void);
68 
69  // Update the filter based on the action model. Returns true if the filter
70  // has been updated.
71  public: virtual bool UpdateAction(pf_t *pf, AMCLSensorData *data);
72 
73  // Initialize the filter based on the sensor model. Returns true if the
74  // filter has been initialized.
75  public: virtual bool InitSensor(pf_t *pf, AMCLSensorData *data);
76 
77  // Update the filter based on the sensor model. Returns true if the
78  // filter has been updated.
79  public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data);
80 
81  // Flag is true if this is the action sensor
82  public: bool is_action;
83 
84  // Action pose (action sensors only)
85  public: pf_vector_t pose;
86 
87  // AMCL Base
88  protected: AdaptiveMCL & AMCL;
89 
90 #ifdef INCLUDE_RTKGUI
91  // Setup the GUI
92  public: virtual void SetupGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
93 
94  // Finalize the GUI
95  public: virtual void ShutdownGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
96 
97  // Draw sensor data
98  public: virtual void UpdateGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig, AMCLSensorData *data);
99 #endif
100 };
101 
102 
103 
104 // Base class for all AMCL sensor measurements
106 {
107  // Pointer to sensor that generated the data
108  public: AMCLSensor *sensor;
109  virtual ~AMCLSensorData() {}
110 
111  // Data timestamp
112  public: double time;
113 };
114 
115 
116 
117 #endif
Class for loading configuration file information.
Definition: configfile.h:196
Generic message header.
Definition: player.h:161
Definition: pf.h:110
Definition: amcl_sensor.h:43
An autopointer for the message queue.
Definition: message.h:73
Definition: amcl_sensor.h:105
Definition: amcl.h:70
Definition: pf_vector.h:41