laser.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2003
4  * Andrew Howard
5  * Brian Gerkey
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  */
22 
23 
24 /**************************************************************************
25  * Desc: Sensor models for the laser sensor.
26  * Author: Andrew Howard
27  * Date: 15 Dec 2002
28  * CVS: $Id$
29  *************************************************************************/
30 
31 #ifndef LASER_H
32 #define LASER_H
33 
34 #include "../pf/pf.h"
35 #include "../map/map.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 
42 // Info for a single range measurement
43 typedef struct
44 {
45  double range, bearing;
46 
48 
49 
50 // Model information
51 typedef struct
52 {
53  // Pointer to the map
54  map_t *map;
55 
56  // Laser pose relative to robot
57  pf_vector_t laser_pose;
58 
59  // Covariance in the range reading
60  double range_cov;
61 
62  // Probability of spurious range readings
63  double range_bad;
64 
65  // Pre-computed laser sensor model
66  int lut_size;
67  double lut_res;
68  double *lut_probs;
69 
70  // Laser (range, bearing) values
71  int range_count;
72  laser_range_t *ranges;
73 
74 } laser_t;
75 
76 
77 // Create an sensor model
78 laser_t *laser_alloc(map_t *map);
79 
80 // Free an sensor model
81 void laser_free(laser_t *sensor);
82 
83 // Clear all existing range readings
84 void laser_clear_ranges(laser_t *sensor);
85 
86 // Set the laser range readings that will be used.
87 void laser_add_range(laser_t *sensor, double range, double bearing);
88 
89 // The sensor model function
90 double laser_sensor_model(laser_t *sensor, pf_vector_t pose);
91 
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif
98 
Request to get an integer property.
Definition: player.h:459
#define PLAYER_WARN1(msg, a)
Error message macros.
Definition: error.h:90
Definition: pf_vector.h:42
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:159
Boolean property class.
Definition: property.h:87
Generic message header.
Definition: player.h:162
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:658
Definition: cmvision.h:105
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:664
virtual void Main(void)=0
Main method for driver thread.
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:95
int32_t value
The property value.
Definition: player.h:465
#define PLAYER_MSGTYPE_RESP_ACK
A positive response message.
Definition: player.h:112
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
#define PLAYER_MSGTYPE_REQ
A request message.
Definition: player.h:106
Definition: laser.h:52
Integer property class.
Definition: property.h:115
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
Class for loading configuration file information.
Definition: configfile.h:197
#define PLAYER_CAPABILITIES_REQ
Capability request message type.
Definition: player.h:397
A device address.
Definition: player.h:146
An autopointer for the message queue.
Definition: message.h:74
#define PLAYER_ERROR(msg)
Error message macros.
Definition: error.h:81
Definition: localization/amcl/map/map.h:67
Base class for drivers which oeprate with a thread.
Definition: driver.h:553
char * key
The property key.
Definition: player.h:463
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:89
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:99
Base class for all drivers.
Definition: driver.h:109
#define PLAYER_MSG0(level, msg)
General messages.
Definition: error.h:105
#define PLAYER_MSG2(level, msg, a, b)
Error message macros.
Definition: error.h:107
#define PLAYER_SET_INTPROP_REQ
Integer property set request subtype.
Definition: player.h:432
player_devaddr_t addr
Device to which this message pertains.
Definition: player.h:164
Definition: laser.h:44