Skip to content

Commit 2ecbaf3

Browse files
committed
erase some useless np.array
1 parent b0722d9 commit 2ecbaf3

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Localization/extended_kalman_filter/extended_kalman_filter.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ def observation(xTrue, xd, u):
5353
def motion_model(x, u):
5454

5555
F = np.array([[1.0, 0, 0, 0],
56-
[0, 1.0, 0, 0],
57-
[0, 0, 1.0, 0],
58-
[0, 0, 0, 0]])
56+
[0, 1.0, 0, 0],
57+
[0, 0, 1.0, 0],
58+
[0, 0, 0, 0]])
5959

6060
B = np.array([[DT * math.cos(x[2, 0]), 0],
61-
[DT * math.sin(x[2, 0]), 0],
62-
[0.0, DT],
63-
[1.0, 0.0]])
61+
[DT * math.sin(x[2, 0]), 0],
62+
[0.0, DT],
63+
[1.0, 0.0]])
6464

6565
x = F.dot(x) + B.dot(u)
6666

@@ -165,11 +165,11 @@ def main():
165165
time = 0.0
166166

167167
# State Vector [x y yaw v]'
168-
xEst = np.array(np.zeros((4, 1)))
169-
xTrue = np.array(np.zeros((4, 1)))
168+
xEst = np.zeros((4, 1))
169+
xTrue = np.zeros((4, 1))
170170
PEst = np.eye(4)
171171

172-
xDR = np.array(np.zeros((4, 1))) # Dead reckoning
172+
xDR = np.zeros((4, 1)) # Dead reckoning
173173

174174
# history
175175
hxEst = xEst
@@ -194,12 +194,12 @@ def main():
194194
if show_animation:
195195
plt.cla()
196196
plt.plot(hz[:, 0], hz[:, 1], ".g")
197-
plt.plot(np.array(hxTrue[0, :]).flatten(),
198-
np.array(hxTrue[1, :]).flatten(), "-b")
199-
plt.plot(np.array(hxDR[0, :]).flatten(),
200-
np.array(hxDR[1, :]).flatten(), "-k")
201-
plt.plot(np.array(hxEst[0, :]).flatten(),
202-
np.array(hxEst[1, :]).flatten(), "-r")
197+
plt.plot(hxTrue[0, :].flatten(),
198+
hxTrue[1, :].flatten(), "-b")
199+
plt.plot(hxDR[0, :].flatten(),
200+
hxDR[1, :].flatten(), "-k")
201+
plt.plot(hxEst[0, :].flatten(),
202+
hxEst[1, :].flatten(), "-r")
203203
plot_covariance_ellipse(xEst, PEst)
204204
plt.axis("equal")
205205
plt.grid(True)

0 commit comments

Comments
 (0)