本文整理汇总了Python中filterpy.kalman.KalmanFilter.get_prediction方法的典型用法代码示例。如果您正苦于以下问题:Python KalmanFilter.get_prediction方法的具体用法?Python KalmanFilter.get_prediction怎么用?Python KalmanFilter.get_prediction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类filterpy.kalman.KalmanFilter
的用法示例。
在下文中一共展示了KalmanFilter.get_prediction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KalmanFilter
# 需要导入模块: from filterpy.kalman import KalmanFilter [as 别名]
# 或者: from filterpy.kalman.KalmanFilter import get_prediction [as 别名]
print f.x, f.y
if __name__ == '__main__':
f = KalmanFilter(dim_x=4, dim_z=2)
f.x = np.array([2,2,0,0])
f.F = np.array([
[1,0,1,0],
[0,1,0,1],
[0,0,1,0],
[0,0,0,1]])
f.H = np.array([
[1,0,0,0],
[0,1,0,0]])
f.P *= 100
f.R *= 100
print 'Pre',f.get_prediction()[0]
f.predict()
# f.update([2,2])
# state(f)
f.update([2,2])
print 'Pre',f.get_prediction()[0]
f.predict()
# f.update([2,2])
# state(f)
f.update([3.1,3])
# state(f)
print 'Pre',f.get_prediction()[0]
f.predict()
f.update([3.9,4])
print 'Pre',f.get_prediction()[0]
f.predict()
示例2: Q_discrete_white_noise
# 需要导入模块: from filterpy.kalman import KalmanFilter [as 别名]
# 或者: from filterpy.kalman.KalmanFilter import get_prediction [as 别名]
[0.0, 10.0]])
f.R = np.array([[0.0001, 0.0],
[0.0, 0.0001]])
f.H = np.array([[1.0, 0.0],
[0.0, 1.0]])
f.Q = Q_discrete_white_noise(dim = 2, dt = 100.0, var = 5000.0)
rate = rospy.Rate(100) # 10hz
cv2.namedWindow("Kalman Filter Output",1)
while not rospy.is_shutdown():
print "Prior Belief :", f.x
f.predict()
x_bar, covar = f.get_prediction()
print "Prediction :", x_bar, covar
if observation != None:
z = np.array([[observation.point.x], [observation.point.y]])
# print "Predicted State: "
# print x_bar
print "Observation: ", z
f.update(z)
print "Updated State: ", f.x
if frame != None:
cv2.circle(frame, (int(f.x[0][0]), int(f.x[1][0])), int(20), (0, 255, 0), 3, 8, 0)
if observation != None:
cv2.circle(frame, (int(observation.point.x), int(observation.point.y)), int(observation.point.z), (0, 0, 255), 3, 8, 0)
cv2.imshow("Kalman Filter Output", frame)