31 #ifndef __PARTICLE_FILTER__ 32 #define __PARTICLE_FILTER__ 35 #include "../pdf/conditionalpdf.h" 36 #include "../pdf/mcpdf.h" 40 #define DEFAULT_RS MULTINOMIAL_RS // Default scheme = MULTINOMIAL 41 #define MULTINOMIAL_RS 0 59 #define SYSTEMATIC_RS 1 80 #define STRATIFIED_RS 2 112 #define MINIMUM_VARIANCE_RS 4 160 :
public Filter<StateVar,MeasVar>
185 typename vector<WeightedSample<StateVar> >::iterator
_os_it;
187 typename vector<WeightedSample<StateVar> >::iterator
_ns_it;
266 int resampleperiod = 0,
267 double resamplethreshold = 0,
287 int resampleperiod = 0,
288 double resamplethreshold = 0,
319 #endif // __PARTICLE_FILTER__ Abstract class representing an interface for Bayesian Filters.
virtual MCPdf< StateVar > * PostGet()
Get Posterior density.
ParticleFilter(MCPdf< StateVar > *prior, ConditionalPdf< StateVar, StateVar > *proposal, int resampleperiod=0, double resamplethreshold=0, int resamplescheme=DEFAULT_RS)
Constructor.
double _resampleThreshold
Threshold used when dynamic resampling.
Virtual Class representing all particle filters.
ConditionalPdf< StateVar, StateVar > * ProposalGet()
Get a pointer to the proposal density.
virtual bool DynamicResampleStep()
Resample if necessary.
WeightedSample< StateVar > _sample
While updating use sample<StateVar>
bool _proposal_depends_on_meas
Proposal depends on last measurement?
vector< WeightedSample< StateVar > >::iterator _os_it
Iterator for old list of samples.
virtual bool Resample()
Actual Resampling happens here;.
int _resampleScheme
Which resample algorithm (see top of particle.h for #defines)
vector< WeightedSample< StateVar > > _old_samples
While updating store list of old samples.
vector< WeightedSample< StateVar > > _new_samples
While updating store list of new samples.
virtual bool UpdateInternal(SystemModel< StateVar > *const sysmodel, const StateVar &u, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z, const StateVar &s)
Actual implementation of Update, varies along filters.
virtual void ProposalSet(ConditionalPdf< StateVar, StateVar > *const cpdf)
Set the proposal density.
virtual bool ProposalStepInternal(SystemModel< StateVar > *const sysmodel, const StateVar &u, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z, const StateVar &s)
Proposal step.
virtual bool StaticResampleStep()
Resample if wanted.
virtual ~ParticleFilter()
Destructor.
bool _created_post
created own post
vector< WeightedSample< StateVar > >::iterator _ns_it
Iterator for new list of samples.
bool _dynamicResampling
Dynamic resampling or fixed period resampling?
virtual bool UpdateWeightsInternal(SystemModel< StateVar > *const sysmodel, const StateVar &u, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z, const StateVar &s)
Update Weights.
vector< Sample< StateVar > > _new_samples_unweighted
While resampling.
int _resamplePeriod
Number of timestep between resampling from the Posterior Pdf.
ConditionalPdf< StateVar, StateVar > * _proposal
Pointer to the Proposal Density.
Monte Carlo Pdf: Sample based implementation of Pdf.