Skip to content

Commit ff0a8e8

Browse files
committed
keep coding
1 parent 0d43f31 commit ff0a8e8

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

SLAM/GraphBasedSLAM/graph_based_slam.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,14 @@ def graph_based_slam(xEst, PEst, u, z):
3333
# Predict
3434
S = STATE_SIZE
3535
xEst[0:S] = motion_model(xEst[0:S], u)
36-
G, Fx = jacob_motion(xEst[0:S], u)
37-
PEst[0:S, 0:S] = G.T * PEst[0:S, 0:S] * G + Fx.T * Cx * Fx
38-
initP = np.eye(2)
3936

4037
# Update
4138
for iz in range(len(z[:, 0])): # for each observation
42-
minid = search_correspond_LM_ID(xEst, PEst, z[iz, 0:2])
43-
44-
nLM = calc_n_LM(xEst)
45-
if minid == nLM:
46-
print("New LM")
47-
# Extend state and covariance matrix
48-
xAug = np.vstack((xEst, calc_LM_Pos(xEst, z[iz, :])))
49-
PAug = np.vstack((np.hstack((PEst, np.zeros((len(xEst), LM_SIZE)))),
50-
np.hstack((np.zeros((LM_SIZE, len(xEst))), initP))))
51-
xEst = xAug
52-
PEst = PAug
53-
54-
lm = get_LM_Pos_from_state(xEst, minid)
55-
y, S, H = calc_innovation(lm, xEst, PEst, z[iz, 0:2], minid)
56-
57-
K = PEst * H.T * np.linalg.inv(S)
58-
xEst = xEst + K * y
59-
PEst = (np.eye(len(xEst)) - K * H) * PEst
39+
pass
6040

6141
xEst[2] = pi_2_pi(xEst[2])
6242

63-
return xEst, PEst
43+
return xEst, None
6444

6545

6646
def calc_input():
@@ -256,11 +236,6 @@ def main():
256236
plt.plot(RFID[:, 0], RFID[:, 1], "*k")
257237
plt.plot(xEst[0], xEst[1], ".r")
258238

259-
# plot landmark
260-
for i in range(calc_n_LM(xEst)):
261-
plt.plot(xEst[STATE_SIZE + i * 2],
262-
xEst[STATE_SIZE + i * 2 + 1], "xg")
263-
264239
plt.plot(np.array(hxTrue[0, :]).flatten(),
265240
np.array(hxTrue[1, :]).flatten(), "-b")
266241
plt.plot(np.array(hxDR[0, :]).flatten(),

0 commit comments

Comments
 (0)