PEP-8 compliance
This commit is contained in:
parent
9598c90f08
commit
adb3f9a499
File diff suppressed because it is too large
Load Diff
@ -1141,7 +1141,7 @@
|
||||
"APATwjUAAADgJ/8LwRmria3cWEkAAAAASUVORK5CYII=\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<matplotlib.figure.Figure at 0x7f80a140a6a0>"
|
||||
"<matplotlib.figure.Figure at 0x4fe66d8>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -1332,21 +1332,21 @@
|
||||
],
|
||||
"source": [
|
||||
"import sympy\n",
|
||||
"from sympy import init_printing, Matrix,MatMul, integrate, symbols\n",
|
||||
"from sympy import init_printing, Matrix,MatMul, integrate, symbols\n",
|
||||
"\n",
|
||||
"init_printing(use_latex='mathjax')\n",
|
||||
"dt, phi = symbols('\\Delta{t} \\Phi_s')\n",
|
||||
"F_k = Matrix([[1, dt, dt**2/2],\n",
|
||||
" [0, 1, dt],\n",
|
||||
" [0, 0, 1]])\n",
|
||||
"Q_c = Matrix([[0,0,0],\n",
|
||||
" [0,0,0],\n",
|
||||
" [0,0,1]])*phi\n",
|
||||
"Q_c = Matrix([[0, 0, 0],\n",
|
||||
" [0, 0, 0],\n",
|
||||
" [0, 0, 1]])*phi\n",
|
||||
"\n",
|
||||
"Q=sympy.integrate(F_k*Q_c*F_k.T,(dt, 0, dt))\n",
|
||||
"Q=sympy.integrate(F_k * Q_c * F_k.T, (dt, 0, dt))\n",
|
||||
"\n",
|
||||
"# factor phi out of the matrix to make it more readable\n",
|
||||
"Q = Q/phi\n",
|
||||
"Q = Q / phi\n",
|
||||
"sympy.MatMul(Q, phi)"
|
||||
]
|
||||
},
|
||||
@ -1432,14 +1432,14 @@
|
||||
"source": [
|
||||
"F_k = sympy.Matrix([[1, dt],\n",
|
||||
" [0, 1]])\n",
|
||||
"Q_c = sympy.Matrix([[0,0],\n",
|
||||
" [0,1]])*phi\n",
|
||||
"Q_c = sympy.Matrix([[0, 0],\n",
|
||||
" [0, 1]])*phi\n",
|
||||
"\n",
|
||||
"Q = sympy.integrate(F_k*Q_c*F_k.T,(dt, 0, dt))\n",
|
||||
"Q = sympy.integrate(F_k * Q_c * F_k.T, (dt, 0, dt))\n",
|
||||
"\n",
|
||||
"print('1st order discrete process noise')\n",
|
||||
"# factor phi out of the matrix to make it more readable\n",
|
||||
"Q = Q/phi\n",
|
||||
"Q = Q / phi\n",
|
||||
"sympy.MatMul(Q, phi)"
|
||||
]
|
||||
},
|
||||
@ -1504,7 +1504,7 @@
|
||||
],
|
||||
"source": [
|
||||
"var=symbols('sigma^2_v')\n",
|
||||
"v = Matrix([[dt**2/2], [dt]])\n",
|
||||
"v = Matrix([[dt**2 / 2], [dt]])\n",
|
||||
"\n",
|
||||
"Q = v * var * v.T\n",
|
||||
"\n",
|
||||
@ -1571,7 +1571,7 @@
|
||||
],
|
||||
"source": [
|
||||
"var=symbols('sigma^2_v')\n",
|
||||
"v = Matrix([[dt**2/2], [dt], [1]])\n",
|
||||
"v = Matrix([[dt**2 / 2], [dt], [1]])\n",
|
||||
"\n",
|
||||
"Q = v * var * v.T\n",
|
||||
"\n",
|
||||
@ -2249,7 +2249,7 @@
|
||||
"foOTcEB19QAAAABJRU5ErkJggg==\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<matplotlib.figure.Figure at 0x7f807e4aa160>"
|
||||
"<matplotlib.figure.Figure at 0x8f220f0>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -2283,7 +2283,7 @@
|
||||
" ys.append(y)\n",
|
||||
" ts.append(t)\n",
|
||||
"\n",
|
||||
"exact = [(t**2+4)**2 / 16. for t in ts]\n",
|
||||
"exact = [(t**2 + 4)**2 / 16. for t in ts]\n",
|
||||
"plt.plot(ts, ys)\n",
|
||||
"plt.plot(ts, exact)\n",
|
||||
"plt.show()\n",
|
||||
@ -2903,7 +2903,7 @@
|
||||
"hBDiM/8/3QDBZRpvieYAAAAASUVORK5CYII=\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<matplotlib.figure.Figure at 0x7f807e43e630>"
|
||||
"<matplotlib.figure.Figure at 0x8d10c18>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -2912,7 +2912,7 @@
|
||||
],
|
||||
"source": [
|
||||
"import ukf_internal\n",
|
||||
"with book_format.figsize(10,6):\n",
|
||||
"with book_format.figsize(10, 6):\n",
|
||||
" ukf_internal.show_four_gps()"
|
||||
]
|
||||
},
|
||||
@ -3196,8 +3196,8 @@
|
||||
" N = len(sat_pos)\n",
|
||||
" H = np.zeros((N, 2))\n",
|
||||
" for j in range(N):\n",
|
||||
" H[j,0] = (pos[0] - sat_pos[j,0]) / range_est[j]\n",
|
||||
" H[j,1] = (pos[1] - sat_pos[j,1]) / range_est[j]\n",
|
||||
" H[j, 0] = (pos[0] - sat_pos[j, 0]) / range_est[j]\n",
|
||||
" H[j, 1] = (pos[1] - sat_pos[j, 1]) / range_est[j]\n",
|
||||
" return H\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@ -3212,10 +3212,10 @@
|
||||
" r_est = satellite_range(pos, sat_pos)\n",
|
||||
" print('iteration:', i)\n",
|
||||
"\n",
|
||||
" H=hx(pos, sat_pos, r_est) \n",
|
||||
" H = hx(pos, sat_pos, r_est) \n",
|
||||
" Hinv = inv(dot(H.T, H)).dot(H.T)\n",
|
||||
"\n",
|
||||
" #update position estimate\n",
|
||||
" # update position estimate\n",
|
||||
" y = zs - r_est\n",
|
||||
" print('innovation', y)\n",
|
||||
"\n",
|
||||
@ -3230,9 +3230,9 @@
|
||||
" return pos, converged\n",
|
||||
"\n",
|
||||
"# compute measurement of where you are with respect to each sensor\n",
|
||||
"rz= satellite_range(user_pos, sat_pos)\n",
|
||||
"rz = satellite_range(user_pos, sat_pos)\n",
|
||||
"\n",
|
||||
"pos, converted = lop_ils(rz, sat_pos, (900,90), hx=hx_ils)\n",
|
||||
"pos, converted = lop_ils(rz, sat_pos, (900, 90), hx=hx_ils)\n",
|
||||
"print('Iterated solution: ', pos)"
|
||||
]
|
||||
},
|
||||
@ -3385,7 +3385,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.4.2"
|
||||
"version": "3.4.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1266,8 +1266,8 @@
|
||||
" the partial derivative of H\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" theta_a = atan2(pos_a[1]-pos[1], pos_a[0] - pos[0])\n",
|
||||
" theta_b = atan2(pos_b[1]-pos[1], pos_b[0] - pos[0])\n",
|
||||
" theta_a = atan2(pos_a[1] - pos[1], pos_a[0] - pos[0])\n",
|
||||
" theta_b = atan2(pos_b[1] - pos[1], pos_b[0] - pos[0])\n",
|
||||
"\n",
|
||||
" return np.array([[0, -cos(theta_a), 0, -sin(theta_a)],\n",
|
||||
" [0, -cos(theta_b), 0, -sin(theta_b)]])"
|
||||
@ -1808,7 +1808,7 @@
|
||||
"\n",
|
||||
"# pos will contain our nominal position since the filter does not\n",
|
||||
"# maintain position.\n",
|
||||
"pos = [0,0]\n",
|
||||
"pos = [0, 0]\n",
|
||||
"\n",
|
||||
"for i in range(count):\n",
|
||||
" # move (1,1) each step, so just use i\n",
|
||||
@ -1818,7 +1818,7 @@
|
||||
" # and measured ranges\n",
|
||||
" ra,rb = d.range_of(pos)\n",
|
||||
" rx,ry = d.range_of((pos[0] + f1.x[0, 0], pos[1] + f1.x[2, 0]))\n",
|
||||
" z = np.array([[ra-rx], [rb-ry]])\n",
|
||||
" z = np.array([[ra - rx], [rb - ry]])\n",
|
||||
"\n",
|
||||
" # compute linearized H for this time step\n",
|
||||
" f1.H = H_of (pos, pos_a, pos_b)\n",
|
||||
@ -1833,7 +1833,6 @@
|
||||
" f1.predict()\n",
|
||||
" f1.update(z)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"bp.plot_filter(xs, ys)\n",
|
||||
"bp.plot_track(pxs, pys)\n",
|
||||
"plt.legend(loc=2)\n",
|
||||
@ -1887,7 +1886,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.4.2"
|
||||
"version": "3.4.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
3003
13_Smoothing.ipynb
3003
13_Smoothing.ipynb
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -718,7 +718,7 @@
|
||||
"IiLqQ/8f7C/6jEqnSzcAAAAASUVORK5CYII=\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<matplotlib.figure.Figure at 0x7f33b92df518>"
|
||||
"<matplotlib.figure.Figure at 0x7219898>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -767,7 +767,7 @@
|
||||
"plt.subplot(212)\n",
|
||||
"plt.plot(vs) \n",
|
||||
"plt.title('velocity')\n",
|
||||
"plt.show()\n"
|
||||
"plt.show()"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user