sonar.h
00001 /* 00002 * Player - One Hell of a Robot Server 00003 * Copyright (C) 2003 00004 * Andrew Howard 00005 * Brian Gerkey 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 */ 00022 00023 00024 /************************************************************************** 00025 * Desc: Sensor models for the sonar sensor. 00026 * Author: Andrew Howard 00027 * Date: 15 Dec 2002 00028 * CVS: $Id: sonar.h 8108 2009-07-23 23:03:37Z thjc $ 00029 *************************************************************************/ 00030 00031 #ifndef SONAR_H 00032 #define SONAR_H 00033 00034 #include "../pf/pf.h" 00035 #include "../map/map.h" 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 #define SONAR_MAX_RANGES 32 00042 00043 // Model information 00044 typedef struct 00045 { 00046 // Pointer to the map 00047 map_t *map; 00048 00049 // Pose of sonars relative to robot 00050 int pose_count; 00051 pf_vector_t poses[SONAR_MAX_RANGES]; 00052 00053 // Covariance in the range reading 00054 double range_cov; 00055 00056 // Probability of spurious range readings 00057 double range_bad; 00058 00059 // Maximum valid range value 00060 double range_max; 00061 00062 // Pre-computed sonar sensor model 00063 int lut_size; 00064 double lut_res; 00065 double *lut_probs; 00066 00067 // Sonar range values 00068 int range_count; 00069 double ranges[SONAR_MAX_RANGES]; 00070 00071 } sonar_t; 00072 00073 00074 // Create an sensor model 00075 sonar_t *sonar_alloc(map_t *map, int pose_count, pf_vector_t *poses); 00076 00077 // Free an sensor model 00078 void sonar_free(sonar_t *sensor); 00079 00080 // Clear all existing range readings 00081 void sonar_clear_ranges(sonar_t *sensor); 00082 00083 // Set the sonar range readings that will be used. 00084 void sonar_add_range(sonar_t *sensor, double range); 00085 00086 // The sensor model function 00087 double sonar_sensor_model(sonar_t *sensor, pf_vector_t pose); 00088 00089 00090 #ifdef __cplusplus 00091 } 00092 #endif 00093 00094 #endif 00095