Skip to content

Commit bc2edc0

Browse files
committed
Update to SLAM example
1 parent 7924077 commit bc2edc0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

vanilla_SLAM.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66

77
# %%
88
# SIMULATION SETUP
9-
109
import numpy as np
1110
import matplotlib.pyplot as plt
1211
from scipy.stats import chi2
1312
from matplotlib import patches
1413

14+
# Uncomment for interactive plots in Jupyter
15+
# %matplotlib ipympl
16+
1517
# Set the simulation time [s] and the sample period [s]
1618
SIM_TIME = 60.0
17-
T = 0.01
19+
T = 0.1
1820

1921
# Create an array of time values [s]
2022
t = np.arange(0.0, SIM_TIME, T)
@@ -37,6 +39,7 @@
3739
# %%
3840
# VEHICLE, SENSOR MODELS AND KALMAN FILTER FUNCTIONS
3941

42+
4043
# Discrete-time omnidirectional vehicle model
4144
def vehicle(x, u, T):
4245
x_new = x + T * u
@@ -154,7 +157,7 @@ def KF_correct(x, y, H, R, P):
154157
x_hat[2 : 2 * m, i] = x_hat[2 : 2 * m, i - 1]
155158
P_hat[2 : 2 * m, 0 : 2 * m, i] = P_hat[2 : 2 * m, 0 : 2 * m, i - 1]
156159

157-
# Run the KF correction step
160+
# Run the KF correction step (try commenting out and see what happens)
158161
x_hat[:, i], P_hat[:, :, i] = KF_correct(x_hat[:, i], y, H, R, P_hat[:, :, i])
159162

160163
# %%
@@ -166,11 +169,8 @@ def KF_correct(x, y, H, R, P):
166169
plt.rc("savefig", format="pdf")
167170
plt.rc("savefig", bbox="tight")
168171

169-
# Uncomment for interactive plots in IPython
170-
# %matplotlib widget
171-
172-
# Find the scaling factor for plotting covarianc`e bounds
173-
ALPHA = 0.05
172+
# Find the scaling factor for plotting covariance bounds
173+
ALPHA = 0.01
174174
s1 = chi2.isf(ALPHA, 1)
175175
s2 = chi2.isf(ALPHA, 2)
176176

0 commit comments

Comments
 (0)