00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef CPARTICLEFILTER_H
00029 #define CPARTICLEFILTER_H
00030
00031 #include <mrpt/utils/utils_defs.h>
00032 #include <mrpt/utils/CDebugOutputCapable.h>
00033 #include <mrpt/utils/CLoadableOptions.h>
00034
00035 namespace mrpt
00036 {
00037 namespace slam
00038 {
00039 class CActionCollection;
00040 class CSensoryFrame;
00041 }
00042
00045 namespace bayes
00046 {
00047 class CParticleFilterCapable;
00048
00063 class MRPTDLLIMPEXP CParticleFilter : public mrpt::utils::CDebugOutputCapable
00064 {
00065 public:
00066
00076 enum TParticleFilterAlgorithm
00077 {
00078 pfStandardProposal = 0,
00079 pfAuxiliaryPFStandard,
00080 pfOptimalProposal,
00081 pfAuxiliaryPFOptimal
00082 };
00083
00093 enum TParticleResamplingAlgorithm
00094 {
00095 prMultinomial = 0,
00096 prResidual,
00097 prStratified,
00098 prSystematic
00099 };
00100
00103 struct MRPTDLLIMPEXP TParticleFilterOptions : public mrpt::utils::CLoadableOptions
00104 {
00105 public:
00108 TParticleFilterOptions();
00109
00112 void loadFromConfigFile(
00113 const mrpt::utils::CConfigFileBase &source,
00114 const std::string §ion);
00115
00118 void dumpToTextStream(utils::CStream &out);
00119
00122 bool adaptiveSampleSize;
00123
00126 double BETA;
00127
00130 unsigned int sampleSize;
00131
00134 unsigned int pfAuxFilterOptimal_MaximumSearchSamples;
00135
00138 double powFactor;
00139
00142 TParticleFilterAlgorithm PF_algorithm;
00143
00146 TParticleResamplingAlgorithm resamplingMethod;
00147 };
00148
00149
00152 struct MRPTDLLIMPEXP TParticleFilterStats
00153 {
00154 TParticleFilterStats() : ESS_beforeResample(0), weightsVariance_beforeResample (0) { }
00155 double ESS_beforeResample;
00156 double weightsVariance_beforeResample;
00157 };
00158
00168 CParticleFilter(
00169 CParticleFilterCapable *obj,
00170 const TParticleFilterOptions &opts );
00171
00175 CParticleFilter( );
00176
00177 CParticleFilter(const CParticleFilter &o) : m_options(o.m_options), m_obj(o.m_obj) { }
00178
00179 CParticleFilter & operator =(const CParticleFilter &o)
00180 {
00181 m_obj = o.m_obj;
00182 m_options = o.m_options;
00183 return *this;
00184 }
00185
00186 ~CParticleFilter() {}
00187
00197 MRPT_DEPRECATED_PRE void execute(
00198 const mrpt::slam::CActionCollection * action,
00199 const mrpt::slam::CSensoryFrame * observation,
00200 TParticleFilterStats *stats = NULL) MRPT_DEPRECATED_POST;
00201
00212 void executeOn(
00213 CParticleFilterCapable &obj,
00214 const mrpt::slam::CActionCollection *action,
00215 const mrpt::slam::CSensoryFrame *observation,
00216 TParticleFilterStats *stats = NULL);
00217
00218
00221 CParticleFilter::TParticleFilterOptions m_options;
00222
00223 protected:
00226 CParticleFilterCapable *m_obj;
00227
00228 };
00229
00230 }
00231 }
00232 #endif