Skip to content

Commit c76f747

Browse files
authored
Fix covariance dimension (#998)
1 parent 8f84f0f commit c76f747

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Localization/particle_filter/particle_filter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ def calc_covariance(x_est, px, pw):
9696
calculate covariance matrix
9797
see ipynb doc
9898
"""
99-
cov = np.zeros((3, 3))
99+
cov = np.zeros((4, 4))
100100
n_particle = px.shape[1]
101101
for i in range(n_particle):
102-
dx = (px[:, i:i + 1] - x_est)[0:3]
102+
dx = (px[:, i:i + 1] - x_est)
103103
cov += pw[0, i] * dx @ dx.T
104104
cov *= 1.0 / (1.0 - pw @ pw.T)
105105

0 commit comments

Comments
 (0)