def test_scaled_weights(): for n in range(1,5): for alpha in np.linspace(0.99, 1.01, 100): for beta in range(0,2): for kappa in range(0,2): Wm, Wc = SUKF.weights(n, alpha, 0, 3-n) assert abs(sum(Wm) - 1) < 1.e-1 assert abs(sum(Wc) - 1) < 1.e-1
def test_scaled_weights(): for n in range(1, 5): for alpha in np.linspace(0.99, 1.01, 100): for beta in range(0, 2): for kappa in range(0, 2): Wm, Wc = SUKF.weights(n, alpha, 0, 3 - n) assert abs(sum(Wm) - 1) < 1.e-1 assert abs(sum(Wc) - 1) < 1.e-1
from filterpy.kalman import UnscentedKalmanFilter as UKF from filterpy.kalman import ScaledUnscentedKalmanFilter as SUKF from filterpy.common import Q_discrete_white_noise """ This is an example of the bearing only problem. You have a platform, usually a ship, that can only get the bearing to a moving target. Assuming platform is stationary, this is a very difficult problem because there are an infinite number of solutions. The literature is filled with this example, along with proposed solutions (usually, platform makes manuevers). """ dt = 0.1 y = 20 platform_pos = (0, 20) sf = SUKF(2, 1, dt, alpha=1.e-4, beta=2., kappa=1.) sf.Q = Q_discrete_white_noise(2, dt, .1) f = UKF(2, 1, dt, kappa=0.) f.Q = Q_discrete_white_noise(2, dt, .1) def fx(x, dt): """ state transition function""" # pos = pos + vel # vel = vel return array([x[0] + x[1], x[1]]) def hx(x):
from filterpy.common import Q_discrete_white_noise """ This is an example of the bearing only problem. You have a platform, usually a ship, that can only get the bearing to a moving target. Assuming platform is stationary, this is a very difficult problem because there are an infinite number of solutions. The literature is filled with this example, along with proposed solutions (usually, platform makes manuevers). """ dt = 0.1 y = 20 platform_pos = (0, 20) sf = SUKF(2, 1, dt, alpha=1.0e-4, beta=2.0, kappa=1.0) sf.Q = Q_discrete_white_noise(2, dt, 0.1) f = UKF(2, 1, dt, kappa=0.0) f.Q = Q_discrete_white_noise(2, dt, 0.1) def fx(x, dt): """ state transition function""" # pos = pos + vel # vel = vel return array([x[0] + x[1], x[1]])