Package org.hipparchus.filtering.kalman
Class AbstractKalmanFilter<T extends Measurement>
- java.lang.Object
-
- org.hipparchus.filtering.kalman.AbstractKalmanFilter<T>
-
- Type Parameters:
T
- the type of the measurements
- All Implemented Interfaces:
KalmanEstimate
,KalmanFilter<T>
- Direct Known Subclasses:
ExtendedKalmanFilter
,LinearKalmanFilter
public abstract class AbstractKalmanFilter<T extends Measurement> extends Object implements KalmanFilter<T>
Shared parts between linear and non-linear Kalman filters.- Since:
- 1.3
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractKalmanFilter(MatrixDecomposer decomposer, ProcessEstimate initialState)
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RealMatrix
computeInnovationCovarianceMatrix(RealMatrix r, RealMatrix h)
Compute innovation covariance matrix.protected void
correct(T measurement, RealMatrix stm, RealVector innovation, RealMatrix h, RealMatrix s)
Perform correction step.ProcessEstimate
getCorrected()
Get the corrected state.protected KalmanObserver
getObserver()
Get the observer.ProcessEstimate
getPredicted()
Get the predicted state.RealMatrix
getStateCrossCovariance()
Get the cross-covariance between the previous state and the prediction.protected void
predict(double time, RealVector predictedState, RealMatrix stm, RealMatrix noise)
Perform prediction step.void
setObserver(KalmanObserver kalmanObserver)
Set the filter observer callback.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hipparchus.filtering.kalman.KalmanFilter
estimationStep
-
-
-
-
Constructor Detail
-
AbstractKalmanFilter
protected AbstractKalmanFilter(MatrixDecomposer decomposer, ProcessEstimate initialState)
Simple constructor.- Parameters:
decomposer
- decomposer to use for the correction phaseinitialState
- initial state
-
-
Method Detail
-
predict
protected void predict(double time, RealVector predictedState, RealMatrix stm, RealMatrix noise)
Perform prediction step.- Parameters:
time
- process timepredictedState
- predicted state vectorstm
- state transition matrixnoise
- process noise covariance matrix
-
computeInnovationCovarianceMatrix
protected RealMatrix computeInnovationCovarianceMatrix(RealMatrix r, RealMatrix h)
Compute innovation covariance matrix.- Parameters:
r
- measurement covarianceh
- Jacobian of the measurement with respect to the state (may be null if measurement should be ignored)- Returns:
- innovation covariance matrix, defined as \(h.P.h^T + r\), or null if h is null
-
correct
protected void correct(T measurement, RealMatrix stm, RealVector innovation, RealMatrix h, RealMatrix s) throws MathIllegalArgumentException
Perform correction step.- Parameters:
measurement
- single measurement to handlestm
- state transition matrixinnovation
- innovation vector (i.e. residuals) (may be null if measurement should be ignored)h
- Jacobian of the measurement with respect to the state (may be null if measurement should be ignored)s
- innovation covariance matrix (may be null if measurement should be ignored)- Throws:
MathIllegalArgumentException
- if matrix cannot be decomposed
-
getObserver
protected KalmanObserver getObserver()
Get the observer.- Returns:
- the observer
-
setObserver
public void setObserver(KalmanObserver kalmanObserver)
Set the filter observer callback.- Specified by:
setObserver
in interfaceKalmanFilter<T extends Measurement>
- Parameters:
kalmanObserver
- the observer
-
getPredicted
public ProcessEstimate getPredicted()
Get the predicted state.- Specified by:
getPredicted
in interfaceKalmanEstimate
- Returns:
- predicted state
-
getCorrected
public ProcessEstimate getCorrected()
Get the corrected state.- Specified by:
getCorrected
in interfaceKalmanEstimate
- Returns:
- corrected state
-
getStateCrossCovariance
public RealMatrix getStateCrossCovariance()
Get the cross-covariance between the previous state and the prediction. Not required for forward filtering, but required for the smoother.- Specified by:
getStateCrossCovariance
in interfaceKalmanEstimate
- Returns:
- cross-covariance
-
-