|
5 | 5 | "id": "UcRF7OziizF1",
|
6 | 6 | "metadata": {},
|
7 | 7 | "source": [
|
8 |
| - "# Planning for Autonomous Driving." |
| 8 | + "# Planning for Autonomous Driving" |
9 | 9 | ]
|
10 | 10 | },
|
11 | 11 | {
|
|
23 | 23 | },
|
24 | 24 | {
|
25 | 25 | "cell_type": "code",
|
26 |
| - "execution_count": 1, |
| 26 | + "execution_count": null, |
27 | 27 | "id": "tLBxSLGeWPV0",
|
28 | 28 | "metadata": {
|
29 | 29 | "tags": [
|
|
32 | 32 | },
|
33 | 33 | "outputs": [],
|
34 | 34 | "source": [
|
35 |
| - "%pip install -q -U gtbook\n" |
| 35 | + "%pip install -q -U gtbook" |
36 | 36 | ]
|
37 | 37 | },
|
38 | 38 | {
|
39 | 39 | "cell_type": "code",
|
40 |
| - "execution_count": 87, |
| 40 | + "execution_count": null, |
41 | 41 | "id": "ewrl5k4_akQV",
|
42 | 42 | "metadata": {
|
43 | 43 | "tags": [
|
|
46 | 46 | },
|
47 | 47 | "outputs": [],
|
48 | 48 | "source": [
|
49 |
| - "# no imports (yet)\n" |
| 49 | + "# no imports (yet)" |
50 | 50 | ]
|
51 | 51 | },
|
52 | 52 | {
|
|
114 | 114 | "id": "R0sQPSK681cf",
|
115 | 115 | "metadata": {},
|
116 | 116 | "source": [
|
117 |
| - "```{index} motion primitives\n", |
118 |
| - "```\n", |
119 | 117 | "## Motion Primitives\n",
|
120 | 118 | "\n",
|
121 | 119 | "Consider a car traveling in reverse that wishes to suddenly change its orientation\n",
|
122 | 120 | "by completing a rapid 180-degree turn (a favorite maneuver for drivers like James Bond and Steve McQueen).\n",
|
123 | 121 | "How would we go about implementing this type of maneuver in an autonomous vehicle?\n",
|
124 | 122 | "\n",
|
125 |
| - "This two approaches we have considered before can be very inefficient for planning trajectories that have such well-defined\n", |
| 123 | + "The two approaches we have considered before can be very inefficient for planning trajectories that have such well-defined\n", |
126 | 124 | "characteristics.\n",
|
127 | 125 | "For all of our probabilistic methods, we used a discrete time formulation and considered\n",
|
128 | 126 | "the effects of executing an action (e.g., move forward, move left) for a small duration of time, $\\Delta t$.\n",
|
|
132 | 130 | "In each case, the language of path segments is very simple, and in each case,\n",
|
133 | 131 | "a full plan will consist of many sequential steps.\n",
|
134 | 132 | "\n",
|
| 133 | + "```{index} motion primitives\n", |
| 134 | + "```\n", |
135 | 135 | "Instead, the U-turn maneuver could be achieved by a predefined\n",
|
136 | 136 | "sequence of steps: after achieving a reasonable speed, remove your foot from the gas pedal;\n",
|
137 | 137 | "turn left sharply and hit the breaks; at the perfect moment, release the breaks\n",
|
|
146 | 146 | "id": "53y_6iTD1Ptz",
|
147 | 147 | "metadata": {},
|
148 | 148 | "source": [
|
149 |
| - "This idea is illustrated in the figure below, which shows four motion primitives\n", |
150 |
| - "for a car.\n", |
| 149 | + "This idea is illustrated in the Figure [1](#fig:MotionPrimitives), which shows four motion primitives for a car.\n", |
151 | 150 | "The primitive $P_1$ corresponds to driving forward, while motion primitives $P_2$, $P_3$, and $P_4$ correspond to veering\n",
|
152 | 151 | "to the left at increasingly sharp angles."
|
153 | 152 | ]
|
|
157 | 156 | "id": "y_GGvtQc94pI",
|
158 | 157 | "metadata": {},
|
159 | 158 | "source": [
|
160 |
| - "```{index} polynomial trajectories, splines\n", |
161 |
| - "```\n", |
162 |
| - "\n", |
163 | 159 | "<figure id=\"fig:MotionPrimitives\">\n",
|
164 | 160 | "<img src=\"https://github.com/gtbook/robotics/blob/main/Figures6/motion-primitives.png?raw=1\" style=\"width:18cm\" alt=\"\">\n",
|
165 | 161 | "<figcaption>Four motion primitives for a car veering to its left. </figcaption>\n",
|
166 | 162 | "</figure>\n",
|
167 | 163 | "\n",
|
| 164 | + "```{index} polynomial trajectories, splines\n", |
| 165 | + "```\n", |
168 | 166 | "Motion primitives can be defined in numerous ways.\n",
|
169 | 167 | "The figure above illustrates four fixed motion primitives, but it would not be difficult to generalize each of these\n",
|
170 | 168 | "to a class of motions by using parametric descriptions. \n",
|
|
208 | 206 | "For example, the traffic in rural Georgia is irrelevant when leaving downtown Atlanta on\n",
|
209 | 207 | "a trip to Boston.\n",
|
210 | 208 | "In this case, immediate driving decisions depend on the car just ahead, and the nearby\n",
|
211 |
| - "cars in adjacent lanes.\n" |
| 209 | + "cars in adjacent lanes." |
212 | 210 | ]
|
213 | 211 | },
|
214 | 212 | {
|
|
218 | 216 | "source": [
|
219 | 217 | "## Polynomial Trajectories\n",
|
220 | 218 | "\n",
|
221 |
| - "Let’s begin with the simple problem of changing lanes along a straight stretch of highway. The situation is illustrated in the figure below.\n", |
| 219 | + "Let’s begin with the simple problem of changing lanes along a straight stretch of highway. The situation is illustrated in Figure [2](#fig:LaneChange).\n", |
222 | 220 | "\n",
|
223 | 221 | "<figure id=\"fig:LaneChange\">\n",
|
224 | 222 | "<img src=\"https://github.com/gtbook/robotics/blob/main/Figures6/lane-change.png?raw=1\" style=\"width:18cm\" alt=\"\">\n",
|
|
239 | 237 | "\\end{equation}\n",
|
240 | 238 | "At the start of the maneuver, $s=0$, which matches the initial condition $d(0)=0$, and at $ s = s_\\mathrm{g}$\n",
|
241 | 239 | "we match the end condition $d(s_\\mathrm{g}) = d_\\mathrm{g}$.\n",
|
242 |
| - "This trajectory is illustrated in the figure below.\n", |
| 240 | + "This trajectory is illustrated in Figure [3](#fig:LinearLaneChange).\n", |
243 | 241 | "\n",
|
244 | 242 | "<figure id=\"fig:LinearLaneChange\">\n",
|
245 | 243 | "<img src=\"https://github.com/gtbook/robotics/blob/main/Figures6/linear-lane-change.png?raw=1\" style=\"width:18cm\" alt=\"\">\n",
|
|
305 | 303 | "\\end{aligned}\n",
|
306 | 304 | "\\end{equation}\n",
|
307 | 305 | "Note that these six equations are all linear in the parameters $\\alpha_i$, so it is a simple matter to solve\n",
|
308 |
| - "these." |
| 306 | + "them." |
309 | 307 | ]
|
310 | 308 | },
|
311 | 309 | {
|
|
320 | 318 | "While the derivation above produced a single polynomial trajectory,\n",
|
321 | 319 | "it is a simple matter to extend this formalism to construct trajectories\n",
|
322 | 320 | "that are composed of multiple consecutive polynomial segments.\n",
|
323 |
| - "Such trajectores belong to the more general class of **splines**.\n", |
| 321 | + "Such trajectories belong to the more general class of **splines**.\n", |
324 | 322 | "In general, a spline is a continuous, piecewise polynomial curve, and we are not\n",
|
325 | 323 | "necessarily given the specific values for the transition points between adjacent\n",
|
326 | 324 | "segments.\n",
|
327 | 325 | "\n",
|
328 |
| - "In fact, we have actually done exactly this in the above derviation,\n", |
329 |
| - "if we consider that for $s < 0$ and for $s > s_\\mathrm{g}$ the trajectory $d(s)$ is linear and pararallel to the $s$-axis,\n", |
| 326 | + "In fact, we have actually done exactly this in the above derivation,\n", |
| 327 | + "if we consider that for $s < 0$ and for $s > s_\\mathrm{g}$ the trajectory $d(s)$ is linear and parallel to the $s$-axis,\n", |
330 | 328 | "i.e., we have solved for a special case of three polynomial segments with two of those\n",
|
331 | 329 | "segments being linear and one quintic.\n",
|
332 | 330 | "\n",
|
|
408 | 406 | "trajectory, becomes an important problem. In this section, we address the problem\n",
|
409 | 407 | "of following such a trajectory.\n",
|
410 | 408 | "\n",
|
411 |
| - "The figure below illustrates the situation.\n", |
412 |
| - "We denote by $\\gamma(s)$ the desired trjactory of the car, where $s$, an arc length\n", |
| 409 | + "Figure [4](#fig:FrenetFrame) illustrates the situation.\n", |
| 410 | + "We denote by $\\gamma(s)$ the desired trajectory of the car, where $s$, an arc length\n", |
413 | 411 | "parameter, is a function of time, and therefore the instantaneous desired speed of \n",
|
414 | 412 | "the car is $\\dot{s}(t)$.\n",
|
415 |
| - "Since the goal is to keep the car on the deisred trajectory, it is convenient\n", |
| 413 | + "Since the goal is to keep the car on the desired trajectory, it is convenient\n", |
416 | 414 | "to represent the state of the car in a coordinate frame that is local to the trajectory.\n",
|
417 | 415 | "To do so, for each point along $\\gamma$, we define a frame with origin $\\gamma(s)$,\n",
|
418 | 416 | "with axes $t_\\gamma(s)$ and $n_\\gamma(s)$, the tangent and normal vectors\n",
|
|
480 | 478 | "want the maneuver to take too long), and the comfort of the human passenger.\n",
|
481 | 479 | "As mentioned above, humans are sensitive to acceleration changes in the lateral direction,\n",
|
482 | 480 | "therefore, we might wish to minimize the overall effect of such changes.\n",
|
483 |
| - "Mathematically, the instantaneous change in lateral cceleration is given by the third\n", |
| 481 | + "Mathematically, the instantaneous change in lateral acceleration is given by the third\n", |
484 | 482 | "derivative of $d$, which is known as the **jerk**.\n",
|
485 | 483 | "For a given trajectory $d(t)$, defined on the interval $[0,T]$, the following\n",
|
486 |
| - "cost functional penalizes aggregate jerk and total exectution time\n", |
| 484 | + "cost functional penalizes aggregate jerk and total execution time\n", |
487 | 485 | "\\begin{equation}\n",
|
488 | 486 | "J(d) = \\int_0^T \\left(\\frac{d}{dt}\\ddot{d}(\\tau)\\right)^2 d\\tau + \\beta T\n",
|
489 | 487 | "\\end{equation}\n",
|
490 | 488 | "In general, it may not be possible to solve this optimization problem in real time.\n",
|
491 |
| - "In such cases, rather than using $J$ to solve find the optimal $d$, we\n", |
| 489 | + "In such cases, rather than using $J$ to find the optimal $d$, we\n", |
492 | 490 | "can use a generate-and-test approach.\n",
|
493 | 491 | "With such an approach, several values of $T$ are proposed, and the corresponding quintic trajectories\n",
|
494 | 492 | "are computed for each of these. It is then a simple matter to evaluate the cost of each of\n",
|
|
0 commit comments