HInfinityFilter¶
Copyright 2015 Roger R Labbe Jr.
FilterPy library. http://github.com/rlabbe/filterpy
Documentation at: https://filterpy.readthedocs.org
Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
This is licensed under an MIT license. See the readme.MD file for more information.
- class filterpy.hinfinity.HInfinityFilter(dim_x, dim_z, dim_u, gamma)[source]¶
H-Infinity filter. You are responsible for setting the various state variables to reasonable values; the defaults below will not give you a functional filter.
- Parameters:
- dim_xint
Number of state variables for the Kalman filter. For example, if you are tracking the position and velocity of an object in two dimensions, dim_x would be 4.
This is used to set the default size of P, Q, and u
- dim_zint
Number of of measurement inputs. For example, if the sensor provides you with position in (x, y), dim_z would be 2.
- dim_uint
Number of control inputs for the Gu part of the prediction step.
- gammafloat
- .. warning::
I do not believe this code is correct. DO NOT USE THIS. In particular, note that predict does not update the covariance matrix.
- update(z)[source]¶
Add a new measurement z to the H-Infinity filter. If z is None, nothing is changed.
- Parameters:
- zndarray
measurement for this update.
- predict(u=0)[source]¶
Predict next position.
- Parameters:
- undarray
Optional control vector. If non-zero, it is multiplied by B to create the control input into the system.
- batch_filter(Zs, update_first=False, saver=False)[source]¶
Batch processes a sequences of measurements.
- Parameters:
- Zslist-like
list of measurements at each time step self.dt Missing measurements must be represented by ‘None’.
- update_firstbool, default=False, optional,
controls whether the order of operations is update followed by predict, or predict followed by update.
- saverfilterpy.common.Saver, optional
filterpy.common.Saver object. If provided, saver.save() will be called after every epoch
- Returns:
- means: ndarray ((n, dim_x, 1))
array of the state for each time step. Each entry is an np.array. In other words means[k,:] is the state at step k.
- covariance: ndarray((n, dim_x, dim_x))
array of the covariances for each time step. In other words covariance[k, :, :] is the covariance at step k.
- get_prediction(u=0)[source]¶
Predicts the next state of the filter and returns it. Does not alter the state of the filter.
- Parameters:
- undarray
optional control input
- Returns:
- xndarray
State vector of the prediction.
- residual_of(z)[source]¶
returns the residual for the given measurement (z). Does not alter the state of the filter.
- measurement_of_state(x)[source]¶
Helper function that converts a state into a measurement.
- Parameters:
- xndarray
H-Infinity state vector
- Returns:
- zndarray
measurement corresponding to the given state
- property V¶
measurement noise matrix