Skip to content

Commit cd65de2

Browse files
committed
add math descriptions
1 parent 9438894 commit cd65de2

File tree

1 file changed

+93
-26
lines changed

1 file changed

+93
-26
lines changed

PathPlanning/QuinticPolynomialsPlanner/quintic_polynomials_planner.ipynb

Lines changed: 93 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,112 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5+
"metadata": {},
56
"source": [
67
"# Quintic polynomials planner"
7-
],
8-
"metadata": {
9-
"collapsed": false
10-
}
8+
]
119
},
1210
{
1311
"cell_type": "markdown",
12+
"metadata": {},
1413
"source": [
1514
"## Quintic polynomials for one dimensional robot motion\n",
1615
"\n",
17-
"We assume a dimensional robot motion $x(t)$ at time $t$ is formulated as a quintic polynomials based on time as follows:\n",
16+
"We assume a one-dimensional robot motion $x(t)$ at time $t$ is formulated as a quintic polynomials based on time as follows:\n",
1817
"\n",
19-
"$x(t) = a_0+a_1t+a_2t^2+a_3t^3+a_4t^4$\n",
18+
"$x(t) = a_0+a_1t+a_2t^2+a_3t^3+a_4t^4+a_5t^5$ --(1)\n",
2019
"\n",
21-
"a_0, a_1. a_2, a_3 are parameters of the quintic polynomial.\n",
20+
"$a_0, a_1. a_2, a_3, a_4, a_5$ are parameters of the quintic polynomial.\n",
2221
"\n",
23-
"So, when time is 0,\n",
22+
"It is assumed that terminal states (start and end) are known as boundary conditions.\n",
23+
"\n",
24+
"Start position, velocity, and acceleration are $x_s, v_s, a_s$ respectively.\n",
2425
"\n",
25-
"$x(0) = a_0 = x_s$\n",
26+
"End position, velocity, and acceleration are $x_e, v_e, a_e$ respectively.\n",
2627
"\n",
27-
"$x_s$ is a start x position.\n",
28+
"So, when time is 0.\n",
2829
"\n",
29-
"Then, differentiating this equation with t, \n",
30+
"$x(0) = a_0 = x_s$ -- (2)\n",
3031
"\n",
31-
"$x'(t) = a_1+2a_2t+3a_3t^2+4a_4t^3$\n",
32+
"Then, differentiating the equation (1) with t, \n",
33+
"\n",
34+
"$x'(t) = a_1+2a_2t+3a_3t^2+4a_4t^3+5a_5t^4$ -- (3)\n",
3235
"\n",
3336
"So, when time is 0,\n",
3437
"\n",
35-
"$x'(0) = a_1 = v_s$\n",
38+
"$x'(0) = a_1 = v_s$ -- (4)\n",
3639
"\n",
37-
"$v_s$ is a initial speed for x axis.\n",
40+
"Then, differentiating the equation (3) with t again, \n",
3841
"\n",
39-
"=== TBD ==== \n"
40-
],
41-
"metadata": {
42-
"collapsed": false
43-
}
42+
"$x''(t) = 2a_2+6a_3t+12a_4t^2$ -- (5)\n",
43+
"\n",
44+
"So, when time is 0,\n",
45+
"\n",
46+
"$x''(0) = 2a_2 = a_s$ -- (6)\n",
47+
"\n",
48+
"so, we can calculate $a_0$, $a_1$, $a_2$ with eq. (2), (4), (6) and boundary conditions.\n",
49+
"\n",
50+
"$a_3, a_4, a_5$ are still unknown in eq(1).\n"
51+
]
52+
},
53+
{
54+
"cell_type": "markdown",
55+
"metadata": {},
56+
"source": [
57+
"We assume that the end time for a maneuver is $T$, we can get these equations from eq (1), (3), (5):\n",
58+
"\n",
59+
"$x(T)=a_0+a_1T+a_2T^2+a_3T^3+a_4T^4+a_5T^5=x_e$ -- (7)\n",
60+
"\n",
61+
"$x'(T)=a_1+2a_2T+3a_3T^2+4a_4T^3+5a_5T^4=v_e$ -- (8)\n",
62+
"\n",
63+
"$x''(T)=2a_2+6a_3T+12a_4T^2+20a_5T^3=a_e$ -- (9)\n"
64+
]
65+
},
66+
{
67+
"cell_type": "markdown",
68+
"metadata": {},
69+
"source": [
70+
"From eq (7), (8), (9), we can calculate $a_3, a_4, a_5$ to solve the linear equations.\n",
71+
"\n",
72+
"$Ax=b$\n",
73+
"\n",
74+
"$\\begin{bmatrix} T^3 & T^4 & T^5 \\\\ 3T^2 & 4T^3 & 5T^4 \\\\ 6T & 12T^2 & 20T^3 \\end{bmatrix}\n",
75+
"\\begin{bmatrix} a_3\\\\ a_4\\\\ a_5\\end{bmatrix}=\\begin{bmatrix} x_e-x_s-v_sT-0.5a_sT^2\\\\ v_e-v_s-a_sT\\\\ a_e-a_s\\end{bmatrix}$\n",
76+
"\n",
77+
"We can get all unknown parameters now"
78+
]
79+
},
80+
{
81+
"cell_type": "markdown",
82+
"metadata": {},
83+
"source": [
84+
"## Quintic polynomials for two dimensional robot motion (x-y)\n",
85+
"\n",
86+
"If you use two quintic polynomials along x axis and y axis, you can plan for two dimensional robot motion in x-y plane.\n",
87+
"\n",
88+
"$x(t) = a_0+a_1t+a_2t^2+a_3t^3+a_4t^4+a_5t^5$ --(10)\n",
89+
"\n",
90+
"$y(t) = b_0+b_1t+b_2t^2+b_3t^3+b_4t^4+b_5t^5$ --(11)\n",
91+
"\n",
92+
"It is assumed that terminal states (start and end) are known as boundary conditions.\n",
93+
"\n",
94+
"Start position, orientation, velocity, and acceleration are $x_s, y_s, \\theta_s, v_s, a_s$ respectively.\n",
95+
"\n",
96+
"End position, orientation, velocity, and acceleration are $x_e, y_e. \\theta_e, v_e, a_e$ respectively.\n",
97+
"\n",
98+
"Each velocity and acceleration boundary condition can be calculated with each orientation.\n",
99+
"\n",
100+
"$v_{xs}=v_scos(\\theta_s), v_{ys}=v_ssin(\\theta_s)$\n",
101+
"\n",
102+
"$v_{xe}=v_ecos(\\theta_e), v_{ye}=v_esin(\\theta_e)$\n"
103+
]
104+
},
105+
{
106+
"cell_type": "code",
107+
"execution_count": null,
108+
"metadata": {},
109+
"outputs": [],
110+
"source": []
44111
}
45112
],
46113
"metadata": {
@@ -52,25 +119,25 @@
52119
"language_info": {
53120
"codemirror_mode": {
54121
"name": "ipython",
55-
"version": 2
122+
"version": 3
56123
},
57124
"file_extension": ".py",
58125
"mimetype": "text/x-python",
59126
"name": "python",
60127
"nbconvert_exporter": "python",
61-
"pygments_lexer": "ipython2",
62-
"version": "2.7.6"
128+
"pygments_lexer": "ipython3",
129+
"version": "3.7.5"
63130
},
64131
"pycharm": {
65132
"stem_cell": {
66133
"cell_type": "raw",
67-
"source": [],
68134
"metadata": {
69135
"collapsed": false
70-
}
136+
},
137+
"source": []
71138
}
72139
}
73140
},
74141
"nbformat": 4,
75-
"nbformat_minor": 0
76-
}
142+
"nbformat_minor": 1
143+
}

0 commit comments

Comments
 (0)