26 class CActionCollection;
53 obj.prediction_and_update(action, observation,
m_options);
57 obj.normalizeWeights();
63 const size_t M =
obj.particlesCount();
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++)
75 var +=
square(exp(
obj.getW(i)) - weightsMean);
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");
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.
GLsizei GLsizei GLuint * obj
Declares a class for storing a collection of robot actions.
double weightsVariance_beforeResample
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. ...
T square(const T x)
Inline function for the square of a number.
#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).
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 ...
GLsizei const GLchar ** string
double BETA
The resampling of particles will be performed when ESS (in range [0,1]) < BETA (default is 0...
#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...
double powFactor
An optional step to "smooth" dramatic changes in the observation model to affect the variance of the ...
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
CParticleFilter()
Default 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 posibilitie...
bool adaptiveSampleSize
A flag that indicates whether the CParticleFilterCapable object should perform adative sample size (d...