Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
predictModel.hpp
00001 /* $Id$ */
00002 
00003 #ifndef FILTER_PREDICT_MODEL_HPP
00004 #define FILTER_PREDICT_MODEL_HPP
00005 
00006 #include "boost/date_time/posix_time/posix_time_types.hpp"
00007 
00008 #include "kernel/jafarException.hpp"
00009 
00010 #include "jmath/jblas.hpp"
00011 
00012 namespace jafar {
00013   namespace filter {
00014 
00015     class KalmanFilter;
00016     class ExtendedKalmanFilter;
00017     class BlockExtendedKalmanFilter;
00018 
00023     class BasePredictModel {
00024       
00025     private:
00026 
00027       std::size_t m_sizeState;
00028     
00029     protected:
00030 
00032       boost::posix_time::time_duration m_timeStep;
00033 
00034     public:
00035 
00037       jblas::mat F;
00038 
00040       jblas::sym_mat Q;
00041 
00042       BasePredictModel(std::size_t sizeState) :
00043   m_sizeState(sizeState),
00044   m_timeStep(0,0,1,0),
00045   F(sizeState,sizeState),
00046   Q(sizeState,sizeState)
00047       {}
00048 
00049       virtual ~BasePredictModel() {}
00050 
00051       std::size_t sizeState() const {return m_sizeState;};
00052 
00053       boost::posix_time::time_duration const& getTimeStep() const {return m_timeStep;};
00054 
00057       virtual void setTimeStep(boost::posix_time::time_duration const& timeStep) {
00058   m_timeStep = timeStep;
00059       }
00060 
00061     }; // class BasePredictModel
00062 
00067     class BaseCommandPredictModel : public BasePredictModel {
00068 
00069     private:
00070       std::size_t m_sizeCommand;
00071 
00072     protected:
00074       jblas::sym_mat m_uCov;
00075       
00076     public:
00077 
00079       jblas::mat G;
00080 
00081       BaseCommandPredictModel(std::size_t sizeState, std::size_t sizeCommand) :
00082   BasePredictModel(sizeState),
00083   m_sizeCommand(sizeCommand),
00084   m_uCov(sizeCommand, sizeCommand),
00085   G(sizeState, sizeCommand)
00086       {
00087   m_uCov.clear();
00088       }
00089 
00090       virtual ~BaseCommandPredictModel() {}
00091 
00092       std::size_t sizeCommand() const {return m_sizeCommand;}
00093 
00094       void setUCov(jblas::sym_mat const& uCov) {
00095   m_uCov.assign(uCov);
00096       }
00097 
00098       jblas::sym_mat const& getUCov() const {return m_uCov;}
00099 
00101       virtual void computeUCov(jblas::vec const& u) {}
00102 
00103     };
00104 
00110     class LinearPredictModel : public BasePredictModel {
00111 
00112     public:
00113 
00114       LinearPredictModel(std::size_t sizeState) :
00115   BasePredictModel(sizeState) {}
00116 
00120       LinearPredictModel(const jblas::mat& F_,
00121                          const jblas::sym_mat& Q_);
00122 
00123       virtual ~LinearPredictModel() {}
00124 
00125     }; // class LinearPredictModel
00126 
00127 
00133     class LinearCommandPredictModel : public BaseCommandPredictModel {
00134 
00135     public:
00136 
00137       LinearCommandPredictModel(std::size_t sizeState, std::size_t sizeCommand) :
00138   BaseCommandPredictModel(sizeState, sizeCommand) {}
00139 
00140       LinearCommandPredictModel(const jblas::mat& F_,
00141         const jblas::mat& G_,
00142         const jblas::sym_mat& Q_);
00143 
00144       virtual ~LinearCommandPredictModel() {}
00145 
00146     };
00147 
00152     class JacobianPredictModel : public BasePredictModel {
00153 
00154     public:
00155       
00156       JacobianPredictModel(std::size_t sizeState) :
00157   BasePredictModel(sizeState) {}
00158 
00159       virtual ~JacobianPredictModel() {}
00160 
00172       virtual void predict(jblas::vec& x) = 0;
00173 
00174     }; // class JacobianPredictModel
00175 
00180     class JacobianCommandPredictModel : public BaseCommandPredictModel {
00181     
00182     public:
00183 
00184       JacobianCommandPredictModel(std::size_t sizeState, std::size_t sizeCommand) :
00185   BaseCommandPredictModel(sizeState, sizeCommand) {}
00186       virtual ~JacobianCommandPredictModel() {}
00187 
00201       virtual void predict(jblas::vec& x, jblas::vec const& u_) = 0;
00202 
00203     };
00204    
00205 
00212     class JacobianBlockPredictModel : public BasePredictModel {
00213 
00214     public:
00215 
00216       JacobianBlockPredictModel(std::size_t sizeState) :
00217   BasePredictModel(sizeState) {}
00218 
00219       virtual ~JacobianBlockPredictModel() {}
00220 
00232       virtual void predict(jblas::vec_range& x_r) = 0;
00233 
00234     }; // class JacobianBlockPredictModel
00235 
00236 
00244     class JacobianBlockCommandPredictModel : public BaseCommandPredictModel {
00245     
00246     public:
00247 
00248       JacobianBlockCommandPredictModel(std::size_t sizeState, std::size_t sizeCommand) :
00249   BaseCommandPredictModel(sizeState, sizeCommand) {}
00250 
00251       virtual ~JacobianBlockCommandPredictModel() {}
00252 
00266       virtual void predict(jblas::vec_range& x_r, jblas::vec const& u_) = 0;
00267 
00268     };
00269 
00270   } // namespace filter
00271 } // namespace jafar
00272 
00273 #endif // FILTER_PREDICT_MODEL_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