Skip to content

Commit 274bfda

Browse files
committed
update docs
1 parent 620a048 commit 274bfda

12 files changed

Lines changed: 993 additions & 30 deletions

PathTracking/model_predictive_speed_and_steer_control/notebook.ipynb renamed to PathTracking/model_predictive_speed_and_steer_control/Model_predictive_speed_and_steering_control.ipynb

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# Model predictive speed and steering control\n",
7+
"## Model predictive speed and steering control\n",
8+
"\n",
9+
"![Model predictive speed and steering control](https://github.com/AtsushiSakai/PythonRobotics/raw/master/PathTracking/model_predictive_speed_and_steer_control/animation.gif?raw=true)\n"
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"\n",
817
"\n",
918
"code:\n",
1019
"\n",
11-
"https://github.com/AtsushiSakai/PythonRobotics/blob/master/PathTracking/model_predictive_speed_and_steer_control/model_predictive_speed_and_steer_control.py\n",
20+
"[PythonRobotics/model\\_predictive\\_speed\\_and\\_steer\\_control\\.py at master · AtsushiSakai/PythonRobotics](https://github.com/AtsushiSakai/PythonRobotics/blob/master/PathTracking/model_predictive_speed_and_steer_control/model_predictive_speed_and_steer_control.py)\n",
1221
"\n",
1322
"This is a path tracking simulation using model predictive control (MPC).\n",
1423
"\n",
@@ -23,7 +32,7 @@
2332
"cell_type": "markdown",
2433
"metadata": {},
2534
"source": [
26-
"# MPC modeling\n",
35+
"### MPC modeling\n",
2736
"\n",
2837
"State vector is:\n",
2938
"$$ z = [x, y, v,\\phi]$$ x: x-position, y:y-position, v:velocity, φ: yaw angle\n",
@@ -49,18 +58,31 @@
4958
"metadata": {},
5059
"source": [
5160
"subject to:\n",
61+
"\n",
5262
"- Linearlied vehicle model\n",
63+
"\n",
5364
"$$z_{t+1}=Az_t+Bu+C$$\n",
65+
"\n",
5466
"- Maximum steering speed\n",
67+
"\n",
5568
"$$|u_{t+1}-u_{t}|<du_{max}$$\n",
69+
"\n",
5670
"- Maximum steering angle\n",
71+
"\n",
5772
"$$|u_{t}|<u_{max}$$\n",
73+
"\n",
5874
"- Initial state\n",
75+
"\n",
5976
"$$z_0 = z_{0,ob}$$\n",
77+
"\n",
6078
"- Maximum and minimum speed\n",
79+
"\n",
6180
"$$v_{min} < v_t < v_{max}$$\n",
81+
"\n",
6282
"- Maximum and minimum input\n",
63-
"$$u_{min} < u_t < u_{max}$$\n"
83+
"\n",
84+
"$$u_{min} < u_t < u_{max}$$\n",
85+
"\n"
6486
]
6587
},
6688
{
@@ -69,14 +91,14 @@
6991
"source": [
7092
"This is implemented at \n",
7193
"\n",
72-
"https://github.com/AtsushiSakai/PythonRobotics/blob/f51a73f47cb922a12659f8ce2d544c347a2a8156/PathTracking/model_predictive_speed_and_steer_control/model_predictive_speed_and_steer_control.py#L247-L301"
94+
"[PythonRobotics/model\\_predictive\\_speed\\_and\\_steer\\_control\\.py at f51a73f47cb922a12659f8ce2d544c347a2a8156 · AtsushiSakai/PythonRobotics](https://github.com/AtsushiSakai/PythonRobotics/blob/f51a73f47cb922a12659f8ce2d544c347a2a8156/PathTracking/model_predictive_speed_and_steer_control/model_predictive_speed_and_steer_control.py#L247-L301)"
7395
]
7496
},
7597
{
7698
"cell_type": "markdown",
7799
"metadata": {},
78100
"source": [
79-
"# Vehicle model linearization\n",
101+
"### Vehicle model linearization\n",
80102
"\n",
81103
"\n",
82104
"\n",
@@ -106,7 +128,7 @@
106128
"source": [
107129
"where\n",
108130
"\n",
109-
"\\begin{equation*}\n",
131+
"$$\\begin{equation*}\n",
110132
"A' =\n",
111133
"\\begin{bmatrix}\n",
112134
"\\frac{\\partial }{\\partial x}vcos(\\phi) & \n",
@@ -134,15 +156,15 @@
134156
"0 & 0 & 0 & 0 \\\\\n",
135157
"0 & 0 &\\frac{tan(\\bar{\\delta})}{L} & 0 \\\\\n",
136158
"\\end{bmatrix}\n",
137-
"\\end{equation*}\n",
159+
"\\end{equation*}$$\n",
138160
"\n"
139161
]
140162
},
141163
{
142164
"cell_type": "markdown",
143165
"metadata": {},
144166
"source": [
145-
"\\begin{equation*}\n",
167+
"$$\\begin{equation*}\n",
146168
"B' =\n",
147169
"\\begin{bmatrix}\n",
148170
"\\frac{\\partial }{\\partial a}vcos(\\phi) &\n",
@@ -162,7 +184,7 @@
162184
"1 & 0 \\\\\n",
163185
"0 & \\frac{\\bar{v}}{Lcos^2(\\bar{\\delta})} \\\\\n",
164186
"\\end{bmatrix}\n",
165-
"\\end{equation*}\n",
187+
"\\end{equation*}$$\n",
166188
"\n"
167189
]
168190
},
@@ -190,7 +212,7 @@
190212
"\n",
191213
"where,\n",
192214
"\n",
193-
"\\begin{equation*}\n",
215+
"$$\\begin{equation*}\n",
194216
"A = (I + dtA')\\\\\n",
195217
"=\n",
196218
"\\begin{bmatrix} \n",
@@ -199,14 +221,14 @@
199221
"0 & 0 & 1 & 0 \\\\\n",
200222
"0 & 0 &\\frac{tan(\\bar{\\delta})}{L}dt & 1 \\\\\n",
201223
"\\end{bmatrix}\n",
202-
"\\end{equation*}"
224+
"\\end{equation*}$$"
203225
]
204226
},
205227
{
206228
"cell_type": "markdown",
207229
"metadata": {},
208230
"source": [
209-
"\\begin{equation*}\n",
231+
"$$\\begin{equation*}\n",
210232
"B = dtB'\\\\\n",
211233
"=\n",
212234
"\\begin{bmatrix} \n",
@@ -215,14 +237,14 @@
215237
"dt & 0 \\\\\n",
216238
"0 & \\frac{\\bar{v}}{Lcos^2(\\bar{\\delta})}dt \\\\\n",
217239
"\\end{bmatrix}\n",
218-
"\\end{equation*}"
240+
"\\end{equation*}$$"
219241
]
220242
},
221243
{
222244
"cell_type": "markdown",
223245
"metadata": {},
224246
"source": [
225-
"\\begin{equation*}\n",
247+
"$$\\begin{equation*}\n",
226248
"C = (f(\\bar{z},\\bar{u})-A'\\bar{z}-B'\\bar{u})dt\\\\\n",
227249
"= dt(\n",
228250
"\\begin{bmatrix} \n",
@@ -253,7 +275,7 @@
253275
"0\\\\\n",
254276
"-\\frac{\\bar{v}\\bar{\\delta}}{Lcos^2(\\bar{\\delta})}dt\\\\\n",
255277
"\\end{bmatrix}\n",
256-
"\\end{equation*}"
278+
"\\end{equation*}$$"
257279
]
258280
},
259281
{
@@ -262,14 +284,14 @@
262284
"source": [
263285
"This equation is implemented at \n",
264286
"\n",
265-
"https://github.com/AtsushiSakai/PythonRobotics/blob/eb6d1cbe6fc90c7be9210bf153b3a04f177cc138/PathTracking/model_predictive_speed_and_steer_control/model_predictive_speed_and_steer_control.py#L80-L102"
287+
"[PythonRobotics/model\\_predictive\\_speed\\_and\\_steer\\_control\\.py at eb6d1cbe6fc90c7be9210bf153b3a04f177cc138 · AtsushiSakai/PythonRobotics](https://github.com/AtsushiSakai/PythonRobotics/blob/eb6d1cbe6fc90c7be9210bf153b3a04f177cc138/PathTracking/model_predictive_speed_and_steer_control/model_predictive_speed_and_steer_control.py#L80-L102)\n"
266288
]
267289
},
268290
{
269291
"cell_type": "markdown",
270292
"metadata": {},
271293
"source": [
272-
"# Reference\n",
294+
"### Reference\n",
273295
"\n",
274296
"- [Vehicle Dynamics and Control \\| Rajesh Rajamani \\| Springer](http://www.springer.com/us/book/9781461414322)\n",
275297
"\n",
@@ -279,7 +301,7 @@
279301
],
280302
"metadata": {
281303
"kernelspec": {
282-
"display_name": "Python [default]",
304+
"display_name": "Python 3",
283305
"language": "python",
284306
"name": "python3"
285307
},
@@ -293,7 +315,7 @@
293315
"name": "python",
294316
"nbconvert_exporter": "python",
295317
"pygments_lexer": "ipython3",
296-
"version": "3.6.4"
318+
"version": "3.6.6"
297319
}
298320
},
299321
"nbformat": 4,

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
'sphinx.ext.autodoc',
4343
'sphinx.ext.mathjax',
4444
'sphinx.ext.viewcode',
45+
'sphinx.ext.viewcode',
4546
]
4647

