Skip to content

Commit 754aec5

Browse files
committed
finish vehicle model linealization documentation
1 parent eb6d1cb commit 754aec5

File tree

1 file changed

+98
-4
lines changed

1 file changed

+98
-4
lines changed

PathTracking/model_predictive_speed_and_steer_control/notebook.ipynb

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"source": [
4343
"ODE is\n",
4444
"\n",
45-
"$$ \\dot{z} =\\frac{\\partial }{\\partial z} z = A'z+B'u$$\n",
45+
"$$ \\dot{z} =\\frac{\\partial }{\\partial z} z = f(z, u) = A'z+B'u$$\n",
4646
"\n"
4747
]
4848
},
@@ -76,7 +76,7 @@
7676
" =\n",
7777
"\\begin{bmatrix}\n",
7878
"0 & 0 & cos(\\bar{\\phi}) & -\\bar{v}sin(\\bar{\\phi})\\\\\n",
79-
"0 & 1 & sin(\\bar{\\phi}) & \\bar{v}cos(\\bar{\\phi}) \\\\\n",
79+
"0 & 0 & sin(\\bar{\\phi}) & \\bar{v}cos(\\bar{\\phi}) \\\\\n",
8080
"0 & 0 & 0 & 0 \\\\\n",
8181
"0 & 0 &\\frac{tan(\\bar{\\delta})}{L} & 0 \\\\\n",
8282
"\\end{bmatrix}\n",
@@ -109,10 +109,104 @@
109109
"0 & \\frac{\\bar{v}}{Lcos^2(\\bar{\\delta})} \\\\\n",
110110
"\\end{bmatrix}\n",
111111
"\\end{equation*}\n",
112-
"\n",
112+
"\n"
113+
]
114+
},
115+
{
116+
"cell_type": "markdown",
117+
"metadata": {},
118+
"source": [
113119
"You can get a discrete-time mode with Forward Euler Discretization with sampling time dt.\n",
114120
"\n",
115-
"$$z_{k+1}=z_k+f(z_k,u_k)dt$$"
121+
"$$z_{k+1}=z_k+f(z_k,u_k)dt$$\n",
122+
"\n",
123+
"Using first degree Tayer expantion around zbar and ubar\n",
124+
"$$z_{k+1}=z_k+(f(\\bar{z},\\bar{u})+A'z_k+B'u_k)dt$$\n",
125+
"\n",
126+
"$$z_{k+1}=(I + dtA')z_k+(dtB')u_k + (f(\\bar{z},\\bar{u})-A'\\bar{z}+B'\\bar{u})dt$$\n"
127+
]
128+
},
129+
{
130+
"cell_type": "markdown",
131+
"metadata": {},
132+
"source": [
133+
"So, \n",
134+
"\n",
135+
"$$z_{k+1}=Az_k+Bu_k +C$$\n",
136+
"\n",
137+
"where,\n",
138+
"\n",
139+
"\\begin{equation*}\n",
140+
"A = (I + dtA')\\\\\n",
141+
"=\n",
142+
"\\begin{bmatrix} \n",
143+
"1 & 0 & cos(\\bar{\\phi})dt & -\\bar{v}sin(\\bar{\\phi})dt\\\\\n",
144+
"0 & 1 & sin(\\bar{\\phi})dt & \\bar{v}cos(\\bar{\\phi})dt \\\\\n",
145+
"0 & 0 & 1 & 0 \\\\\n",
146+
"0 & 0 &\\frac{tan(\\bar{\\delta})}{L}dt & 1 \\\\\n",
147+
"\\end{bmatrix}\n",
148+
"\\end{equation*}"
149+
]
150+
},
151+
{
152+
"cell_type": "markdown",
153+
"metadata": {},
154+
"source": [
155+
"\\begin{equation*}\n",
156+
"B = dtB'\\\\\n",
157+
"=\n",
158+
"\\begin{bmatrix} \n",
159+
"0 & 0 \\\\\n",
160+
"0 & 0 \\\\\n",
161+
"dt & 0 \\\\\n",
162+
"0 & \\frac{\\bar{v}}{Lcos^2(\\bar{\\delta})}dt \\\\\n",
163+
"\\end{bmatrix}\n",
164+
"\\end{equation*}"
165+
]
166+
},
167+
{
168+
"cell_type": "markdown",
169+
"metadata": {},
170+
"source": [
171+
"\\begin{equation*}\n",
172+
"C = (f(\\bar{z},\\bar{u})-A'\\bar{z}-B'\\bar{u})dt\\\\\n",
173+
"= dt(\n",
174+
"\\begin{bmatrix} \n",
175+
"\\bar{v}cos(\\bar{\\phi})\\\\\n",
176+
"\\bar{v}sin(\\bar{\\phi}) \\\\\n",
177+
"\\bar{a}\\\\\n",
178+
"\\frac{\\bar{v}tan(\\bar{\\delta})}{L}\\\\\n",
179+
"\\end{bmatrix}\n",
180+
"-\n",
181+
"\\begin{bmatrix} \n",
182+
"\\bar{v}cos(\\bar{\\phi})-\\bar{v}sin(\\bar{\\phi})\\bar{\\phi}\\\\\n",
183+
"\\bar{v}sin(\\bar{\\phi})+\\bar{v}cos(\\bar{\\phi})\\bar{\\phi}\\\\\n",
184+
"0\\\\\n",
185+
"\\frac{\\bar{v}tan(\\bar{\\delta})}{L}\\\\\n",
186+
"\\end{bmatrix}\n",
187+
"-\n",
188+
"\\begin{bmatrix} \n",
189+
"0\\\\\n",
190+
"0 \\\\\n",
191+
"\\bar{a}\\\\\n",
192+
"\\frac{\\bar{v}\\bar{\\delta}}{Lcos^2(\\bar{\\delta})}\\\\\n",
193+
"\\end{bmatrix}\n",
194+
")\\\\\n",
195+
"=\n",
196+
"\\begin{bmatrix} \n",
197+
"\\bar{v}sin(\\bar{\\phi})\\bar{\\phi}dt\\\\\n",
198+
"-\\bar{v}cos(\\bar{\\phi})\\bar{\\phi}dt\\\\\n",
199+
"0\\\\\n",
200+
"\\frac{\\bar{v}\\bar{\\delta}}{Lcos^2(\\bar{\\delta})}dt\\\\\n",
201+
"\\end{bmatrix}\n",
202+
"\\end{equation*}"
203+
]
204+
},
205+
{
206+
"cell_type": "markdown",
207+
"metadata": {},
208+
"source": [
209+
"This equation is implemented at https://github.com/AtsushiSakai/PythonRobotics/blob/eb6d1cbe6fc90c7be9210bf153b3a04f177cc138/PathTracking/model_predictive_speed_and_steer_control/model_predictive_speed_and_steer_control.py#L80-L102"
116210
]
117211
},
118212
{

0 commit comments

Comments
 (0)