ExtendedKalmanFilter¶
giant.ufo.extended_kalman_filter
:
- class giant.ufo.extended_kalman_filter.ExtendedKalmanFilter(dynamics, state_initializer, initial_measurement=None)[source]¶
This class implements a simple extended kalman filter for processing measurements and estimating a state for a target that generated those measurements.
The EKF works by linearizing about the current best estimate of the state at each measurement time, computing an update using the linearized space, updating the state, and then returning to the non-linear domain to propagate to the next measurement time. This is relatively fast and powerful, but it does require an adequate initial guess for the state vector for the linearization to be reasonable.
Using this EKF is fairly straight forward. Simply specify the
Dynamics
model that governs your system (and your state vector) and provide a function that takes in aMeasurement
instance and aDynamics.State
class object which initializes the state off of the first measurement of the target. Then you can simply callinitialize()
to initialize the state vector andprocess_measurement()
to process measurements (note that you should not callprocess_measurement()
to process the measurement you used to initialize the state vector). Once you have processed all of your measurements, you can optionally call methodsmooth()
to perform backwards smoothing and get a best fit estimate of all of the residuals.Tuning the filter is done through the
process_noise
attribute of theDynamics
class (if it has one),Measurement.covariance
attribute, and thestate_initializer
function which can be used to set the initial state covariance.This is certainly not the most feature rich EKF and is intended primarily for light-weight work in determining tracks of non-cooperative targets observed in images as part of the
ufo
package. That being said, it is general enough that you could use it for other things if you wanted to, but doing that is beyond the scope of this documentation.- Parameters:
dynamics (Dynamics) – The
Dynamics
instance to use to propagate the state and covariancestate_initializer (Callable[[Measurement, Type[State]], State]) – A callable that initializes the state given an initial measurement. This should take in the initial
Measurement
and theDynamics.State
type (class object) and return the initializedDynamics.State
instance with at minimum position, velocity, and covariance filled out.initial_measurement (Measurement | None) – Optionally provide the initial measurement. If this is not
None
then theinitialize()
method will be called. If it isNone
then theinitialize()
method will need to be called manually.
Summary of Methods
This method computes the mean and standard deviation of the residual history from the EKF |
|
This method (re)initializes the EKF by setting the initial state using the |
|
This does a update step for a new measurement. |
|
This function integrates to the new measurement time and predicts the measurement at that time based on the propagated state. |
|
This method performs backwards smoothing (kind-of) for all measurements processed by this EKF. |