sonar.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 sonar sensor.
26  * Author: Andrew Howard
27  * Date: 15 Dec 2002
28  * CVS: $Id$
29  *************************************************************************/
30 
31 #ifndef SONAR_H
32 #define SONAR_H
33 
34 #include "../pf/pf.h"
35 #include "../map/map.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #define SONAR_MAX_RANGES 32
42 
43 // Model information
44 typedef struct
45 {
46  // Pointer to the map
47  map_t *map;
48 
49  // Pose of sonars relative to robot
50  int pose_count;
51  pf_vector_t poses[SONAR_MAX_RANGES];
52 
53  // Covariance in the range reading
54  double range_cov;
55 
56  // Probability of spurious range readings
57  double range_bad;
58 
59  // Maximum valid range value
60  double range_max;
61 
62  // Pre-computed sonar sensor model
63  int lut_size;
64  double lut_res;
65  double *lut_probs;
66 
67  // Sonar range values
68  int range_count;
69  double ranges[SONAR_MAX_RANGES];
70 
71 } sonar_t;
72 
73 
74 // Create an sensor model
75 sonar_t *sonar_alloc(map_t *map, int pose_count, pf_vector_t *poses);
76 
77 // Free an sensor model
78 void sonar_free(sonar_t *sensor);
79 
80 // Clear all existing range readings
81 void sonar_clear_ranges(sonar_t *sensor);
82 
83 // Set the sonar range readings that will be used.
84 void sonar_add_range(sonar_t *sensor, double range);
85 
86 // The sensor model function
87 double sonar_sensor_model(sonar_t *sensor, pf_vector_t pose);
88 
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif
95 
Definition: sonar.h:43
Definition: pf_vector.h:40
Definition: localization/amcl/map/map.h:65