26 class CActionCollection;
71 double weightsMean = 0, var = 0;
72 for (
size_t i = 0; i < M; i++) weightsMean += exp(obj.
getW(i));
74 for (
size_t i = 0; i < M; i++)
91 "Resampling particles (ESS was %.02f)\n", obj.
ESS()));
106 PF_algorithm,
"The PF algorithm to use. See TParticleFilterAlgorithm");
109 "The resampling algorithm to use. See TParticleResamplingAlgorithm");
113 "A flag that indicates whether the CParticleFilterCapable object " 114 "should perform adative sample size (default=false)");
117 "The resampling of particles will be performed when ESS (in range " 118 "[0,1]) < BETA (default is 0.5)");
121 "The initial number of particles in the filter (it can change only if " 122 "adaptiveSampleSize=true) (default=1)");
127 "An optional step to smooth dramatic changes in the observation model " 128 "to affect the variance of the particle weights (default=1)");
131 "Only for PF_algorithm=pfAuxiliaryPFOptimal");
134 "Only for PF_algorithm==pfAuxiliaryPFStandard");
147 adaptiveSampleSize,
bool,
iniFile, section.c_str());
152 max_loglikelihood_dyn_range,
double,
iniFile, section.c_str());
153 ASSERT_(max_loglikelihood_dyn_range >= 0);
156 section,
"PF_algorithm", PF_algorithm,
true);
158 section,
"resamplingMethod", resamplingMethod,
true);
163 pfAuxFilterOptimal_MaximumSearchSamples,
int,
iniFile,
169 pfAuxFilterOptimal_MaximumSearchSamples,
int,
iniFile,
174 pfAuxFilterStandard_FirstStageWeightsMonteCarlo,
bool,
iniFile,
177 pfAuxFilterOptimal_MLE,
bool,
iniFile, section.c_str());
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
#define MRPT_LOG_DEBUG(_STRING)
Use: MRPT_LOG_DEBUG("message");
std::string std::string format(std::string_view fmt, ARGS &&... args)
unsigned int pfAuxFilterOptimal_MaximumSearchSamples
In the algorithm "CParticleFilter::pfAuxiliaryPFOptimal" (and in "CParticleFilter::pfAuxiliaryPFStand...
The namespace for Bayesian filtering algorithm: different particle filters and Kalman filter algorith...
mrpt::system::COutputLogger COutputLogger
Statistics for being returned from the "execute" method.
Declares a class for storing a collection of robot actions.
double weightsVariance_beforeResample
virtual double normalizeWeights(double *out_max_log_w=nullptr)=0
Normalize the (logarithmic) weights, such as the maximum weight is zero.
virtual size_t particlesCount() const =0
Get the m_particles count.
void saveToConfigFile(mrpt::config::CConfigFileBase &target, const std::string §ion) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...
#define ASSERT_(f)
Defines an assertion mechanism.
double ESS_beforeResample
This class allows loading and storing values and vectors of different types from a configuration text...
TParticleResamplingAlgorithm
Defines the different resampling algorithms.
TParticleResamplingAlgorithm resamplingMethod
The resampling algorithm to use (default=prMultinomial).
virtual double getW(size_t i) const =0
Access to i'th particle (logarithm) weight, where first one is index 0.
string iniFile(myDataDir+string("benchmark-options.ini"))
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
This virtual class defines the interface that any particles based PDF class must implement in order t...
#define MRPT_LOAD_CONFIG_VAR_NO_DEFAULT( variableName, variableType, configFileObject, sectionNameStr)
bool pfAuxFilterStandard_FirstStageWeightsMonteCarlo
Only for PF_algorithm==pfAuxiliaryPFStandard: If false, the APF will predict the first stage weights ...
double BETA
The resampling of particles will be performed when ESS (in range [0,1]) < BETA (default is 0...
virtual double ESS() const =0
Returns the normalized ESS (Estimated Sample Size), in the range [0,1].
return_t square(const num_t x)
Inline function for the square of a number.
#define MRPT_LOAD_CONFIG_VAR( variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void executeOn(CParticleFilterCapable &obj, const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, TParticleFilterStats *stats=nullptr)
Executes a complete prediction + update step of the selected particle filtering algorithm.
TParticleFilterAlgorithm
Defines different types of particle filter algorithms.
double max_loglikelihood_dyn_range
Only for PF_algorithm=pfAuxiliaryPFOptimal: If a given particle has a max_likelihood (from the a-prio...
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.
double powFactor
An optional step to "smooth" dramatic changes in the observation model to affect the variance of the ...
CParticleFilter()
Default constructor.
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.
#define MRPT_SAVE_CONFIG_VAR_COMMENT(variableName, __comment)
unsigned int sampleSize
The initial number of particles in the filter (it can change only if adaptiveSampleSize=true) (defaul...
bool pfAuxFilterOptimal_MLE
(Default=false) In the algorithm "CParticleFilter::pfAuxiliaryPFOptimal", if set to true...
CParticleFilter::TParticleFilterOptions m_options
The options to be used in the PF, must be set before executing any step of the particle filter...
TParticleFilterAlgorithm PF_algorithm
The PF algorithm to use (default=pfStandardProposal) See TParticleFilterAlgorithm for the possibiliti...
bool adaptiveSampleSize
A flag that indicates whether the CParticleFilterCapable object should perform adative sample size (d...