amcl_laser.h
Go to the documentation of this file.
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000 Brian Gerkey et al.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  */
21 //
22 // Desc: LASER sensor model for AMCL
23 // Author: Andrew Howard
24 // Date: 17 Aug 2003
25 // CVS: $Id: amcl_laser.h 6443 2008-05-15 19:46:11Z gerkey $
26 //
28 
29 #ifndef AMCL_LASER_H
30 #define AMCL_LASER_H
31 
32 #include "amcl_sensor.h"
33 #include "../map/map.h"
34 
35 namespace amcl
36 {
37 
38 typedef enum
39 {
44 
45 // Laser sensor data
47 {
48  public:
49  AMCLLaserData () {ranges=NULL;};
50  virtual ~AMCLLaserData() {delete [] ranges;};
51  // Laser range data (range, bearing tuples)
52  public: int range_count;
53  public: double range_max;
54  public: double (*ranges)[2];
55 };
56 
57 
58 // Laseretric sensor model
59 class AMCLLaser : public AMCLSensor
60 {
61  // Default constructor
62  public: AMCLLaser(size_t max_beams, map_t* map);
63 
64  public: virtual ~AMCLLaser();
65 
66  public: void SetModelBeam(double z_hit,
67  double z_short,
68  double z_max,
69  double z_rand,
70  double sigma_hit,
71  double lambda_short,
72  double chi_outlier);
73 
74  public: void SetModelLikelihoodField(double z_hit,
75  double z_rand,
76  double sigma_hit,
77  double max_occ_dist);
78 
79  //a more probabilistically correct model - also with the option to do beam skipping
80  public: void SetModelLikelihoodFieldProb(double z_hit,
81  double z_rand,
82  double sigma_hit,
83  double max_occ_dist,
84  bool do_beamskip,
85  double beam_skip_distance,
86  double beam_skip_threshold,
88 
89  // Update the filter based on the sensor model. Returns true if the
90  // filter has been updated.
91  public: virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data);
92 
93  // Set the laser's pose after construction
95  {this->laser_pose = laser_pose;}
96 
97  // Determine the probability for the given pose
98  private: static double BeamModel(AMCLLaserData *data,
99  pf_sample_set_t* set);
100  // Determine the probability for the given pose
101  private: static double LikelihoodFieldModel(AMCLLaserData *data,
102  pf_sample_set_t* set);
103 
104  // Determine the probability for the given pose - more probablistic model
105  private: static double LikelihoodFieldModelProb(AMCLLaserData *data,
106  pf_sample_set_t* set);
107 
108  private: void reallocTempData(int max_samples, int max_obs);
109 
111 
112  // Current data timestamp
113  private: double time;
114 
115  // The laser map
116  private: map_t *map;
117 
118  // Laser offset relative to robot
120 
121  // Max beams to consider
122  private: int max_beams;
123 
124  // Beam skipping parameters (used by LikelihoodFieldModelProb model)
125  private: bool do_beamskip;
126  private: double beam_skip_distance;
127  private: double beam_skip_threshold;
128  //threshold for the ratio of invalid beams - at which all beams are integrated to the likelihoods
129  //this would be an error condition
130  private: double beam_skip_error_threshold;
131 
132  //temp data that is kept before observations are integrated to each particle (requried for beam skipping)
133  private: int max_samples;
134  private: int max_obs;
135  private: double **temp_obs;
136 
137  // Laser model params
138  //
139  // Mixture params for the components of the model; must sum to 1
140  private: double z_hit;
141  private: double z_short;
142  private: double z_max;
143  private: double z_rand;
144  //
145  // Stddev of Gaussian model for laser hits.
146  private: double sigma_hit;
147  // Decay rate of exponential model for short readings.
148  private: double lambda_short;
149  // Threshold for outlier rejection (unused)
150  private: double chi_outlier;
151 };
152 
153 
154 }
155 
156 #endif
amcl::AMCLLaser::LikelihoodFieldModelProb
static double LikelihoodFieldModelProb(AMCLLaserData *data, pf_sample_set_t *set)
Definition: amcl_laser.cpp:305
amcl::AMCLLaser::beam_skip_threshold
double beam_skip_threshold
Definition: amcl_laser.h:127
amcl::LASER_MODEL_BEAM
@ LASER_MODEL_BEAM
Definition: amcl_laser.h:40
amcl::AMCLLaserData::AMCLLaserData
AMCLLaserData()
Definition: amcl_laser.h:49
amcl::AMCLLaser::~AMCLLaser
virtual ~AMCLLaser()
Definition: amcl_laser.cpp:56
amcl::AMCLLaser::sigma_hit
double sigma_hit
Definition: amcl_laser.h:146
amcl::AMCLLaser
Definition: amcl_laser.h:59
pf_vector_t
Definition: pf_vector.h:38
amcl::AMCLLaser::beam_skip_distance
double beam_skip_distance
Definition: amcl_laser.h:126
amcl::laser_model_t
laser_model_t
Definition: amcl_laser.h:38
amcl::AMCLLaserData
Definition: amcl_laser.h:46
amcl::LASER_MODEL_LIKELIHOOD_FIELD
@ LASER_MODEL_LIKELIHOOD_FIELD
Definition: amcl_laser.h:41
amcl::AMCLLaser::model_type
laser_model_t model_type
Definition: amcl_laser.h:110
amcl::AMCLLaser::z_hit
double z_hit
Definition: amcl_laser.h:140
amcl::LASER_MODEL_LIKELIHOOD_FIELD_PROB
@ LASER_MODEL_LIKELIHOOD_FIELD_PROB
Definition: amcl_laser.h:42
amcl::AMCLLaser::SetModelLikelihoodFieldProb
void SetModelLikelihoodFieldProb(double z_hit, double z_rand, double sigma_hit, double max_occ_dist, bool do_beamskip, double beam_skip_distance, double beam_skip_threshold, double beam_skip_error_threshold)
Definition: amcl_laser.cpp:100
amcl::AMCLLaserData::ranges
double(* ranges)[2]
Definition: amcl_laser.h:54
amcl::AMCLLaser::reallocTempData
void reallocTempData(int max_samples, int max_obs)
Definition: amcl_laser.cpp:496
amcl::AMCLSensorData
Definition: amcl_sensor.h:85
_pf_sample_set_t
Definition: pf.h:90
amcl::AMCLLaser::z_short
double z_short
Definition: amcl_laser.h:141
amcl::AMCLLaser::SetModelLikelihoodField
void SetModelLikelihoodField(double z_hit, double z_rand, double sigma_hit, double max_occ_dist)
Definition: amcl_laser.cpp:86
data
data
_pf_t
Definition: pf.h:112
amcl::AMCLLaser::time
double time
Definition: amcl_laser.h:113
amcl::AMCLLaser::LikelihoodFieldModel
static double LikelihoodFieldModel(AMCLLaserData *data, pf_sample_set_t *set)
Definition: amcl_laser.cpp:215
amcl::AMCLLaserData::~AMCLLaserData
virtual ~AMCLLaserData()
Definition: amcl_laser.h:50
amcl::AMCLLaser::beam_skip_error_threshold
double beam_skip_error_threshold
Definition: amcl_laser.h:130
amcl::AMCLLaser::SetLaserPose
void SetLaserPose(pf_vector_t &laser_pose)
Definition: amcl_laser.h:94
amcl::AMCLLaser::chi_outlier
double chi_outlier
Definition: amcl_laser.h:150
amcl::AMCLLaser::UpdateSensor
virtual bool UpdateSensor(pf_t *pf, AMCLSensorData *data)
Definition: amcl_laser.cpp:123
amcl::AMCLLaser::map
map_t * map
Definition: amcl_laser.h:116
amcl_sensor.h
amcl::AMCLLaser::do_beamskip
bool do_beamskip
Definition: amcl_laser.h:125
amcl::AMCLLaser::max_obs
int max_obs
Definition: amcl_laser.h:134
amcl::AMCLLaser::max_beams
int max_beams
Definition: amcl_laser.h:122
amcl::AMCLLaser::z_rand
double z_rand
Definition: amcl_laser.h:143
amcl::AMCLLaser::lambda_short
double lambda_short
Definition: amcl_laser.h:148
amcl::AMCLLaser::z_max
double z_max
Definition: amcl_laser.h:142
amcl::AMCLLaser::SetModelBeam
void SetModelBeam(double z_hit, double z_short, double z_max, double z_rand, double sigma_hit, double lambda_short, double chi_outlier)
Definition: amcl_laser.cpp:67
map_t
Definition: map.h:61
amcl::AMCLSensor
Definition: amcl_sensor.h:41
amcl::AMCLLaser::BeamModel
static double BeamModel(AMCLLaserData *data, pf_sample_set_t *set)
Definition: amcl_laser.cpp:144
amcl::AMCLLaser::temp_obs
double ** temp_obs
Definition: amcl_laser.h:135
amcl::AMCLLaser::max_samples
int max_samples
Definition: amcl_laser.h:133
amcl::AMCLLaser::laser_pose
pf_vector_t laser_pose
Definition: amcl_laser.h:119
amcl::AMCLLaserData::range_count
int range_count
Definition: amcl_laser.h:50
amcl::AMCLLaser::AMCLLaser
AMCLLaser(size_t max_beams, map_t *map)
Definition: amcl_laser.cpp:44
amcl::AMCLLaserData::range_max
double range_max
Definition: amcl_laser.h:53
amcl
Definition: amcl_laser.h:35


amcl
Author(s): Brian P. Gerkey, contradict@gmail.com
autogenerated on Mon Mar 6 2023 03:50:13