6
6
7
7
# %%
8
8
# SIMULATION SETUP
9
-
10
9
import numpy as np
11
10
import matplotlib .pyplot as plt
12
11
from scipy .stats import chi2
13
12
from matplotlib import patches
14
13
14
+ # Uncomment for interactive plots in Jupyter
15
+ # %matplotlib ipympl
16
+
15
17
# Set the simulation time [s] and the sample period [s]
16
18
SIM_TIME = 60.0
17
- T = 0.01
19
+ T = 0.1
18
20
19
21
# Create an array of time values [s]
20
22
t = np .arange (0.0 , SIM_TIME , T )
37
39
# %%
38
40
# VEHICLE, SENSOR MODELS AND KALMAN FILTER FUNCTIONS
39
41
42
+
40
43
# Discrete-time omnidirectional vehicle model
41
44
def vehicle (x , u , T ):
42
45
x_new = x + T * u
@@ -154,7 +157,7 @@ def KF_correct(x, y, H, R, P):
154
157
x_hat [2 : 2 * m , i ] = x_hat [2 : 2 * m , i - 1 ]
155
158
P_hat [2 : 2 * m , 0 : 2 * m , i ] = P_hat [2 : 2 * m , 0 : 2 * m , i - 1 ]
156
159
157
- # Run the KF correction step
160
+ # Run the KF correction step (try commenting out and see what happens)
158
161
x_hat [:, i ], P_hat [:, :, i ] = KF_correct (x_hat [:, i ], y , H , R , P_hat [:, :, i ])
159
162
160
163
# %%
@@ -166,11 +169,8 @@ def KF_correct(x, y, H, R, P):
166
169
plt .rc ("savefig" , format = "pdf" )
167
170
plt .rc ("savefig" , bbox = "tight" )
168
171
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
174
174
s1 = chi2 .isf (ALPHA , 1 )
175
175
s2 = chi2 .isf (ALPHA , 2 )
176
176
0 commit comments