GHFilterOrder¶
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.gh.
GHFilterOrder
(x0, dt, order, g, h=None, k=None)[source]¶ A g-h filter of aspecified order 0, 1, or 2.
Strictly speaking, the g-h filter is order 1, and the 2nd order filter is called the g-h-k filter. I’m not aware of any filter name that encompasses orders 0, 1, and 2 under one name, or I would use it.
Parameters: - x0 : 1D np.array or scalar
Initial value for the filter state. Each value can be a scalar or a np.array.
You can use a scalar for x0. If order > 0, then 0.0 is assumed for the higher order terms.
x[0] is the value being tracked x[1] is the first derivative (for order 1 and 2 filters) x[2] is the second derivative (for order 2 filters)
- dt : scalar
timestep
- order : int
order of the filter. Defines the order of the system 0 - assumes system of form x = a_0 + a_1*t 1 - assumes system of form x = a_0 +a_1*t + a_2*t^2 2 - assumes system of form x = a_0 +a_1*t + a_2*t^2 + a_3*t^3
- g : float
filter g gain parameter.
- h : float, optional
filter h gain parameter, order 1 and 2 only
- k : float, optional
filter k gain parameter, order 2 only
- Atrributes
- ——-
- x : np.array
State of the filter.
x[0] is the value being tracked x[1] is the derivative of x[0] (order 1 and 2 only) x[2] is the 2nd derivative of x[0] (order 2 only)
This is always an np.array, even for order 0 where you can initialize x0 with a scalar.
- y : np.array
Residual - difference between the measurement and the prediction
- dt : scalar
timestep
- order : int
order of the filter. Defines the order of the system 0 - assumes system of form x = a_0 + a_1*t 1 - assumes system of form x = a_0 +a_1*t + a_2*t^2 2 - assumes system of form x = a_0 +a_1*t + a_2*t^2 + a_3*t^3
- g : float
filter g gain parameter.
- h : float
filter h gain parameter, order 1 and 2 only
- k : float
filter k gain parameter, order 2 only
- z : 1D np.array or scalar
measurement passed into update()