9 #ifndef CPARTICLEFILTERCAPABLE_H
10 #define CPARTICLEFILTERCAPABLE_H
19 #define INVALID_LIKELIHOOD_VALUE (-1e300)
54 typedef double ( *TParticleProbabilityEvaluator) (
59 const void * observation );
70 const void * observation )
73 return obj->
getW(index);
96 TParticleProbabilityEvaluator partEvaluator = defaultEvaluator,
97 const void * action = NULL,
98 const void * observation = NULL
115 virtual double getW(
size_t i)
const = 0;
119 virtual void setW(
size_t i,
double w) = 0;
149 virtual double ESS()
const = 0;
168 const std::vector<double> &in_logWeights,
169 std::vector<size_t> &out_indexes,
170 size_t out_particle_count = 0
177 const std::vector<double> &in_logWeights,
178 std::vector<double> &out_linWeights );
219 alreadyDrawnIndexes(),
220 alreadyDrawnNextOne(0)
This virtual class defines the interface that any particles based PDF class must implement in order t...
TFastDrawAuxVars m_fastDrawAuxiliary
Auxiliary vectors, see CParticleFilterCapable::prepareFastDrawSample for more information.
virtual void prediction_and_update_pfStandardProposal(const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options)
Performs the particle filter prediction/update stages for the algorithm "pfStandardProposal" (if not ...
virtual void prediction_and_update_pfAuxiliaryPFOptimal(const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options)
Performs the particle filter prediction/update stages for the algorithm "pfAuxiliaryPFOptimal" (if no...
virtual void prediction_and_update_pfAuxiliaryPFStandard(const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options)
Performs the particle filter prediction/update stages for the algorithm "pfAuxiliaryPFStandard" (if n...
virtual double ESS() const =0
Returns the normalized ESS (Estimated Sample Size), in the range [0,1].
virtual double normalizeWeights(double *out_max_log_w=NULL)=0
Normalize the (logarithmic) weights, such as the maximum weight is zero.
static void log2linearWeights(const std::vector< double > &in_logWeights, std::vector< double > &out_linWeights)
A static method to compute the linear, normalized (the sum the unity) weights from log-weights.
virtual double getW(size_t i) const =0
Access to i'th particle (logarithm) weight, where first one is index 0.
virtual size_t particlesCount() const =0
Get the m_particles count.
virtual ~CParticleFilterCapable()
Virtual destructor.
void prediction_and_update(const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options)
Performs the prediction stage of the Particle Filter.
static void computeResampling(CParticleFilter::TParticleResamplingAlgorithm method, const std::vector< double > &in_logWeights, std::vector< size_t > &out_indexes, size_t out_particle_count=0)
A static method to perform the computation of the samples resulting from resampling a given set of pa...
static const unsigned PARTICLE_FILTER_CAPABLE_FAST_DRAW_BINS
virtual void performSubstitution(const std::vector< size_t > &indx)=0
Performs the substitution for internal use of resample in particle filter algorithm,...
void performResampling(const bayes::CParticleFilter::TParticleFilterOptions &PF_options, size_t out_particle_count=0)
Performs a resample of the m_particles, using the method selected in the constructor.
void prepareFastDrawSample(const bayes::CParticleFilter::TParticleFilterOptions &PF_options, TParticleProbabilityEvaluator partEvaluator=defaultEvaluator, const void *action=NULL, const void *observation=NULL) const
Prepares data structures for calling fastDrawSample method next.
static double defaultEvaluator(const bayes::CParticleFilter::TParticleFilterOptions &PF_options, const CParticleFilterCapable *obj, size_t index, const void *action, const void *observation)
The default evaluator function, which simply returns the particle weight.
size_t fastDrawSample(const bayes::CParticleFilter::TParticleFilterOptions &PF_options) const
Draws a random sample from the particle filter, in such a way that each particle has a probability pr...
virtual void prediction_and_update_pfOptimalProposal(const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, const bayes::CParticleFilter::TParticleFilterOptions &PF_options)
Performs the particle filter prediction/update stages for the algorithm "pfOptimalProposal" (if not i...
virtual void setW(size_t i, double w)=0
Modifies i'th particle (logarithm) weight, where first one is index 0.
This class acts as a common interface to the different interfaces (see CParticleFilter::TParticleFilt...
TParticleResamplingAlgorithm
Defines the different resampling algorithms.
Declares a class for storing a collection of robot actions.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
std::vector< uint32_t > vector_uint
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
The configuration of a particle filter.
Auxiliary vectors, see CParticleFilterCapable::prepareFastDrawSample for more information.
std::vector< double > PDF
std::vector< double > CDF
size_t alreadyDrawnNextOne
vector_uint alreadyDrawnIndexes