当前位置: 首页>>代码示例>>Python>>正文


Python KalmanFilter.get_prediction方法代码示例

本文整理汇总了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()
开发者ID:ZhouYzzz,项目名称:CTT,代码行数:33,代码来源:filter_demo.py

示例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)
开发者ID:CMobley7,项目名称:team_7_ws,代码行数:33,代码来源:kf_node.py


注:本文中的filterpy.kalman.KalmanFilter.get_prediction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。