4748
# Add any paths that contain templates here, relative to this directory.

docs/jupyternotebook2rst.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"""
2+
3+
Jupyter notebook converter to rst file
4+
5+
author: Atsushi Sakai
6+
7+
"""
8+
9+
NOTEBOOK_DIR = "../"
10+
11+
import glob
12+
import os
13+
import os.path
14+
import subprocess
15+
16+
17+
def get_notebook_path_list(ndir):
18+
path = glob.glob(ndir + "**/*.ipynb", recursive=True)
19+
return path
20+
21+
22+
def generate_rst(npath):
23+
# print(npath)
24+
25+
# generate dir
26+
dirpath = "./modules/" + os.path.dirname(npath)[3:]
27+
# print(dirpath)
28+
29+
if not os.path.exists(dirpath):
30+
os.makedirs(dirpath)
31+
32+
rstpath = os.path.abspath("./modules/" + npath[3:-5] + "rst")
33+
print(rstpath)
34+
35+
cmd = "jupyter nbconvert --to rst "
36+
cmd += npath
37+
cmd += " --output "
38+
cmd += rstpath
39+
print(cmd)
40+
subprocess.call(cmd, shell=True)
41+
42+
43+
def main():
44+
print("start!!")
45+
46+
notebook_path_list = get_notebook_path_list(NOTEBOOK_DIR)
47+
# print(notebook_path_list)
48+
49+
for npath in notebook_path_list:
50+
generate_rst(npath)
51+
52+
print("done!!")
53+
54+
55+
if __name__ == '__main__':
56+
main()

0 commit comments

Comments
 (0)