00001 /************************************************************************************************/ 00002 /*! \file ExtendedKalmanFilter.h 00003 * \brief The ExtendedKalmanFilter class provides functionality beyond the KalmanFilter class for nonlinear system models. 00004 * \author $Author: cakinli $ 00005 * \version $Revision: 1.9 $ 00006 * \date $Date: 2005/02/25 18:40:53 $ 00007 ************************************************************************************************/ 00008 /*! 00009 * 00010 ************************************************************************************************/ 00011 00012 #ifndef __SSSL_EXTENDEDKALMANFILTER_H__ 00013 #define __SSSL_EXTENDEDKALMANFILTER_H__ 00014 00015 #include <Filtering/SequentialFilter.h> 00016 #include <Filtering/KalmanFilter.h> 00017 00018 /*! Constants */ 00019 #define DEFAULT_PROPAGATION_STEP_SIZE 0.01 /*!< default propagation step size in seconds */ 00020 00021 using namespace std; 00022 00023 class ExtendedKalmanFilter : public KalmanFilter { 00024 00025 public: 00026 // Contructors/Deconstructors 00027 00028 /*! Default constructor */ 00029 ExtendedKalmanFilter(); 00030 00031 /*! Constructor */ 00032 ExtendedKalmanFilter(double propStepSize); 00033 00034 /*! Deconstructor */ 00035 virtual ~ExtendedKalmanFilter(); 00036 00037 // Facilitators 00038 00039 // Mutators 00040 00041 /*! Sets the pointer to the state RHS function */ 00042 inline void SetStateRHS(Vector (*stateRHSFunc)(double time, Vector states, Vector controls, Vector params)) { ptr_stateRHSFunc = stateRHSFunc; }; 00043 00044 /*! Set the pointer to the measurment RHS function */ 00045 inline void SetMeasurementRHS(Vector (*measurementRHSFunc)(ExtendedKalmanFilter*)) { ptr_measurementRHSFunc = measurementRHSFunc; }; 00046 00047 /*! Sets the propagation step size */ 00048 inline void SetPropagationStepSize(double stepSize) { m_propagationStepSize = stepSize; }; 00049 00050 /*! Sets the nonlinear state propagation */ 00051 inline void SetNonlinearStatePropagator(void (*statePropagateFunc)(ExtendedKalmanFilter*)) { ptr_nonlinearStatePropagator = statePropagateFunc; } 00052 00053 /*! Estimate the state with current filter information */ 00054 virtual void EstimateState(); 00055 00056 // Inspectors 00057 00058 /*! Gets the current 1st time derivative of the state */ 00059 inline Vector GetStateDot(double t, Vector states, Vector controls, Vector params) { return (*ptr_stateRHSFunc)(t, states, controls, params); }; 00060 00061 /*! Gets the propagation step size */ 00062 inline double GetPropagationStepSize() { return m_propagationStepSize; }; 00063 00064 /*! Gets the current estimated measurements */ 00065 Vector GetEstimatedMeasurements(); 00066 00067 protected: 00068 00069 Vector (*ptr_stateRHSFunc)(double time, Vector states, Vector controls, Vector params); /*!< A function pointer to the (nonlinear) right-hand side function for the states, \f$\dot{x} = f(x,u,w)\f$. */ 00070 Vector (*ptr_measurementRHSFunc)(ExtendedKalmanFilter*); /*!< A function pointer to the measurement right-hand side file, \f$ z = h(x,u,w)\f$. */ 00071 void (*ptr_nonlinearStatePropagator)(ExtendedKalmanFilter*); 00072 double m_propagationStepSize; 00073 00074 void PropagateState(); 00075 00076 private: 00077 00078 }; 00079 00080 00081 00082 #endif 00083 // Do not change the comments below - they will be added automatically by CVS 00084 /***************************************************************************** 00085 * $Log: ExtendedKalmanFilter.h,v $ 00086 * Revision 1.9 2005/02/25 18:40:53 cakinli 00087 * Created Makefiles and organized include directives to reduce the number of 00088 * include paths. Reorganized libraries so that there is now one per source 00089 * directory. Each directory is self-contained in terms of its Makefile. 00090 * The local Makefile in each directory includes src/config.mk, which has all 00091 * the definitions and general and pattern rules. So at most, to see what 00092 * goes into building a target, a person needs to examine the Makefile in 00093 * that directory, and ../config.mk. 00094 * 00095 * Revision 1.8 2003/07/01 21:05:39 mavandyk 00096 * Edited default constructor, and added another constructor to set step size values. 00097 * 00098 * Revision 1.7 2003/06/30 21:08:43 mavandyk 00099 * Removed get pointer to state RHS function and inserted a member function to calculate the first time derivative of the states. 00100 * 00101 * Revision 1.6 2003/06/27 22:39:05 mavandyk 00102 * Fixed many typos and bugs. 00103 * 00104 * Revision 1.5 2003/06/24 22:41:35 mavandyk 00105 * Added get functions for the data member and added comments. 00106 * 00107 * Revision 1.4 2003/06/12 16:11:23 mavandyk 00108 * Changed all references to iterative filter to sequential filter for greater clarity. 00109 * 00110 * Revision 1.3 2003/06/11 15:46:16 simpliciter 00111 * Added include statement for IterativeFilter.h. 00112 * 00113 * Revision 1.2 2003/06/11 13:08:13 simpliciter 00114 * Minor changes. 00115 * 00116 * Revision 1.1 2003/06/11 03:04:20 simpliciter 00117 * Initial submission. 00118 * 00119 ******************************************************************************/