GCOP  1.0
filter.h
Go to the documentation of this file.
00001 #ifndef GCOP_FILTER_H
00002 #define GCOP_FILTER_H
00003 
00004 #include "system.h"
00005 #include "sensor.h"
00006 
00007 namespace gcop {
00008   
00009   template <typename T = VectorXd, 
00010     int _nx = Dynamic, 
00011     int _nu = Dynamic, 
00012     int _np = Dynamic, 
00013     typename Tz = VectorXd,
00014     int _nz = Dynamic> class Filter {
00015   public:
00016 
00017   typedef Matrix<double, _nx, 1> Vectornd;
00018   typedef Matrix<double, _nu, 1> Vectorcd;
00019   typedef Matrix<double, _np, 1> Vectormd;
00020 
00021   typedef Matrix<double, _nx, _nx> Matrixnd;
00022   typedef Matrix<double, _nx, _nu> Matrixncd;
00023   typedef Matrix<double, _nu, _nx> Matrixcnd;
00024   typedef Matrix<double, _nu, _nu> Matrixcd;
00025   
00026   typedef Matrix<double, _np, _np> Matrixmd;
00027   typedef Matrix<double, _nx, _np> Matrixnmd;
00028   typedef Matrix<double, _np, _nx> Matrixmnd;
00029 
00034   Filter(System<T, _nx, _nu, _np>  &sys,
00035          Sensor<T, _nx, _nu, _np, Tz, _nz> &sensor);
00036   
00037   virtual ~Filter();
00038     
00045   virtual bool Predict(T& xb, double t, const T &xa, 
00046                        const Vectorcd &u, double h, 
00047                        const Vectormd *p = 0, bool cov = true) = 0;
00048   
00055   virtual bool Update(T& xb, double t, const T &xa,
00056                       const Vectorcd &u, const Tz &z, 
00057                       const Vectormd *p = 0, bool cov = true) = 0;
00058   
00063   void SetChiGate(double chiGate) { this->chiGate = chiGate; };
00064   
00069   double GetChiGate() const {return chiGate; }
00070   
00075   double GetChi() const {return chi; }
00076   
00077   System<T, _nx, _nu, _np>  &sys;             
00078   Sensor<T, _nx, _nu, _np, Tz, _nz> &sensor;  
00079     
00080   double chi;             
00081   double chiGate;         
00082   
00083   protected:
00084 
00085   };
00086   
00087   
00088   template <typename T, int _nx, int _nu, int _np, typename Tz, int _nz> 
00089     Filter<T, _nx, _nu, _np, Tz, _nz>::Filter( System<T, _nx, _nu, _np>  &sys, 
00090                                                Sensor<T, _nx, _nu, _np, Tz, _nz> &sensor) : 
00091     sys(sys), sensor(sensor) {
00092   }  
00093 
00094   template <typename T, int _nx, int _nu, int _np, typename Tz, int _nz> 
00095     Filter<T, _nx, _nu, _np, Tz, _nz>::~Filter() {
00096   }  
00097 
00098 }
00099 
00100 
00101 #endif