00001 /************************************************************************************************/ 00002 /*! \file SequentialFilter.h 00003 * \brief The SequentialFilter class is an abstract class SequentialFilter. 00004 * \author $Author: cakinli $ 00005 * \version $Revision: 1.12 $ 00006 * \date $Date: 2005/02/25 18:40:54 $ 00007 ************************************************************************************************/ 00008 /*! 00009 * 00010 ************************************************************************************************/ 00011 00012 #ifndef __SSSL_SEQUENTIALFILTER_H__ 00013 #define __SSSL_SEQUENTIALFILTER_H__ 00014 00015 #include <matrix/Matrix.h> 00016 00017 using namespace std; 00018 using namespace O_SESSAME; 00019 00020 00021 00022 class SequentialFilter { 00023 00024 public: 00025 // Contructors/Deconstructors 00026 /*! Default destructor */ 00027 virtual ~SequentialFilter() { }; 00028 00029 // Facilitators 00030 00031 // Mutators 00032 00033 /*! Sets the time of the currently saved state estimate in seconds */ 00034 inline void SetTimeOfEstimate(double& _timeOfEstimate) { m_timeOfEstimate = _timeOfEstimate; }; 00035 00036 /*! Sets the time when the measurements were taken, seconds */ 00037 inline void SetTimeOfMeasurements(double& _timeOfMeasurements) { m_timeOfMeasurements = _timeOfMeasurements; }; 00038 00039 /*! Sets the state vector, x. */ 00040 inline void SetStateVector(Vector& _states) { m_states = _states; }; 00041 00042 /*! Sets the control vector, u. */ 00043 inline void SetControlVector(Vector& _controls) { m_controls = _controls; }; 00044 00045 /*! Sets the measurement vector, z. */ 00046 inline void SetMeasurementVector(Vector& _measurements) { m_measurements = _measurements; }; 00047 00048 /*! Sets the parameter vector, w. */ 00049 inline void SetParameterVector(Vector& _parameters) { m_parameters = _parameters; }; 00050 00051 // Inspectors 00052 00053 /*! Gets the time of the stored estimate. */ 00054 double GetTimeOfEstimate(); 00055 00056 /*! Gets the time of the stored measurements. */ 00057 double GetTimeOfMeasurements(); 00058 00059 /*! Gets the time step between the last state estimate and the current measurements. */ 00060 inline double GetTimeStep() { return (m_timeOfMeasurements - m_timeOfEstimate); }; 00061 00062 /*! Gets the state vector. */ 00063 Vector GetStateVector(); 00064 00065 /*! Gets the control vector. */ 00066 Vector GetControlVector(); 00067 00068 /*! Gets the measurement vector. */ 00069 Vector GetMeasurementVector(); 00070 00071 /*! Gets the paramter vector. */ 00072 Vector GetParameterVector(); 00073 00074 /*! Pure virtual functions for compatibility with derived classes. */ 00075 virtual void EstimateState() = 0; 00076 virtual Matrix GetCovarianceMatrix() = 0; 00077 virtual Matrix GetKalmanGainMatrix() = 0; 00078 virtual int GetNumIterations() { return 0; } /*!< a bit of a hack. */ 00079 00080 00081 protected: 00082 00083 // protected data members 00084 double m_timeOfEstimate; /*!< Time of the current state estimate, seconds. */ 00085 double m_timeOfMeasurements; /*!< Time when the measurements were taken, seconds. */ 00086 Vector m_states; /*!< The vector of states; enters filter as \f$x_{k-1}^{+}\f$ and is incrementally updated to \f$x_{k}^{-}\f$ and finally \f$x_{k}^{+}\f$.*/ 00087 Vector m_controls; /*!< The vector of controls applied at t(k), u. */ 00088 Vector m_measurements; /*!< The vector of measurements at t(k), z. */ 00089 Vector m_parameters; /*!< The vector of system parameters, w. */ 00090 00091 private: 00092 00093 00094 00095 }; 00096 00097 00098 00099 #endif 00100 // Do not change the comments below - they will be added automatically by CVS 00101 /***************************************************************************** 00102 * $Log: SequentialFilter.h,v $ 00103 * Revision 1.12 2005/02/25 18:40:54 cakinli 00104 * Created Makefiles and organized include directives to reduce the number of 00105 * include paths. Reorganized libraries so that there is now one per source 00106 * directory. Each directory is self-contained in terms of its Makefile. 00107 * The local Makefile in each directory includes src/config.mk, which has all 00108 * the definitions and general and pattern rules. So at most, to see what 00109 * goes into building a target, a person needs to examine the Makefile in 00110 * that directory, and ../config.mk. 00111 * 00112 * Revision 1.11 2003/07/12 17:57:52 simpliciter 00113 * Added IEKF and EKF Histories. 00114 * 00115 * Revision 1.10 2003/06/27 12:39:32 simpliciter 00116 * Removed extra header file. 00117 * 00118 * Revision 1.9 2003/06/27 01:49:46 simpliciter 00119 * Got a bit "commit" happy. No changes. 00120 * 00121 * 00122 * Revision 1.7 2003/06/24 23:04:00 mavandyk 00123 * Correct typos. 00124 * 00125 * Revision 1.6 2003/06/24 22:38:50 mavandyk 00126 * Split up m_deltaT into m_timeOfEstimate and m_timeOfMeasurements to allow for absolute time-stamping, and added more comments. 00127 * 00128 * Revision 1.5 2003/06/24 15:44:40 simpliciter 00129 * Removed the sfData struct. This caused minimal changes 00130 * here but several trickle-down changes. 00131 * Also, moved implementation of inline functions to the 00132 * header file because derived classes couldn't find them. 00133 * 00134 * Revision 1.4 2003/06/23 19:41:36 mavandyk 00135 * Moved sequentialFilterData private member to protected, and removed constructor. 00136 * 00137 * Revision 1.3 2003/06/20 15:21:10 simpliciter 00138 * Added deconstructor. 00139 * 00140 * Revision 1.2 2003/06/18 17:33:54 mavandyk 00141 * Added include line for Matrix.h and the using namespace O_SESSAME line. 00142 * 00143 * Revision 1.1 2003/06/12 16:29:41 mavandyk 00144 * This file replaces IterativeFilter.h, and only differs by replacing iterative with sequential. 00145 * 00146 * Revision 1.1 2003/06/11 15:45:08 simpliciter 00147 * Initial submission, pulled out of KalmanFilter.h. 00148 * May require (desire) additional pure virtual functions. 00149 * 00150 * 00151 ******************************************************************************/