23 namespace mrpt {
namespace obs {
class CActionCollection; } }
24 namespace mrpt {
namespace obs {
class CSensoryFrame; } }
33 mrpt::utils::COutputLogger(
"CParticleFilter"),
58 obj.prediction_and_update( action, observation,
m_options );
62 obj.normalizeWeights();
68 const size_t M =
obj.particlesCount();
76 double weightsMean = 0, var = 0;
77 for (
size_t i=0;i<M;i++) weightsMean+=exp(
obj.getW(i));
79 for (
size_t i=0;i<M;i++) var+=
square(exp(
obj.getW(i))-weightsMean);
107 adaptiveSampleSize ( false ),
110 pfAuxFilterOptimal_MaximumSearchSamples ( 100 ),
112 PF_algorithm ( pfStandardProposal ),
113 resamplingMethod ( prMultinomial ),
114 max_loglikelihood_dyn_range ( 15 ),
115 pfAuxFilterStandard_FirstStageWeightsMonteCarlo ( false ),
116 pfAuxFilterOptimal_MLE(false)
125 out.
printf(
"\n----------- [CParticleFilter::TParticleFilterOptions] ------------ \n\n");
127 out.
printf(
"PF_algorithm = ");
128 switch (PF_algorithm)
135 out.
printf(
"UNKNOWN!!\n");
break;
138 out.
printf(
"m_resamplingMethod = ");
139 switch (resamplingMethod)
146 out.
printf(
"UNKNOWN!!\n");
break;
149 out.
printf(
"adaptiveSampleSize = %c\n", adaptiveSampleSize ?
'Y':
'N' );
150 out.
printf(
"sampleSize = %i\n", sampleSize );
151 out.
printf(
"BETA = %f\n", BETA );
152 out.
printf(
"pfAuxFilterOptimal_MaximumSearchSamples = %i\n", pfAuxFilterOptimal_MaximumSearchSamples );
153 out.
printf(
"powFactor = %f\n", powFactor);
154 out.
printf(
"max_loglikelihood_dyn_range = %f\n", max_loglikelihood_dyn_range);
155 out.
printf(
"pfAuxFilterStandard_FirstStageWeightsMonteCarlo = %c\n", pfAuxFilterStandard_FirstStageWeightsMonteCarlo ?
'Y':
'N');
156 out.
printf(
"pfAuxFilterOptimal_MLE = %c\n", pfAuxFilterOptimal_MLE?
'Y':
'N');
175 ASSERT_(max_loglikelihood_dyn_range>=0)
190 MRPT_LOAD_CONFIG_VAR(pfAuxFilterStandard_FirstStageWeightsMonteCarlo,
bool, iniFile,section.c_str());
#define MRPT_LOAD_CONFIG_VAR_CAST_NO_DEFAULT(variableName, variableType, variableTypeCast, configFileObject, sectionNameStr)
#define MRPT_LOAD_CONFIG_VAR_NO_DEFAULT(variableName, variableType, configFileObject, sectionNameStr)
#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...
#define MRPT_LOG_DEBUG(_STRING)
This virtual class defines the interface that any particles based PDF class must implement in order t...
CParticleFilter()
Default constructor.
CParticleFilter::TParticleFilterOptions m_options
The options to be used in the PF, must be set before executing any step of the particle filter.
TParticleResamplingAlgorithm
Defines the different resampling algorithms.
void executeOn(CParticleFilterCapable &obj, const mrpt::obs::CActionCollection *action, const mrpt::obs::CSensoryFrame *observation, TParticleFilterStats *stats=NULL)
Executes a complete prediction + update step of the selected particle filtering algorithm.
TParticleFilterAlgorithm
Defines different types of particle filter 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...
This class allows loading and storing values and vectors of different types from a configuration text...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
GLsizei GLsizei GLuint * obj
GLsizei const GLchar ** string
The namespace for Bayesian filtering algorithm: different particle filters and Kalman filter algorith...
T square(const T x)
Inline function for the square of a number.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form,...
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
TParticleFilterAlgorithm PF_algorithm
The PF algorithm to use (default=pfStandardProposal) See TParticleFilterAlgorithm for the posibilitie...
double BETA
The resampling of particles will be performed when ESS (in range [0,1]) < BETA (default is 0....
TParticleFilterOptions()
Initilization of default parameters.
bool adaptiveSampleSize
A flag that indicates whether the CParticleFilterCapable object should perform adative sample size (d...
Statistics for being returned from the "execute" method.
double ESS_beforeResample
double weightsVariance_beforeResample