diff --git a/Pipfile b/Pipfile index 5660eae360..720a20f6fa 100644 --- a/Pipfile +++ b/Pipfile @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:03a69ace0d3ec21dacbfbbcad17688191d4f022a519e5447cda33922fb677e24 -size 1980 +oid sha256:cfdd366178aaffdf25d292e6b949e6eb80be25a9d10d1315059af9704e795e63 +size 1986 diff --git a/Pipfile.lock b/Pipfile.lock index a00aae1334..12f982374c 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:88300c38c21842e55204a6e351985dfcb0c24b1e882432698472dbdc378cd9f8 -size 171081 +oid sha256:a374661ecc896e1c10c2874bff0235ce2d6f3dc0b3fbcb40f987153ed13f09a1 +size 175263 diff --git a/common/kalman/simple_kalman_old.py b/common/kalman/simple_kalman_old.py index 3f7d049cc5..d11770faf6 100644 --- a/common/kalman/simple_kalman_old.py +++ b/common/kalman/simple_kalman_old.py @@ -8,7 +8,7 @@ class KF1D: def __init__(self, x0, A, C, K): self.x = x0 self.A = A - self.C = C + self.C = np.atleast_2d(C) self.K = K self.A_K = self.A - np.dot(self.K, self.C) diff --git a/common/kalman/tests/test_simple_kalman.py b/common/kalman/tests/test_simple_kalman.py index 9b947a4320..6308759984 100644 --- a/common/kalman/tests/test_simple_kalman.py +++ b/common/kalman/tests/test_simple_kalman.py @@ -21,10 +21,10 @@ class TestSimpleKalman(unittest.TestCase): K0_0 = 0.12287673 K1_0 = 0.29666309 - self.kf_old = KF1D_old(x0=np.matrix([[x0_0], [x1_0]]), - A=np.matrix([[A0_0, A0_1], [A1_0, A1_1]]), - C=np.matrix([C0_0, C0_1]), - K=np.matrix([[K0_0], [K1_0]])) + self.kf_old = KF1D_old(x0=np.array([[x0_0], [x1_0]]), + A=np.array([[A0_0, A0_1], [A1_0, A1_1]]), + C=np.array([C0_0, C0_1]), + K=np.array([[K0_0], [K1_0]])) self.kf = KF1D(x0=[[x0_0], [x1_0]], A=[[A0_0, A0_1], [A1_0, A1_1]], @@ -47,8 +47,8 @@ class TestSimpleKalman(unittest.TestCase): x = self.kf.update(v_wheel) # Compare the output x, verify that the error is less than 1e-4 - self.assertAlmostEqual(x_old[0], x[0]) - self.assertAlmostEqual(x_old[1], x[1]) + np.testing.assert_almost_equal(x_old[0], x[0]) + np.testing.assert_almost_equal(x_old[1], x[1]) def test_new_is_faster(self): setup = """ @@ -69,10 +69,10 @@ C0_1 = 0.0 K0_0 = 0.12287673 K1_0 = 0.29666309 -kf_old = KF1D_old(x0=np.matrix([[x0_0], [x1_0]]), - A=np.matrix([[A0_0, A0_1], [A1_0, A1_1]]), - C=np.matrix([C0_0, C0_1]), - K=np.matrix([[K0_0], [K1_0]])) +kf_old = KF1D_old(x0=np.array([[x0_0], [x1_0]]), + A=np.array([[A0_0, A0_1], [A1_0, A1_1]]), + C=np.array([C0_0, C0_1]), + K=np.array([[K0_0], [K1_0]])) kf = KF1D(x0=[[x0_0], [x1_0]], A=[[A0_0, A0_1], [A1_0, A1_1]],