Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

KalmanFilter.cpp

Go to the documentation of this file.
00001 /************************************************************************************************/
00002 /************************************************************************************************/
00003 /*! \file KalmanFilter.cpp
00004 *  \brief Definitions of the member functions of the KalmanFilter class.
00005 *  \author $Author: simpliciter $
00006 *  \version $Revision: 1.15 $
00007 *  \date    $Date: 2003/07/14 19:38:15 $
00008 ************************************************************************************************/
00009 /*! 
00010 *
00011 ************************************************************************************************/
00012 
00013 #include "KalmanFilter.h"
00014 #include "LKFfunctions.h"
00015 #include <iostream>
00016 
00017 
00018 
00019 // Contructors/Deconstructors
00020 KalmanFilter::KalmanFilter() {
00021         
00022         SetSystemProcessNoiseMatrix(&Qmatrix);
00023         SetMeasurementCovarianceMatrix(&Rmatrix);
00024         SetStateJacobianMatrix(&Fmatrix);
00025         SetMeasurementJacobianMatrix(&Hmatrix);
00026 
00027         SetStatePropagator(&LKFStatePropagator);
00028     SetCovariancePropagator(&LKFCovarianceMatrixPropagator);
00029     SetKalmanGainCalculation(&LKFCalcualteKalmanGain);
00030     SetStateMeasurementUpdate(&LKFStateMeasurementUpdate);
00031     SetCovarianceMeasurementUpdate(&LKFCovarianceMeasurementUpdate);
00032         
00033 };
00034 
00035 KalmanFilter::KalmanFilter(Matrix& _covariance, Matrix& _kalmanGain) {
00036         
00037         SetCovarianceMatrix(_covariance);
00038         SetKalmanGainMatrix(_kalmanGain);
00039         
00040         SetSystemProcessNoiseMatrix(&Qmatrix);
00041         SetMeasurementCovarianceMatrix(&Rmatrix);
00042         SetStateJacobianMatrix(&Fmatrix);
00043         SetMeasurementJacobianMatrix(&Hmatrix);
00044         
00045         SetStatePropagator(&LKFStatePropagator);
00046     SetCovariancePropagator(&LKFCovarianceMatrixPropagator);
00047     SetKalmanGainCalculation(&LKFCalcualteKalmanGain);
00048     SetStateMeasurementUpdate(&LKFStateMeasurementUpdate);
00049     SetCovarianceMeasurementUpdate(&LKFCovarianceMeasurementUpdate);
00050         
00051 };
00052 
00053 KalmanFilter::~KalmanFilter() { };
00054 
00055 // Public member functions
00056 Matrix KalmanFilter::GetCovarianceMatrix() { return m_covariance; }
00057 Matrix KalmanFilter::GetKalmanGainMatrix() { return m_kalmanGain; }
00058 
00059 Matrix KalmanFilter::GetSystemProcessNoiseMatrix() { return (*ptr_systemProcessNoiseMatrix)(this); }
00060 Matrix KalmanFilter::GetMeasurementCovarianceMatrix() { return (*ptr_measurementCovarianceMatrix)(this); }
00061 Matrix KalmanFilter::GetStateJacobianMatrix() { return (*ptr_stateJacobianMatrix)(this); }
00062 Matrix KalmanFilter::GetMeasurementJacobianMatrix() { return (*ptr_measurementJacobianMatrix)(this); }
00063 
00064 void KalmanFilter::EstimateState() {
00065         
00066         PropagateState();       
00067         PropagateCovariance();
00068         CalculateKalmanGain();
00069         MeasurementUpdateState();
00070         MeasurementUpdateCovariance();
00071         m_timeOfEstimate = m_timeOfMeasurements;
00072         
00073 };
00074 
00075 // Public member functions
00076 void KalmanFilter::PropagateState() { ptr_statePropagteFunc(this); };
00077 void KalmanFilter::PropagateCovariance() { ptr_covariancePropagateFunc(this); };
00078 void KalmanFilter::CalculateKalmanGain() { ptr_kalmanGainCalculationFunc(this); };
00079 void KalmanFilter::MeasurementUpdateState() { ptr_stateMeasurementUpdateFunc(this); };
00080 void KalmanFilter::MeasurementUpdateCovariance() { ptr_covarianceMeasurementUpdateFunc(this); };
00081 
00082 // Do not change the comments below - they will be added automatically by CVS
00083 /*****************************************************************************
00084 * $Log: KalmanFilter.cpp,v $
00085 * Revision 1.15  2003/07/14 19:38:15  simpliciter
00086 * Fixed typo
00087 *
00088 * Revision 1.14  2003/06/27 01:49:46  simpliciter
00089 * Got a bit "commit" happy.  No changes.
00090 *
00091 *
00092 * Revision 1.12  2003/06/24 23:05:01  mavandyk
00093 * Added a time update statement to the estimate state function.
00094 *
00095 * Revision 1.11  2003/06/24 22:40:24  mavandyk
00096 * Moved inline function definition from implementation to header file.
00097 *
00098 * Revision 1.10  2003/06/24 15:40:31  simpliciter
00099 * In brief:  I removed the kfData struct.
00100 * That change required numerous other changes.
00101 * Most significant is that functions which previously
00102 * took kfData or sfData as an input now take a KalmanFilter*.
00103 *
00104 * Revision 1.9  2003/06/20 21:59:24  mavandyk
00105 * Pulled pointer types from kalmanFilterData struct and put them directly in the KalmanFilter class.
00106 *
00107 * Revision 1.8  2003/06/20 17:54:57  simpliciter
00108 * Fixed what I broke--need to reinstate inline functions.
00109 *
00110 * Revision 1.6  2003/06/20 15:21:27  simpliciter
00111 * Added deconstructor.
00112 *
00113 * Revision 1.5  2003/06/19 23:29:10  mavandyk
00114 * Removed an extra parentheses in a function prototype.
00115 *
00116 * Revision 1.4  2003/06/18 17:39:18  mavandyk
00117 * Added include lines for KalmanFilter.h and LKFfunctions.h changed the function pointers, and added KalmanFilter:: to each of the function definitions.
00118 *
00119 * Revision 1.3  2003/06/12 23:07:45  mavandyk
00120 * Added footer comment log.
00121 *
00122 * Revision 1.5  2003/06/12 16:10:36  mavandyk
00123 * Changed all references to iterative filter to sequential filter for greater clarity.
00124 *
00125 * Revision 1.4  2003/06/11 17:52:26  simpliciter
00126 * Made a derived class from IterativeFilter.
00127 *
00128 * Revision 1.3  2003/06/11 15:45:32  simpliciter
00129 * Added IterativeFilter.h include line.
00130 *
00131 * Revision 1.2  2003/06/11 13:07:50  simpliciter
00132 * Minor changes.
00133 *
00134 * Revision 1.1  2003/06/11 03:03:46  simpliciter
00135 * Initial submission.
00136 *
00137 ******************************************************************************/

Generated on Wed Sep 5 12:54:21 2007 for DSACSS Operational Code by  doxygen 1.3.9.1