本文整理汇总了Python中filterpy.kalman.UnscentedKalmanFilter.H方法的典型用法代码示例。如果您正苦于以下问题:Python UnscentedKalmanFilter.H方法的具体用法?Python UnscentedKalmanFilter.H怎么用?Python UnscentedKalmanFilter.H使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类filterpy.kalman.UnscentedKalmanFilter
的用法示例。
在下文中一共展示了UnscentedKalmanFilter.H方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: filter
# 需要导入模块: from filterpy.kalman import UnscentedKalmanFilter [as 别名]
# 或者: from filterpy.kalman.UnscentedKalmanFilter import H [as 别名]
def filter(measurements):
dt = 0.1
# x = [x, x', x'' y, y', y'']
x = np.array([measurements[0][0], 0., 0., measurements[0][1], 0., 0.])
G = np.array([[0.19*(dt**2)],
[dt],
[1.],
[0.19*(dt**2)],
[dt],
[1.]])
Q = G*G.T*0.1**2
# Info available http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/05_Multivariate_Kalman_Filters.ipynb
sigmas = MerweScaledSigmaPoints(n=6, alpha=1., beta=2., kappa=-3.)
bot_filter = UKF(dim_x=6, dim_z=2, fx=f_cv, hx=h_cv, dt=dt, points=sigmas)
bot_filter.x = np.array([measurements[0][0], 0., 0, measurements[0][1], 0., 0.])
#bot_filter.F = F
bot_filter.H = np.array([[1., 0., 0., 1., 0., 0.]])
#bot_filter.Q = Q
bot_filter.Q[0:3, 0:3] = Q_discrete_white_noise(3, dt=1, var=0.0002)
bot_filter.Q[3:6, 3:6] = Q_discrete_white_noise(3, dt=1, var=0.0002)
bot_filter.P *= 500
bot_filter.R = np.diag([0.0001, 0.0001])
observable_meas = measurements[0:len(measurements)-60]
pos, cov = [], []
for z in observable_meas:
pos.append(bot_filter.x)
cov.append(bot_filter.P)
bot_filter.predict()
bot_filter.update(z)
for i in range(0,60):
bot_filter.predict()
pos.append(bot_filter.x)
return pos
示例2: linear_filter
# 需要导入模块: from filterpy.kalman import UnscentedKalmanFilter [as 别名]
# 或者: from filterpy.kalman.UnscentedKalmanFilter import H [as 别名]
def linear_filter(measurements):
dt = 1.0
# x = [x, x', y, y']
x = np.array([measurements[0][0], 0., measurements[0][1], 0.])
H = np.array([[1., 0., 1., 0.]])
# Info available http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/05_Multivariate_Kalman_Filters.ipynb
sigmas = MerweScaledSigmaPoints(n=4, alpha=0.3, beta=2., kappa=-3.)
bot_filter = UKF(dim_x=4, dim_z=2, fx=f_linear, hx=h_linear, dt=dt, points=sigmas)
bot_filter.x = np.array([measurements[0][0], 0., measurements[0][1], 0.])
#bot_filter.F = F
bot_filter.H = np.asarray(H)
#bot_filter.Q = Q
bot_filter.Q[0:2, 0:2] = Q_discrete_white_noise(2, dt=1, var=0.1)
bot_filter.Q[2:4, 2:4] = Q_discrete_white_noise(2, dt=1, var=0.1)
bot_filter.P *= 10
bot_filter.R = np.diag([0.0001, 0.0001])
observable_meas = measurements[0:len(measurements)-60]
pos, cov = [], []
for z in observable_meas:
pos.append(bot_filter.x)
cov.append(bot_filter.P)
bot_filter.predict()
bot_filter.update(z)
for i in range(0,60):
bot_filter.predict()
pos.append(bot_filter.x)
return pos