laser.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 laser sensor. 00026 * Author: Andrew Howard 00027 * Date: 15 Dec 2002 00028 * CVS: $Id: laser.h 8108 2009-07-23 23:03:37Z thjc $ 00029 *************************************************************************/ 00030 00031 #ifndef LASER_H 00032 #define LASER_H 00033 00034 #include "../pf/pf.h" 00035 #include "../map/map.h" 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 00042 // Info for a single range measurement 00043 typedef struct 00044 { 00045 double range, bearing; 00046 00047 } laser_range_t; 00048 00049 00050 // Model information 00051 typedef struct 00052 { 00053 // Pointer to the map 00054 map_t *map; 00055 00056 // Laser pose relative to robot 00057 pf_vector_t laser_pose; 00058 00059 // Covariance in the range reading 00060 double range_cov; 00061 00062 // Probability of spurious range readings 00063 double range_bad; 00064 00065 // Pre-computed laser sensor model 00066 int lut_size; 00067 double lut_res; 00068 double *lut_probs; 00069 00070 // Laser (range, bearing) values 00071 int range_count; 00072 laser_range_t *ranges; 00073 00074 } laser_t; 00075 00076 00077 // Create an sensor model 00078 laser_t *laser_alloc(map_t *map); 00079 00080 // Free an sensor model 00081 void laser_free(laser_t *sensor); 00082 00083 // Clear all existing range readings 00084 void laser_clear_ranges(laser_t *sensor); 00085 00086 // Set the laser range readings that will be used. 00087 void laser_add_range(laser_t *sensor, double range, double bearing); 00088 00089 // The sensor model function 00090 double laser_sensor_model(laser_t *sensor, pf_vector_t pose); 00091 00092 00093 #ifdef __cplusplus 00094 } 00095 #endif 00096 00097 #endif 00098