amcl_laser.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: LASER sensor model for AMCL
23// Author: Andrew Howard
24// Date: 17 Aug 2003
25// CVS: $Id$
26//
28
29#ifndef AMCL_LASER_H
30#define AMCL_LASER_H
31
32#include "amcl_sensor.h"
33#include "map/map.h"
34#include "models/laser.h"
35
36// Laser sensor data
38{
39 public:
40 AMCLLaserData () {ranges=NULL;};
41 virtual ~AMCLLaserData() {delete [] ranges;};
42 // Laser range data (range, bearing tuples)
43 public: int range_count;
44 public: double range_max;
45 public: double (*ranges)[2];
46};
47
48
49// Laseretric sensor model
50class AMCLLaser : public AMCLSensor
51{
52 // Default constructor
53 public: AMCLLaser(AdaptiveMCL & aAMCL, player_devaddr_t addr);
54
55 // Load the model
56 public: virtual int Load(ConfigFile* cf, int section);
57
58 // Unload the model
59 public: virtual int Unload(void);
60
61 // Initialize the model
62 public: virtual int Setup(void);
63
64 // Finalize the model
65 public: virtual int Shutdown(void);
66
67 // Process message for this interface
68 public: virtual int ProcessMessage(QueuePointer &resp_queue,
69 player_msghdr * hdr,
70 void * data);
71 // Check for new sensor measurements
72 //private: virtual AMCLSensorData *GetData(void);
73
74 // Update the filter based on the sensor model. Returns true if the
75 // filter has been updated.
76 public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data);
77
78 // Determine the probability for the given pose
79 private: static double SensorModel(AMCLLaserData *data,
80 pf_sample_set_t* set);
81
82 // retrieve the map
83 private: int SetupMap(void);
84
85 // Device info
86 private: player_devaddr_t laser_addr;
87 private: player_devaddr_t map_addr;
88 private: Device *laser_dev;
89
90 // Current data timestamp
91 private: double time;
92
93 // The laser map
94 private: map_t *map;
95
96 // Laser offset relative to robot
97 private: pf_vector_t laser_pose;
98
99 // Max beams to consider
100 private: int max_beams;
101
102 // Laser range variance
103 private: double range_var;
104
105 // Probability of bad range readings
106 private: double range_bad;
107
108#ifdef INCLUDE_RTKGUI
109 // Setup the GUI
110 private: virtual void SetupGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
111
112 // Finalize the GUI
113 private: virtual void ShutdownGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig);
114
115 // Draw sensor data
116 public: virtual void UpdateGUI(rtk_canvas_t *canvas, rtk_fig_t *robot_fig, AMCLSensorData *data);
117
118 // Figures
119 private: rtk_fig_t *fig, *map_fig;
120#endif
121};
122
123
124
125
126#endif
Definition amcl_laser.h:38
Definition amcl_laser.h:51
Definition amcl_sensor.h:106
Definition amcl_sensor.h:44
Definition amcl.h:71
Class for loading configuration file information.
Definition configfile.h:197
Encapsulates a device (i.e., a driver bound to an interface)
Definition device.h:75
An autopointer for the message queue.
Definition message.h:74
Definition pf.h:94
Definition pf.h:111
Definition localization/amcl/map/map.h:67
Definition pf_vector.h:42
A device address.
Definition player.h:146
Generic message header.
Definition player.h:162