$search
00001 /* 00002 * Player - One Hell of a Robot Server 00003 * Copyright (C) 2000 Brian Gerkey et al. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 */ 00021 // 00022 // Desc: LASER sensor model for AMCL 00023 // Author: Andrew Howard 00024 // Date: 17 Aug 2003 00025 // CVS: $Id: amcl_laser.h 6443 2008-05-15 19:46:11Z gerkey $ 00026 // 00028 00029 #ifndef AMCL_LASER_H 00030 #define AMCL_LASER_H 00031 00032 #include "amcl_sensor.h" 00033 #include "../map/map.h" 00034 00035 namespace amcl 00036 { 00037 00038 typedef enum 00039 { 00040 LASER_MODEL_BEAM, 00041 LASER_MODEL_LIKELIHOOD_FIELD 00042 } laser_model_t; 00043 00044 // Laser sensor data 00045 class AMCLLaserData : public AMCLSensorData 00046 { 00047 public: 00048 AMCLLaserData () {ranges=NULL;}; 00049 virtual ~AMCLLaserData() {delete [] ranges;}; 00050 // Laser range data (range, bearing tuples) 00051 public: int range_count; 00052 public: double range_max; 00053 public: double (*ranges)[2]; 00054 }; 00055 00056 00057 // Laseretric sensor model 00058 class AMCLLaser : public AMCLSensor 00059 { 00060 // Default constructor 00061 public: AMCLLaser(size_t max_beams, map_t* map); 00062 00063 public: void SetModelBeam(double z_hit, 00064 double z_short, 00065 double z_max, 00066 double z_rand, 00067 double sigma_hit, 00068 double labda_short, 00069 double chi_outlier); 00070 00071 public: void SetModelLikelihoodField(double z_hit, 00072 double z_rand, 00073 double sigma_hit, 00074 double max_occ_dist); 00075 00076 // Update the filter based on the sensor model. Returns true if the 00077 // filter has been updated. 00078 public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data); 00079 00080 // Set the laser's pose after construction 00081 public: void SetLaserPose(pf_vector_t& laser_pose) 00082 {this->laser_pose = laser_pose;} 00083 00084 // Determine the probability for the given pose 00085 private: static double BeamModel(AMCLLaserData *data, 00086 pf_sample_set_t* set); 00087 // Determine the probability for the given pose 00088 private: static double LikelihoodFieldModel(AMCLLaserData *data, 00089 pf_sample_set_t* set); 00090 00091 private: laser_model_t model_type; 00092 00093 // Current data timestamp 00094 private: double time; 00095 00096 // The laser map 00097 private: map_t *map; 00098 00099 // Laser offset relative to robot 00100 private: pf_vector_t laser_pose; 00101 00102 // Max beams to consider 00103 private: int max_beams; 00104 00105 // Laser model params 00106 // 00107 // Mixture params for the components of the model; must sum to 1 00108 private: double z_hit; 00109 private: double z_short; 00110 private: double z_max; 00111 private: double z_rand; 00112 // 00113 // Stddev of Gaussian model for laser hits. 00114 private: double sigma_hit; 00115 // Decay rate of exponential model for short readings. 00116 private: double lambda_short; 00117 // Threshold for outlier rejection (unused) 00118 private: double chi_outlier; 00119 }; 00120 00121 00122 } 00123 00124 #endif