Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __PARTICLE_FILTER__
00032 #define __PARTICLE_FILTER__
00033
00034 #include "filter.h"
00035 #include "../pdf/conditionalpdf.h"
00036 #include "../pdf/mcpdf.h"
00037
00038
00039
00040 #define DEFAULT_RS MULTINOMIAL_RS // Default scheme = MULTINOMIAL
00041 #define MULTINOMIAL_RS 0
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #define SYSTEMATIC_RS 1
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 #define STRATIFIED_RS 2
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 #define RESIDUAL_RS 3
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 #define MINIMUM_VARIANCE_RS 4
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123 namespace BFL
00124 {
00125
00127
00159 template <typename StateVar, typename MeasVar> class ParticleFilter
00160 : public Filter<StateVar,MeasVar>
00161 {
00162 protected:
00163 virtual bool UpdateInternal(SystemModel<StateVar>* const sysmodel,
00164 const StateVar& u,
00165 MeasurementModel<MeasVar,StateVar>* const measmodel,
00166 const MeasVar& z,
00167 const StateVar& s);
00168
00170
00174 ConditionalPdf<StateVar,StateVar> * _proposal;
00175
00177 WeightedSample<StateVar> _sample;
00179 vector<WeightedSample<StateVar> > _old_samples;
00181 vector<WeightedSample<StateVar> > _new_samples;
00183 vector<Sample<StateVar> > _new_samples_unweighted;
00185 typename vector<WeightedSample<StateVar> >::iterator _os_it;
00187 typename vector<WeightedSample<StateVar> >::iterator _ns_it;
00188
00190
00193 int _resamplePeriod;
00194
00196 double _resampleThreshold;
00197
00199 int _resampleScheme;
00200
00202 bool _dynamicResampling;
00203
00205 bool _proposal_depends_on_meas;
00206
00208 bool _created_post;
00209
00211
00219 virtual bool ProposalStepInternal(SystemModel<StateVar> * const sysmodel,
00220 const StateVar & u,
00221 MeasurementModel<MeasVar,StateVar> * const measmodel,
00222 const MeasVar & z,
00223 const StateVar & s);
00224
00226
00232 virtual bool UpdateWeightsInternal(SystemModel<StateVar> * const sysmodel,
00233 const StateVar & u,
00234 MeasurementModel<MeasVar,StateVar> * const measmodel,
00235 const MeasVar & z,
00236 const StateVar & s);
00237
00239
00241 virtual bool DynamicResampleStep();
00242
00244
00246 virtual bool StaticResampleStep();
00247
00249 virtual bool Resample();
00250
00251 public:
00253
00264 ParticleFilter(MCPdf<StateVar> * prior,
00265 ConditionalPdf<StateVar,StateVar> * proposal,
00266 int resampleperiod = 0,
00267 double resamplethreshold = 0,
00268 int resamplescheme = DEFAULT_RS);
00269
00270
00272
00284 ParticleFilter(MCPdf<StateVar> * prior,
00285 MCPdf<StateVar> * post,
00286 ConditionalPdf<StateVar,StateVar> * proposal,
00287 int resampleperiod = 0,
00288 double resamplethreshold = 0,
00289 int resamplescheme = DEFAULT_RS);
00290
00292 virtual ~ParticleFilter();
00294
00296 ParticleFilter(const ParticleFilter<StateVar,MeasVar> & filt);
00297
00299
00304 virtual void ProposalSet(ConditionalPdf<StateVar,StateVar>* const cpdf);
00305
00307
00309 ConditionalPdf<StateVar,StateVar> * ProposalGet();
00310
00311
00312 virtual MCPdf<StateVar> * PostGet();
00313 };
00314
00315 #include "particlefilter.cpp"
00316
00317 }
00318
00319 #endif // __PARTICLE_FILTER__
bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Mon Feb 11 2019 03:45:12