Skip to content

Commit 0874d50

Browse files
authored
Fix predict covariance (AtsushiSakai#973)
* Fix predict covariance * Remove trailing whitespace and unused return parameters
1 parent 73d1189 commit 0874d50

File tree

2 files changed

+91
-99
lines changed

2 files changed

+91
-99
lines changed

SLAM/EKFSLAM/ekf_slam.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@
2929

3030
def ekf_slam(xEst, PEst, u, z):
3131
# Predict
32-
S = STATE_SIZE
33-
G, Fx = jacob_motion(xEst[0:S], u)
34-
xEst[0:S] = motion_model(xEst[0:S], u)
35-
PEst[0:S, 0:S] = G.T @ PEst[0:S, 0:S] @ G + Fx.T @ Cx @ Fx
32+
G, Fx = jacob_motion(xEst, u)
33+
xEst[0:STATE_SIZE] = motion_model(xEst[0:STATE_SIZE], u)
34+
PEst = G.T @ PEst @ G + Fx.T @ Cx @ Fx
3635
initP = np.eye(2)
3736

3837
# Update
@@ -120,7 +119,7 @@ def jacob_motion(x, u):
120119
[0.0, 0.0, DT * u[0, 0] * math.cos(x[2, 0])],
121120
[0.0, 0.0, 0.0]], dtype=float)
122121

123-
G = np.eye(STATE_SIZE) + Fx.T @ jF @ Fx
122+
G = np.eye(len(x)) + Fx.T @ jF @ Fx
124123

125124
return G, Fx,
126125

0 commit comments

Comments
 (0)