提交 18c67884 编写于 作者: J jiangyifei 提交者: Jiangtao Hu

[doc] updated planning doc with tech writer's revision.

上级 1ef9e74f
......@@ -2,32 +2,32 @@
Quadratic programming + Spline interpolation
## 1. Objective function
## 1. Objective function
### 1.1 Get path length
### 1.1 Get path length
Path is defined in station-lateral corrdination system. The **s** range from veichle's current position to default planing path length.
Path is defined in station-lateral coordination system. The **s** range from vehicle's current position to default planing path length.
### 1.2 Get spline segments
### 1.2 Get spline segments
Split the path into n segments. each segment trajectory is defined by a polynomial.
Split the path into **n** segments. each segment trajectory is defined by a polynomial.
### 1.3 Define function for each spline segment
### 1.3 Define function for each spline segment
Each segment *i* has accumulated distance $d_i$ along reference line. And the trajactory for the segment is defined as a polynomial of degree five by default
Each segment ***i*** has accumulated distance $d_i$ along reference line. The trajectory for the segment is defined as a polynomial of degree five by default.
$$
l = f_i(s)
= a_{i0} + a_{i1} * s + a_{i2} * s^2 + a_{i3} * s^3 + a_{i4} * s^4 + a_{i5} * s^5 (0 \leq s \leq d_{i})
$$
### 1.4 Define objective function of optimization for each segment
### 1.4 Define objective function of optimization for each segment
$$
cost = \sum_{i=1}^{n} \Big( w_1 \cdot \int\limits_{0}^{d_i} (f_i')^2(s) ds + w_2 \cdot \int\limits_{0}^{d_i} (f_i'')^2(s) ds + w_3 \cdot \int\limits_{0}^{d_i} (f_i^{\prime\prime\prime})^2(s) ds \Big)
$$
### 1.5 Convert the cost function to QP formulation
### 1.5 Convert the cost function to QP formulation
QP formulation:
$$
......@@ -39,7 +39,7 @@ A_{eq}x = b_{eq}
\\
Ax \leq b
$$
Below is the example for converting cost function to QP formulaiton.
Below is the example for converting the cost function into the QP formulaiton.
$$
f_i(s) =
\begin{vmatrix} a_{i0} & a_{i1} & a_{i2} & a_{i3} & a_{i4} & a_{i5} \end{vmatrix}
......@@ -47,7 +47,7 @@ f_i(s) =
\begin{vmatrix} 1 \\ s \\ s^2 \\ s^3 \\ s^4 \\ s^5 \end{vmatrix}
$$
and
And
$$
f_i'(s) =
\begin{vmatrix} a_{i0} & a_{i1} & a_{i2} & a_{i3} & a_{i4} & a_{i5} \end{vmatrix}
......@@ -56,7 +56,7 @@ f_i'(s) =
$$
and
And
$$
f_i'(s)^2 =
\begin{vmatrix} a_{i0} & a_{i1} & a_{i2} & a_{i3} & a_{i4} & a_{i5} \end{vmatrix}
......@@ -67,7 +67,7 @@ f_i'(s)^2 =
\cdot
\begin{vmatrix} a_{i0} \\ a_{i1} \\ a_{i2} \\ a_{i3} \\ a_{i4} \\ a_{i5} \end{vmatrix}
$$
and
And
$$
\int\limits_{0}^{d_i} f_i'(s)^2 ds =
\int\limits_{0}^{d_i}
......@@ -81,7 +81,7 @@ $$
$$
and
And
$$
\int\limits_{0}^{d_i} f'(s)^2 ds =
\begin{vmatrix} a_{i0} & a_{i1} & a_{i2} & a_{i3} & a_{i4} & a_{i5} \end{vmatrix}
......@@ -95,7 +95,7 @@ $$
$$
and
And
$$
\int\limits_{0}^{d_i}
f'(s)^2 ds =\begin{vmatrix} a_{i0} & a_{i1} & a_{i2} & a_{i3} & a_{i4} & a_{i5} \end{vmatrix}
......@@ -111,7 +111,7 @@ f'(s)^2 ds =\begin{vmatrix} a_{i0} & a_{i1} & a_{i2} & a_{i3} & a_{i4} & a_{i5
\cdot
\begin{vmatrix} a_{i0} \\ a_{i1} \\ a_{i2} \\ a_{i3} \\ a_{i4} \\ a_{i5} \end{vmatrix}
$$
and
And
$$
\int\limits_{0}^{d_i}
f'_i(s)^2 ds =\begin{vmatrix} a_{i0} & a_{i1} & a_{i2} & a_{i3} & a_{i4} & a_{i5} \end{vmatrix}
......@@ -127,38 +127,38 @@ f'_i(s)^2 ds =\begin{vmatrix} a_{i0} & a_{i1} & a_{i2} & a_{i3} & a_{i4} & a_{
\begin{vmatrix} a_{i0} \\ a_{i1} \\ a_{i2} \\ a_{i3} \\ a_{i4} \\ a_{i5} \end{vmatrix}
$$
## 2 Constraints
## 2 Constraints
### 2.1 The init point constraints
### 2.1 The init point constraints
Let's assume the the first point is ($s_0$, $l_0$), and $l_0$ should be on the planned path $f_i(s)$, $f'_i(s)$, and $f_i(s)''$. we convert those constraint into QP equality constraints
Assume that the first point is ($s0$, $l0$), and that $l0$ is on the planned path $f_i(s)$, $f'i(s)$, and $f_i(s)''$. Convert those constraints into QP equality constraints, using:
$$
A_{eq}x = b_{eq}
$$
Below is the steps of conversion
Below are the steps of conversion.
$$
f_i(s_0) =
\begin{vmatrix} 1 & s_0 & s_0^2 & s_0^3 & s_0^4&s_0^5 \end{vmatrix}
\cdot
\begin{vmatrix} a_{i0} \\ a_{i1} \\ a_{i2} \\ a_{i3} \\ a_{i4} \\ a_{i5}\end{vmatrix} = l_0
$$
and
And
$$
f'_i(s_0) =
\begin{vmatrix} 0& 1 & s_0 & s_0^2 & s_0^3 & s_0^4 \end{vmatrix}
\cdot
\begin{vmatrix} a_{i0} \\ a_{i1} \\ a_{i2} \\ a_{i3} \\ a_{i4} \\ a_{i5} \end{vmatrix} = l_0
$$
and
And
$$
f''_i(s_0) =
\begin{vmatrix} 0&0& 1 & s_0 & s_0^2 & s_0^3 \end{vmatrix}
\cdot
\begin{vmatrix} a_{i0} \\ a_{i1} \\ a_{i2} \\ a_{i3} \\ a_{i4} \\ a_{i5} \end{vmatrix} = l_0
$$
$i$ is the index of segment that contains the $s_0$.
The $i$ is the index of segment that contains the $s_0$.
so we get the equality constraint as
Therefore the equality constraint is:
$$
\begin{vmatrix}
1 & s_0 & s_0^2 & s_0^3 & s_0^4&s_0^5 \\
......@@ -175,11 +175,11 @@ $$
\end{vmatrix}
$$
### 2.2 The end point constraints
### 2.2 The end point constraints
Similar to the init point, the end point $(s_e, l_e)$ is known and shoud produce the same constraint as above.
Similar to the init point, the end point $(s_e, l_e)$ is known and should produce the same constraint as described in the init point calculations.
Combined init point and end point, we get equality constraint as
Combine the init point and end point, and show the equality constraint as:
$$
\begin{vmatrix}
1 & s_0 & s_0^2 & s_0^3 & s_0^4&s_0^5 \\
......@@ -203,13 +203,13 @@ $$
$$
### 2.3 Joint smoothness constraints
### 2.3 Joint smoothness constraints
This constraint is to make the spline joint smooth. Let's assume two segment $seg_k$ and $seg_{k+1}$ are connected, and the accumulated s of segment $seg_k$ is $s_k$. The we can get the constraint equation as
This constraint is designed to smooth the spline joint. Assume two segments $seg_k$ and $seg_{k+1}$ are connected, and the accumulated **s** of segment $seg_k$ is $s_k$. Calculate the constraint equation as:
$$
f_k(s_k) = f_{k+1} (s_0)
$$
namely
Below are the steps of the calculation.
$$
\begin{vmatrix}
1 & s_k & s_k^2 & s_k^3 & s_k^4&s_k^5 \\
......@@ -227,7 +227,7 @@ $$
a_{k+1,0} \\ a_{k+1,1} \\ a_{k+1,2} \\ a_{k+1,3} \\ a_{k+1,4} \\ a_{k+1,5}
\end{vmatrix}
$$
then
Then
$$
\begin{vmatrix}
1 & s_k & s_k^2 & s_k^3 & s_k^4&s_k^5 & -1 & -s_{0} & -s_{0}^2 & -s_{0}^3 & -s_{0}^4&-s_{0}^5\\
......@@ -238,9 +238,9 @@ $$
\end{vmatrix}
= 0
$$
$s_0$ = 0 in the equation.
Use $s_0$ = 0 in the equation.
Similarly we can get the equality constraints for
Similarly calculate the equality constraints for:
$$
f'_k(s_k) = f'_{k+1} (s_0)
\\
......@@ -249,13 +249,13 @@ f''_k(s_k) = f''_{k+1} (s_0)
f'''_k(s_k) = f'''_{k+1} (s_0)
$$
### 2.4 Sampled points for boundary constraint
### 2.4 Sampled points for boundary constraint
Evenly sample m points along the path, and check the obstacle boundary at those points. Convert the constraint into QP inequality constraints
Evenly sample **m** points along the path, and check the obstacle boundary at those points. Convert the constraint into QP inequality constraints, using:
$$
Ax \leq b
$$
We first find lower boundary $l_{lb,j}$ at those points ($s_j$, $l_j$) and $j\in[0, m]$ based on road width and surrounding obstacles. The calculate the inequality constraints as
First find the lower boundary $l_{lb,j}$ at those points ($s_j$, $l_j$) and $j\in[0, m]$ based on the road width and surrounding obstacles. Calculate the inequality constraints as:
$$
\begin{vmatrix}
1 & s_0 & s_0^2 & s_0^3 & s_0^4&s_0^5 \\
......@@ -273,7 +273,7 @@ $$
$$
similarly, for upper boundary $l_{ub,j}$, we get the inequality constraints as
Similarly, for the upper boundary $l_{ub,j}$, calculate the inequality constraints as:
$$
\begin{vmatrix}
1 & s_0 & s_0^2 & s_0^3 & s_0^4&s_0^5 \\
......
......@@ -2,11 +2,11 @@
## 1 Definition
## 1 Definition
After finding a path in QP-Spline-Path, we convert all obstacles on the path and ADV (autonomous driving vehicle) itself into a ST graph, which represents the stations changes over time along the path. Our speed optimization task is to find a path on ST graph that is collision-free and comfort.
After finding a path in QP-Spline-Path, Apollo converts all obstacles on the path and the ADV (autonomous driving vehicle) into an ST graph, which represents the station changes over time along the path. The speed optimization task is to find a path on the ST graph that is collision-free and safe.
We use spline to define the path, and find the best path leveraging Quadratic programming with a set of conditions. QP formulation is defined as
Apollo uses spline to define the path. To find the best path, Apollo leverages Quadratic programming with a set of conditions. The QP formulation is defined as:
$$
\frac{1}{2} \cdot x^T \cdot H \cdot x + f^T \cdot x
\\
......@@ -17,59 +17,57 @@ A_{eq}x = b_{eq}
Ax \leq b
$$
## 2 Objective function
## 2 Objective function
### 1.1 Get spline segments
Split the path into n segments. each segment trajectory is defined by a polynomial.
Split the path into **n** segments. Each segment trajectory is defined by a polynomial.
### 1.2 Define function for each spline segment
### 1.2 Define function for each spline segment
Each segment *i* has accumulated distance $d_i$ along reference line. And the trajactory for the segment is defined as a polynomial of degree five by default
Each segment ***i*** has accumulated distance $d_i$ along a reference line. And the trajectory for the segment is defined as a polynomial of degree five by default.
$$
s = f_i(t)
= a_{0i} + a_{1i} \cdot t + a_{2i} \cdot t^2 + a_{3i} \cdot t^3 + a_{4i} \cdot t^4 + a_{5i} \cdot t^5
$$
### 1.3 Define objective function of optimization for each segment
### 1.3 Define objective function of optimization for each segment
We first define $cost_1$ to make the trajectory smooth
Apollo first defines $cost_1$ to make the trajectory smooth:
$$
cost_1 = \sum_{i=1}^{n} \Big( w_1 \cdot \int\limits_{0}^{d_i} (f_i')^2(s) ds + w_2 \cdot \int\limits_{0}^{d_i} (f_i'')^2(s) ds + w_3 \cdot \int\limits_{0}^{d_i} (f_i^{\prime\prime\prime})^2(s) ds \Big)
$$
Then we define $cost_2$ that is the difference between the final ST trajectory and cruise ST trajectory (with given speed limits) (m points)
Then Apollo defines $cost_2$ as the difference between the final ST trajectory and the cruise ST trajectory (with given speed limits — m points):
$$
cost_2 = \sum_{i=1}^{n}\sum_{j=1}^{m}\Big(f_i(t_j)- s_j\Big)^2
$$
Similarly, we define $cost_3$ that is the difference between the finial ST path and the follow ST path (o points)
Similarly, Apollo defines $cost_3$ that is the difference between the first ST path and the follow ST path (o points):
$$
cost_3 = \sum_{i=1}^{n}\sum_{j=1}^{o}\Big(f_i(t_j)- s_j\Big)^2
$$
Finally, the objective function is defined as
Finally, the objective function is defined as:
$$
cost = cost_1 + cost_2 + cost_3
$$
## 3 Constraints
### 3.1 The init point constraints
## 2 Constraints
### 2.1 The init point constraints
Let's assume the the first point is ($t_0$, $s_0$), and $s_0$ should be on the planned path $f_i(t)$, $f'_i(t)$, and $f_i(t)''$ (position, velocity, acceleration). we convert those constraint into QP equality constraints
Given the assumption that the the first point is ($t0$, $s0$), and $s0$ is on the planned path $f_i(t)$, $f'i(t)$, and $f_i(t)''$ (position, velocity, acceleration). Apollo converts those constraint into QP equality constraints:
$$
A_{eq}x = b_{eq}
$$
### 2.2 Monotone constraint
### 3.2 Monotone constraint
The path need to be monotone, e.g., vehicle can only drive forward.
The path must be monotone, e.g., the vehicle can only drive forward.
sample m points on the path, for each $j$ and $j-1$ point pairs ($j\in[1,...,m]$)
Sample **m** points on the path, for each $j$ and $j-1$ point pairs ($j\in[1,...,m]$):
if the two pionts on the same spline $k​$
If the two points on the same spline $k$:
$$
\begin{vmatrix} 1 & t_j & t_j^2 & t_j^3 & t_j^4&t_j^5 \\ \end{vmatrix}
\cdot
......@@ -79,7 +77,7 @@ $$
\cdot
\begin{vmatrix} a_{k} \\ b_{k} \\ c_{k} \\ d_{k} \\ e_{k} \\ f_{k} \end{vmatrix}
$$
if the two points on the different spline $k$ and $l$
If the two points on the different spline $k$ and $l$:
$$
\begin{vmatrix} 1 & t_j & t_j^2 & t_j^3 & t_j^4&t_j^5 \\ \end{vmatrix}
\cdot
......@@ -92,13 +90,13 @@ $$
### 2.3 Joint smoothness constraints
### 3.3 Joint smoothness constraints
This constraint is to make the spline joint smooth. Let's assume two segment $seg_k$ and $seg_{k+1}$ are connected, and the accumulated s of segment $seg_k$ is $s_k$. The we can get the constraint equations as
This constraint is designed to smooth the spline joint. Given the assumption that two segments, $seg_k$ and $seg_{k+1}$, are connected, and the accumulated **s** of segment is $seg_k$ is $s_k$, Apollo calculates the constraint equation as:
$$
f_k(t_k) = f_{k+1} (t_0)
$$
namely
Namely:
$$
\begin{vmatrix}
1 & t_k & t_k^2 & t_k^3 & t_k^4&t_k^5 \\
......@@ -116,7 +114,7 @@ $$
a_{k+1,0} \\ a_{k+1,1} \\ a_{k+1,2} \\ a_{k+1,3} \\ a_{k+1,4} \\ a_{k+1,5}
\end{vmatrix}
$$
then
Then
$$
\begin{vmatrix}
1 & t_k & t_k^2 & t_k^3 & t_k^4&t_k^5 & -1 & -t_{0} & -t_{0}^2 & -t_{0}^3 & -t_{0}^4&-t_{0}^5\\
......@@ -127,9 +125,9 @@ $$
\end{vmatrix}
= 0
$$
$t_0$ = 0 in the equation.
The result is $t_0$ = 0 in the equation.
Similarly we can get the equality constraints for
Similarly calculate the equality constraints for
$$
f'_k(t_k) = f'_{k+1} (t_0)
\\
......@@ -138,13 +136,13 @@ f''_k(t_k) = f''_{k+1} (t_0)
f'''_k(t_k) = f'''_{k+1} (t_0)
$$
### 2.4 Sampled points for boundary constraint
### 3.4 Sampled points for boundary constraint
Evenly sample m points along the path, and check the obstacle boundary at those points. convert the constraint into QP inequality constraints
Evenly sample **m** points along the path, and check the obstacle boundary at those points. Convert the constraint into QP inequality constraints, using:
$$
Ax \leq b
$$
We first find lower boundary $l_{lb,j}$ at those points ($s_j$, $l_j$) and $j\in[0, m]$ based on road width and surrounding obstacles. The calculate the inequality constraints as
Apollo first finds the lower boundary $l_{lb,j}$ at those points ($s_j$, $l_j$) and $j\in[0, m]$ based on the road width and surrounding obstacles. Then it calculates the inequality constraints as:
$$
\begin{vmatrix}
1 & t_0 & t_0^2 & t_0^3 & t_0^4&t_0^5 \\
......@@ -162,7 +160,7 @@ $$
$$
similarly, for upper boundary $l_{ub,j}$, we get the inequality constraints as
Similarly, for upper boundary $l_{ub,j}$, Apollo calculates the inequality constraints as:
$$
\begin{vmatrix}
1 & t_0 & t_0^2 & t_0^3 & t_0^4&t_0^5 \\
......@@ -182,15 +180,15 @@ $$
### 2.5 Speed Boundary constraint
### 3.5 Speed Boundary constraint
We need to limit speed boundary as well.
Apollo establishes a speed limit boundary as well.
Sample m points on st curve, and get speed limits upper bound and lower bound for each point $j$, e.g., $v_{ub,j}$ and $v_{lb,j}$ . The constraints is defined as
Sample **m** points on the st curve, and get speed limits defined as an upper boundary and a lower boundary for each point $j$, e.g., $v{ub,j}$ and $v{lb,j}$ . The constraints are defined as:
$$
f'(t_j) \geq v_{lb,j}
$$
namely
Namely
$$
\begin{vmatrix}
0& 1 & t_0 & t_0^2 & t_0^3 & t_0^4 \\
......@@ -205,11 +203,11 @@ a_i \\ b_i \\ c_i \\ d_i \\ e_i \\ f_i
\geq
\begin{vmatrix} v_{lb,0}\\ v_{lb,1}\\ ...\\ v_{lb,m}\\ \end{vmatrix}
$$
and
And
$$
f'(t_j) \leq v_{ub,j}
$$
namely
Namely
$$
\begin{vmatrix}
0& 1 & t_0 & t_0^2 & t_0^3 & t_0^4 \\
......
......@@ -6,7 +6,7 @@ Quadratic programming + Spline interpolation
### 1.1 Segment routing path
Segment routing path into n segments. each segment trajectory is defined by two polynomials.
Segment routing path into **n** segments. each segment trajectory is defined by two polynomials:
$$
x = f_i(t)
......@@ -47,11 +47,11 @@ $$
### 2.1 Joint smoothness constraints
This constraint is to make the spline joint smooth. Let's assume two segment $seg_k$ and $seg_{k+1}$ are connected, and the accumulated s of segment $seg_k$ is $s_k$. The we can get the constraint euqation as
This constraint smoothes the spline joint. Let's assume two segments, $seg_k$ and $seg_{k+1}$, are connected and the accumulated **s** of segment $seg_k$ is $s_k$. Calculate the constraint equation as:
$$
f_k(s_k) = f_{k+1} (s_0)
$$
Similarly we can get the equality constraints for
Similarly the formula works for the equality constraints, such as:
$$
f'_k(s_k) = f'_{k+1} (s_0)
\\
......@@ -70,7 +70,7 @@ $$
### 2.2 Sampled points for boundary constraint
Evenly sample m points along the path, and check predefined boundary at those points.
Evenly sample **m** points along the path and check the predefined boundaries at those points.
$$
f_i(t_l) - x_l< boundary
\\
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册