Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
particleFilter.hpp
00001 /* $Id$ */
00002 
00003 #ifndef FILTER_PARTICLE_FILTER_HPP
00004 #define FILTER_PARTICLE_FILTER_HPP
00005 
00006 #include "jmath/jblas.hpp"
00007 #include "jmath/random.hpp"
00008 
00009 #include "filter/predictModel.hpp"
00010 #include "filter/observeModel.hpp"
00011 
00012 namespace jafar {
00013   namespace filter {
00014 
00015 
00018     class ParticleFilter {
00019     public:
00020 
00021 //       typedef unsigned int syze_type;
00022 
00023       typedef std::vector<jblas::vec>::iterator STATE_IT;
00024       typedef std::vector<jblas::vec>::const_iterator STATE_CONST_IT;
00025 
00030       //      ParticleFilter(std::size_t nbParticles_, std::size_t sizeState_);
00031 
00032 //       /** Create a particle filter with a set of identical particles.
00033 //        * @param nbParticles_ The initial number of particles
00034 //        * @param initState_ The initial state of the particles
00035 //        */
00036 //       ParticleFilter(std::size_t nbParticles_, const vec& initState_);
00037 
00044       ParticleFilter(std::size_t nbParticles_, std::size_t sizeState_, 
00045                      const jblas::vec& stateMin_, const jblas::vec& stateMax_);
00046 
00047       ~ParticleFilter();
00048 
00049       inline std::size_t sizeState() const {return _sizeState;};
00050       inline std::size_t getNbParticles() const {return nbParticles;};
00051 
00052       double getWeight(std::size_t index_) const;
00053       const jblas::vec& getState(std::size_t index_) const;
00054 
00055       void predict(LinearPredictModel& m_);
00056 
00063       //void update(jafar::filter::JacobianObserveModel& m_, const jblas::vec& z_, const jblas::vec& R_);
00064       void update(jafar::filter::JacobianObserveModel& m_, double z_);
00065 
00066 //       /** Resample the particles. The number of particles remains the
00067 //        * same.
00068 //        */
00069 //       void resample();
00070 
00071 //       /** Resample a new nember of particles.
00072 //        * @param nbParticles_ The new nember of particles
00073 //        */
00074 //       void resample(int nbParticles_);
00075 
00076       const jblas::vec& getStateMean();
00077       
00079       const jblas::sym_mat& getStateCov();
00080 
00081     protected:
00082 
00083       std::size_t nbParticles;
00084       std::size_t _sizeState;
00085 
00086       jblas::vec weight;
00087       std::vector<jblas::vec> states;
00088 
00089       jblas::vec stateMean;
00090       jblas::sym_mat stateCov;
00091       bool meanAndCovUpToDate;
00092 
00093       jafar::jmath::MultiDimNormalDistribution predictNoise;
00094 
00095       void computeMeanAndCov();
00096       
00097     };
00098 
00099   } // namespace filter
00100 } // namespace jafar
00101 
00102 #endif // FILTER_PARTICLE_FILTER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:19 for Jafar by doxygen 1.7.6.1
LAAS-CNRS