Skip to content

Commit cffb9d7

Browse files
committed
delete duplicated initial pose
1 parent b51f611 commit cffb9d7

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

SLAM/GraphBasedSLAM/graph_based_slam.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ def graph_based_slam(x_init, hz):
169169
print("start graph based slam")
170170

171171
zlist = copy.deepcopy(hz)
172-
zlist.insert(1, zlist[0])
173172

174173
x_opt = copy.deepcopy(x_init)
175174
nt = x_opt.shape[1]
@@ -276,20 +275,28 @@ def main():
276275
xDR = np.zeros((STATE_SIZE, 1)) # Dead reckoning
277276

278277
# history
279-
hxTrue = xTrue
280-
hxDR = xTrue
278+
hxTrue = []
279+
hxDR = []
281280
hz = []
282281
dtime = 0.0
283-
282+
init = False
284283
while SIM_TIME >= time:
284+
285+
if not init:
286+
hxTrue = xTrue
287+
hxDR = xTrue
288+
init = True
289+
else:
290+
hxDR = np.hstack((hxDR, xDR))
291+
hxTrue = np.hstack((hxTrue, xTrue))
292+
285293
time += DT
286294
dtime += DT
287295
u = calc_input()
288296

289297
xTrue, z, xDR, ud = observation(xTrue, xDR, u, RFID)
290298

291-
hxDR = np.hstack((hxDR, xDR))
292-
hxTrue = np.hstack((hxTrue, xTrue))
299+
293300
hz.append(z)
294301

295302
if dtime >= show_graph_dtime:

0 commit comments

Comments
 (0)