def plot_g_h_results(measurements, filtered_data, title="", z_label="Scale",): bp.plot_measurements(measurements, label=z_label) bp.plot_filter(filtered_data) plt.legend(loc=4) plt.title(title) plt.gca().set_xlim(left=0,right=len(measurements)) plt.show()
def plot_g_h_results( measurements, filtered_data, title="", z_label="Scale", ): bp.plot_measurements(measurements, label=z_label) bp.plot_filter(filtered_data) plt.legend(loc=4) plt.title(title) plt.gca().set_xlim(left=0, right=len(measurements)) plt.show()
tracker.R = np.array([[5,0], [0,5]]) tracker.Q = np.eye(4) * 0.1 tracker.P = np.eye(4) * 500 count = 80 tx, ty = [],[] xs, ys = [],[] pxs, pys = [],[] sensor = PosSensor1([0,0], (2,2), 1) for i in range(count): tp = sensor.getPos() tx.append(tp[0]*.3084) ty.append(tp[1]*.3084) pos = sensor.read() z = np.array([[pos[0]], [pos[1]]]) tracker.predict() tracker.update(z) xs.append(tracker.x[0,0]) ys.append(tracker.x[2,0]) pxs.append(pos[0]*.3084) pys.append(pos[1]*.3084) plt.plot(tx,ty) bp.plot_filter(xs, ys) bp.plot_measurements(pxs, pys) plt.legend(loc="best") plt.show()
tracker.H = np.array([[1 / 0.3084, 0, 0, 0], [0, 0, 1 / 0.3084, 0]]) tracker.R = np.array([[5, 0], [0, 5]]) tracker.Q = np.eye(4) * 0.1 tracker.P = np.eye(4) * 500 count = 80 tx, ty = [], [] xs, ys = [], [] pxs, pys = [], [] sensor = PosSensor1([0, 0], (2, 2), 1) for i in range(count): tp = sensor.getPos() tx.append(tp[0] * .3084) ty.append(tp[1] * .3084) pos = sensor.read() z = np.array([[pos[0]], [pos[1]]]) tracker.predict() tracker.update(z) xs.append(tracker.x[0, 0]) ys.append(tracker.x[2, 0]) pxs.append(pos[0] * .3084) pys.append(pos[1] * .3084) plt.plot(tx, ty) bp.plot_filter(xs, ys) bp.plot_measurements(pxs, pys) plt.legend(loc="best") plt.show()