百度Apollo项目
用到了多种坐标系,其中帮助文档提及的坐标系包括:
- 全球地理坐标系(The Global Geographic coordinate system )
- 局部坐标系—东-北-天坐标(The Local Frame – East-North-Up,ENU)
- 车身坐标系—右-前-天坐标(The Vehicle Frame —Right-Forward-Up,RFU)
- 车身坐标系—前-左-天坐标(The Vehicle Frame —Front-Left-Up,FLU)
- 还有一种Frenet坐标系(又称Frenet–Serret公式,Apollo项目文档未提及,但在Apollo项目的规划模块中得到广泛使用。)
本文首先简介Apollo项目提及的三种坐标系,之后重点介绍Frenet坐标系及其与车辆坐标系之间的转换公式,最后对Apollo项目中Frenet坐标系与车辆坐标系的转换代码进行详细解释。
一、Apollo文档提及的坐标系
(一)全球地理坐标系
Apollo项目使用全球地理坐标系表示高精地图( the high-definition map,HD Map)中诸元素的几何位置,通常包括:纬度(latitude)、经度(longitude)和海拔(elevation)。
全球地理坐标系普遍采用地理信息系统(Geographic Information System,GIS)中用到的WGS-84坐标系(the World Geodetic System dating from 1984),如下图所示,注意海拔定义为椭球体高程(the ellipsoidal height):
(二)局部坐标系—东-北-天坐标(ENU)
局部坐标系定义为:
- X轴:指向东边
- Y轴:指向北边
- Z轴:指向天顶
如下图所示:
ENU局部坐标系采用三维直角坐标系来描述地球表面,实际应用较为困难,因此一般使用简化后的二维投影坐标系来描述。
在众多二维投影坐标系中,统一横轴墨卡托(The Universal Transverse Mercator ,UTM)坐标系是一种应用较为广泛的一种。UTM 坐标系统使用基于网格的方法表示坐标,它将地球分为 60 个经度区,每个区包含6度的经度范围,每个区内的坐标均基于横轴墨卡托投影,如下图所示:
(三)车身坐标系—右-前-天坐标(RFU)
车身坐标系—右-前-天坐标(RFU)的定义如下:
- X轴:面向车辆前方,右手所指方向
- Y轴:车辆前进方向
- Z轴:与地面垂直,指向车顶方向
注意:车辆参考点为后轴中心。该坐标系一般用于感知模块。
如下图所示:
(四)车身坐标系—前-左-天坐标(FLU)
车身坐标系—前-左-天坐标(FLU)的定义如下:
- X轴:车辆前进方向
- Y轴:面向车辆前方,左手所指方向
- Z轴:与地面垂直,指向车顶方向
注意:车辆参考点为后轴中心。
该坐标系常用于实时相对地图模块。将RFU坐标系向左旋转90度即可得到FLU坐标系。
二、Frenet坐标系
Frenet坐标系又称Frenet–Serret公式,Apollo项目文档未提及,但在规划模块中广泛使用。Frenet–Serret公式用于描述粒子在三维欧氏空间 R3R3内沿一条连续可微曲线的运动学特征,如下图所示:
其中,
T
⃗
\vec{T}
T
称为切向量(tangent),表示沿曲线运动方向的单位向量;
N
⃗
\vec{N}
N
称为法向量(normal),表示当前曲线运动平面内垂直于
T
⃗
\vec{T}
T
的单位向量;
B
⃗
\vec{B}
B
称为副法向量(binormal),表示同时垂直于
T
⃗
\vec{T}
T
和
N
⃗
\vec{N}
N
的单位向量。
令
R
⃗
(
t
)
\vec{R}(t)
R
(
t
)
为欧氏空间内随 t 改变的一条非退化曲线。
所谓非退化曲线就是一条不会退化为直线的曲线,亦即曲率不为0的曲线。
令
s
(
t
)
s(t)
s
(
t
)
是
t
t
t
时刻时曲线的累计弧长,其定义如下:
s
(
t
)
=
∫
0
t
∥
r
′
(
σ
)
∥
d
σ
(1)
s(t)=\int^{t}_{0} \Vert r^{‘}(\sigma) \Vert d\sigma \tag{1}
s
(
t
)
=
∫
0
t
∥
r
′
(
σ
)
∥
d
σ
(
1
)
假定
r
′
≠
0
r^{‘} \neq 0
r
′
=
0
,则意味着
s
(
t
)
s(t)
s
(
t
)
是严格单调递增函数。因此可将
t
t
t
表示为
s
s
s
的函数,从而有:
r
⃗
(
s
)
=
r
⃗
(
t
(
s
)
)
\vec{r}(s) = \vec{r}(t(s))
r
(
s
)
=
r
(
t
(
s
))
,这样我们就把曲线表示为弧长
s
s
s
的函数。
对于采用弧长参数
s
s
s
表示的非退化曲线
r
⃗
(
s
)
\vec{r}(s)
r
(
s
)
,我们定义其切向量
T
⃗
\vec{T}
T
、法向量
N
⃗
\vec{N}
N
、副法向量
B
⃗
\vec{B}
B
如下:
T
⃗
=
d
r
⃗
d
s
∥
d
r
⃗
d
s
∥
N
⃗
=
d
T
⃗
d
s
∥
d
T
⃗
d
s
∥
B
⃗
=
T
⃗
×
N
⃗
\vec{T} = \frac{\frac{d\vec{r}}{ds}}{\Vert\frac{d\vec{r}}{ds}\Vert} \\ \space \\ \vec{N} = \frac{\frac{d\vec{T}}{ds}}{\Vert\frac{d\vec{T}}{ds}\Vert} \\ \space \\ \vec{B}=\vec{T} \times \vec{N}
T
=
∥
d
s
d
r
∥
d
s
d
r
N
=
∥
d
s
d
T
∥
d
s
d
T
B
=
T
×
N
基于上述定义的Frenet–Serret公式表示为:
d
T
⃗
d
s
=
k
N
⃗
d
N
⃗
d
s
=
−
k
T
⃗
+
τ
N
⃗
d
B
⃗
d
s
=
−
τ
N
⃗
\frac{d\vec{T}}{ds} = k\vec{N} \\ \space \\ \frac{d\vec{N}}{ds} = -k\vec{T} + \tau\vec{N} \space \\ \frac{d\vec{B}}{ds} = -\tau\vec{N} \space \\
d
s
d
T
=
k
N
d
s
d
N
=
−
k
T
+
τ
N
d
s
d
B
=
−
τ
N
其中
κ
κ
κ
、
τ
τ
τ
分别表示曲线
r
⃗
(
s
)
\vec r(s)
r
(
s
)
的曲率( curvature)和挠率( torsion)。直观地讲,曲率是曲线不能形成一条直线的度量值,曲率越趋于0,则曲线越趋近于直线;挠率是曲线不能形成在同一平面内运动曲线的度量值,挠率越趋于0,则曲线越趋近于在同一平面内运动。
令
T
′
⃗
=
d
T
⃗
d
s
\vec{T^{‘}}=\frac{d\vec{T}}{ds}
T
′
=
d
s
d
T
,
N
′
⃗
=
d
N
⃗
d
s
\vec{N^{‘}}=\frac{d\vec{N}}{ds}
N
′
=
d
s
d
N
,
B
′
⃗
=
d
B
⃗
d
s
\vec{B^{‘}}=\frac{d\vec{B}}{ds}
B
′
=
d
s
d
B
,则Frenet–Serret公式的矩阵表示形式为:
[
T
′
⃗
N
′
⃗
B
′
⃗
]
=
[
0
k
0
−
k
0
τ
0
τ
0
]
[
T
⃗
N
⃗
B
⃗
]
(1)
\begin{bmatrix} \vec{T^{‘}} \\ \vec{N^{‘}} \\ \vec{B^{‘}} \\ \end{bmatrix}= \begin{bmatrix} 0 & k & 0\\ -k & 0 & τ\\ 0 & τ & 0\\ \end{bmatrix} \begin{bmatrix} \vec{T} \\ \vec{N} \\ \vec{B} \\ \end{bmatrix} \tag{1}
T
′
N
′
B
′
=
0
−
k
0
k
0
τ
0
τ
0
T
N
B
(
1
)
易见参数矩阵是反对称( skew-symmetric)的。
对于无人驾驶车辆而言,一般对高度信息不感兴趣,因此可以将车辆运动曲线投影到同一平面内,亦即
τ
=
0
τ=0
τ
=
0
,这样Frenet–Serret公式就可以简化为:
[
T
′
⃗
N
′
⃗
]
=
[
0
k
−
k
0
]
[
T
⃗
N
⃗
]
(2)
\begin{bmatrix} \vec{T^{‘}} \\ \vec{N^{‘}} \\ \end{bmatrix}= \begin{bmatrix} 0 & k\\ -k & 0\\ \end{bmatrix} \begin{bmatrix} \vec{T} \\ \vec{N} \\ \end{bmatrix} \tag{2}
[
T
′
N
′
]
=
[
0
−
k
k
0
]
[
T
N
]
(
2
)
三、Frenet坐标系与笛卡尔坐标系的转换公式
为什么要将笛卡尔坐标系转换为Frenet坐标系?因为可以这样可以将车辆的二维运动问题解耦为两个一维运动问题。显然,一维问题比二维问题容易求解,这就是笛卡尔坐标系转换为Frenet坐标系的必要性。
前已述及,在不考虑高度信息的前提下,Frenet坐标系可简化为由曲线切向量
T
⃗
\vec{T}
T
与法向量
N
⃗
\vec{N}
N
组成的二维直角坐标系。如下图所示,假定
r
⃗
(
s
)
\vec{r}(s)
r
(
s
)
是参考线(reference line)在弧长
s
s
s
处的位置,
x
⃗
\vec{x}
x
是当前车辆轨迹(trajectory)点,该向量一般采用笛卡尔坐标系(常用ENU坐标)表示
x
⃗
=
[
x
,
y
,
z
]
T
\vec{x}=[x,y,z]^{T}
x
=
[
x
,
y
,
z
]
T
,
z
z
z
坐标一般忽略,但这里我们采用弧长
s
s
s
和横向偏移
l
l
l
(即沿当前参考线位置
r
⃗
(
s
)
\vec{r}(s)
r
(
s
)
法线方向
N
⃗
r
\vec{N}_r
N
r
的偏移量)对其描述,即
x
⃗
=
x
⃗
(
s
,
l
)
\vec{x}=\vec{x}(s,l)
x
=
x
(
s
,
l
)
。
令
θ
r
\theta_r
θ
r
、
T
⃗
r
\vec{T}_r
T
r
、
N
⃗
r
\vec{N}_r
N
r
分别为当前参考线
r
⃗
(
s
)
\vec{r}(s)
r
(
s
)
的方位角、单位切向量和单位法向量,
θ
x
\theta_x
θ
x
、
T
⃗
x
\vec{T}_x
T
x
、
N
⃗
x
\vec{N}_x
N
x
分别为当前轨迹点
x
⃗
(
s
,
l
)
\vec{x}(s,l)
x
(
s
,
l
)
的方位角、单位切向量和单位法向量,根据正交基的定义有:
T
⃗
r
=
[
c
o
s
θ
r
s
i
n
θ
r
]
T
N
⃗
r
=
[
−
s
i
n
θ
r
c
o
s
θ
r
]
T
T
⃗
x
=
[
c
o
s
θ
x
s
i
n
θ
x
]
T
N
⃗
x
=
[
−
s
i
n
θ
x
c
o
s
θ
x
]
T
\vec{T}_r=[cos \theta_r \space \space sin \theta_r]^T \\ \vec{N}_r=[-sin \theta_r \space \space cos \theta_r]^T \\ \vec{T}_x=[cos \theta_x \space \space sin \theta_x]^T \\ \vec{N}_x=[-sin \theta_x \space \space cos \theta_x]^T \\
T
r
=
[
cos
θ
r
s
in
θ
r
]
T
N
r
=
[
−
s
in
θ
r
cos
θ
r
]
T
T
x
=
[
cos
θ
x
s
in
θ
x
]
T
N
x
=
[
−
s
in
θ
x
cos
θ
x
]
T
根据平面几何知识易知:
x
⃗
(
s
,
l
)
=
r
⃗
(
s
)
+
l
(
s
)
N
⃗
r
(
s
)
(3)
\vec{x}(s,l)=\vec{r}(s)+l(s)\vec{N}_r(s) \tag{3}
x
(
s
,
l
)
=
r
(
s
)
+
l
(
s
)
N
r
(
s
)
(
3
)
从而有(为简洁起见,下面的推导过程均省略参数):
l
N
⃗
r
T
N
⃗
r
=
N
⃗
r
T
[
r
⃗
−
x
⃗
]
l
=
N
⃗
r
T
[
x
⃗
−
r
⃗
]
=
[
r
⃗
−
x
⃗
]
N
⃗
r
(4)
l\vec{N}^{T}_{r}\vec{N}_{r}=\vec{N}^{T}_{r}[\vec{r}-\vec{x}] \\ \space \\ l=\vec{N}^{T}_{r}[\vec{x}-\vec{r}]=[\vec{r}-\vec{x}]\vec{N}_{r} \tag{4}
l
N
r
T
N
r
=
N
r
T
[
r
−
x
]
l
=
N
r
T
[
x
−
r
]
=
[
r
−
x
]
N
r
(
4
)
(4)式在数学上美观,但不好编程实现,因此换一个表示方法。
设
x
⃗
,
r
⃗
\vec{x},\vec{r}
x
,
r
的笛卡尔坐标分别为:
(
x
,
y
)
(x,y)
(
x
,
y
)
、
(
x
r
,
y
r
)
(x_r,y_r)
(
x
r
,
y
r
)
,根据两点间距离公式及
N
⃗
r
\vec{N}_r
N
r
的定义,可得:
l
=
±
(
x
−
x
r
)
2
+
(
y
−
y
r
)
2
,
[
(
y
−
y
r
)
c
o
s
θ
r
−
(
x
−
x
r
)
s
i
n
θ
r
]
>
0
?
p
o
s
i
t
i
v
e
:
n
e
g
t
i
v
e
(4.a)
l=\pm \sqrt{(x-x_r)^2+(y-y_r)^2}, \\ [(y-y_r)cos\theta_r-(x-x_r)sin\theta_r]>0 \space ? \space positive:negtive \tag{4.a}
l
=
±
(
x
−
x
r
)
2
+
(
y
−
y
r
)
2
,
[(
y
−
y
r
)
cos
θ
r
−
(
x
−
x
r
)
s
in
θ
r
]
>
0
?
p
os
i
t
i
v
e
:
n
e
g
t
i
v
e
(
4.a
)
设
a
a
a
为任意一个变量(或向量),记
a
˙
=
d
(
a
)
d
t
a
¨
=
d
(
a
˙
)
d
t
a
′
=
d
(
a
)
d
s
a
′
′
=
d
(
a
′
)
d
s
\dot{a}=\frac{d(a)}{dt} \\ \space \\ \ddot{a}=\frac{d(\dot{a})}{dt} \\ \space \\ a^{‘}=\frac{d(a)}{ds} \\ \space \\ a^{”}=\frac{d(a^{‘})}{ds}
a
˙
=
d
t
d
(
a
)
a
¨
=
d
t
d
(
a
˙
)
a
′
=
d
s
d
(
a
)
a
′′
=
d
s
d
(
a
′
)
根据上式可知,约定
a
˙
\dot{a}
a
˙
表示
a
a
a
对时间
t
t
t
的一阶求导,
a
¨
\ddot{a}
a
¨
表示
a
a
a
对时间
t
t
t
的二阶求导,
a
′
a^{‘}
a
′
表示
a
a
a
对弧长
s
s
s
的一阶求导,
a
′
′
a^{”}
a
′′
表示
a
a
a
对弧长
s
s
s
的二阶求导,有:
l
˙
=
[
x
⃗
˙
−
r
⃗
˙
]
T
N
⃗
r
+
[
x
⃗
−
r
⃗
]
T
N
⃗
r
˙
\dot{l}=[\dot{\vec{x}}-\dot{\vec{r}}]^{T}\vec{N}_r+[{\vec{x}}-{\vec{r}}]^{T}\dot{\vec{N}_r}
l
˙
=
[
x
˙
−
r
˙
]
T
N
r
+
[
x
−
r
]
T
N
r
˙
根据单位切向量和单位法向量的定义(参见第二部分内容),有:
x
⃗
˙
=
d
∥
x
⃗
∥
d
t
T
⃗
x
=
v
x
T
⃗
x
(5)
\dot{\vec{x}}=\frac{d\Vert{\vec{x}}\Vert}{dt}\vec{T}_{x}=v_{x}\vec{T}_{x} \tag{5}
x
˙
=
d
t
d
∥
x
∥
T
x
=
v
x
T
x
(
5
)
r
⃗
˙
=
d
∥
r
⃗
∥
d
t
T
⃗
r
=
s
˙
T
⃗
r
(6)
\dot{\vec{r}}=\frac{d\Vert{\vec{r}}\Vert}{dt}\vec{T}_{r}=\dot{s}\vec{T}_{r} \tag{6}
r
˙
=
d
t
d
∥
r
∥
T
r
=
s
˙
T
r
(
6
)
根据平面几何知识可知:
x
⃗
−
r
⃗
=
l
N
⃗
r
(7)
\vec{x}-\vec{r} = l\vec{N}_r \tag{7}
x
−
r
=
l
N
r
(
7
)
根据链式求导法则,
N
⃗
˙
r
=
d
N
⃗
r
d
s
d
s
d
t
\dot{\vec{N}}_{r}=\frac{d\vec{N}_r}{ds} \frac{ds}{dt}
N
˙
r
=
d
s
d
N
r
d
t
d
s
,又由二维Frenet–Serret公式可知:
N
⃗
r
′
=
−
k
r
T
⃗
r
\vec{N}^{‘}_{r}=-k_r\vec{T}_r
N
r
′
=
−
k
r
T
r
,于是有:
N
⃗
˙
r
=
−
k
r
s
˙
T
⃗
r
(8)
\dot{\vec{N}}_{r}=-k_r\dot{s}\vec{T}_{r} \tag{8}
N
˙
r
=
−
k
r
s
˙
T
r
(
8
)
将(5)-(8)式代入,得:
l
˙
=
[
v
x
T
⃗
x
−
s
˙
T
⃗
r
]
T
N
⃗
r
+
l
N
⃗
r
T
(
−
k
r
s
˙
T
⃗
r
)
\dot{l}=[v_x \vec{T}_{x}-\dot{s}\vec{T}_{r}]^{T}\vec{N}_r + l\vec{N}_{r}^{T}(-k_r\dot{s}\vec{T}_r)
l
˙
=
[
v
x
T
x
−
s
˙
T
r
]
T
N
r
+
l
N
r
T
(
−
k
r
s
˙
T
r
)
因为单位切向量和法向量正交,于是有:
T
⃗
r
T
N
⃗
r
=
0
,
N
⃗
r
T
T
⃗
r
=
0
\vec{T}^{T}_{r}\vec{N}_{r}=0,\vec{N}^{T}_{r}\vec{T}_{r}=0
T
r
T
N
r
=
0
,
N
r
T
T
r
=
0
,故:
l
˙
=
v
x
T
⃗
x
T
N
⃗
r
\dot{l}=v_{x}\vec{T}^{T}_{x}\vec{N}_{r}
l
˙
=
v
x
T
x
T
N
r
将
T
⃗
x
=
[
c
o
s
θ
x
s
i
n
θ
x
]
\vec{T}_x=[cos\theta_x \space\space sin\theta_x]
T
x
=
[
cos
θ
x
s
in
θ
x
]
和
N
⃗
r
=
[
−
s
i
n
θ
r
c
o
s
θ
r
]
\vec{N}_r=[-sin\theta_r \space\space cos\theta_r]
N
r
=
[
−
s
in
θ
r
cos
θ
r
]
代入,得到:
l
˙
=
v
x
[
−
c
o
s
θ
x
s
i
n
θ
r
+
s
i
n
θ
x
c
o
s
θ
r
]
=
v
x
s
i
n
Δ
θ
(9)
\dot{l}=v_x[-cos\theta_xsin\theta_r+sin\theta_xcos\theta_r]=v_xsin\Delta\theta \tag{9}
l
˙
=
v
x
[
−
cos
θ
x
s
in
θ
r
+
s
in
θ
x
cos
θ
r
]
=
v
x
s
in
Δ
θ
(
9
)
上式中:
Δ
θ
=
θ
x
−
θ
r
(10)
\Delta\theta=\theta_x-\theta_r \tag{10}
Δ
θ
=
θ
x
−
θ
r
(
10
)
现在来计算
v
x
v_x
v
x
,根据定义:
v
x
=
d
∥
x
⃗
∥
d
t
=
∥
d
x
⃗
d
t
∥
=
∥
x
⃗
˙
∥
v_x=\frac{d\Vert\vec{x}\Vert}{dt}=\Vert\frac{d\vec{x}}{dt}\Vert=\Vert\dot{\vec{x}}\Vert
v
x
=
d
t
d
∥
x
∥
=
∥
d
t
d
x
∥
=
∥
x
˙
∥
,下面先计算
x
˙
\dot{x}
x
˙
。由(3)式,有:
x
⃗
˙
=
d
(
r
⃗
+
l
N
⃗
r
)
d
t
=
r
⃗
˙
+
l
˙
N
⃗
r
+
l
N
⃗
r
˙
\dot{\vec{x}}=\frac{d(\vec{r}+l\vec{N}_r)}{dt}=\dot{\vec{r}}+\dot{l}\vec{N}_r+l\dot{\vec{N}_r}
x
˙
=
d
t
d
(
r
+
l
N
r
)
=
r
˙
+
l
˙
N
r
+
l
N
r
˙
将(6)式和(8)式代入,得到:
x
⃗
˙
=
s
˙
(
1
−
k
r
)
l
T
⃗
r
+
l
˙
N
⃗
r
(11)
\dot{\vec{x}}=\dot{s}(1-k_r)l{\vec{T}_r}+\dot{l}\vec{N}_r \tag{11}
x
˙
=
s
˙
(
1
−
k
r
)
l
T
r
+
l
˙
N
r
(
11
)
于是有:
v
x
=
∥
x
⃗
˙
∥
=
x
⃗
˙
T
x
⃗
˙
=
[
s
˙
(
1
−
k
r
)
l
]
2
+
l
˙
2
(12)
v_x=\Vert \dot{\vec{x}} \Vert=\sqrt{\dot{\vec{x}}^{T}\dot{\vec{x}}}=\sqrt{[\dot{s}(1-k_r)l]^{2}+\dot{l}^2} \tag{12}
v
x
=
∥
x
˙
∥
=
x
˙
T
x
˙
=
[
s
˙
(
1
−
k
r
)
l
]
2
+
l
˙
2
(
12
)
下面计算
l
′
l^{‘}
l
′
:
l
′
=
d
l
d
s
=
d
l
d
t
/
d
s
d
t
=
l
˙
s
˙
l^{‘}=\frac{dl}{ds}=\frac{dl}{dt}/\frac{ds}{dt}=\frac{\dot{l}}{\dot{s}}
l
′
=
d
s
d
l
=
d
t
d
l
/
d
t
d
s
=
s
˙
l
˙
将(10)式代入,得到:
l
′
=
v
x
s
˙
sin
Δ
θ
(13)
l^{‘}=\frac{v_x}{\dot{s}}\sin\Delta\theta \tag{13}
l
′
=
s
˙
v
x
sin
Δ
θ
(
13
)
再将(12)式代入,得到:
l
′
=
(
1
−
k
r
l
)
2
+
l
′
2
sin
Δ
θ
l
′
2
=
[
(
1
−
k
r
l
)
2
+
l
′
2
]
sin
2
Δ
θ
l
′
2
(
1
−
sin
2
Δ
θ
)
=
(
1
−
k
r
l
)
2
sin
2
Δ
θ
l^{‘}=\sqrt{(1-k_rl)^2+l^{‘2}}\sin\Delta\theta \\ \space \\ l^{‘2}=[(1-k_rl)^2+l^{‘2}]\sin^2\Delta\theta \\ \space \\ l^{‘2}(1-\sin^2\Delta\theta)=(1-k_rl)^2\sin^2\Delta\theta
l
′
=
(
1
−
k
r
l
)
2
+
l
′
2
sin
Δ
θ
l
′
2
=
[(
1
−
k
r
l
)
2
+
l
′
2
]
sin
2
Δ
θ
l
′
2
(
1
−
sin
2
Δ
θ
)
=
(
1
−
k
r
l
)
2
sin
2
Δ
θ
假定车辆实际轨迹一直沿参考线附近运动(即不做与参考线反向的运动),使得:
∣
Δ
θ
∣
<
π
/
2
1
−
k
r
l
>
0
\vert \Delta\theta\vert<\pi/2 \\ \space \\ 1-k_rl>0 \\
∣Δ
θ
∣
<
π
/2
1
−
k
r
l
>
0
则求解上述关于
l
′
l^{‘}
l
′
的方程得到:
l
′
=
(
1
−
k
r
l
)
tan
Δ
θ
(14)
l^{‘}=(1-k_rl)\tan\Delta\theta \tag{14}
l
′
=
(
1
−
k
r
l
)
tan
Δ
θ
(
14
)
将(14)式代入(13)式,可得到速度
v
x
v_x
v
x
的表达式:
(
1
−
k
r
l
)
t
a
n
Δ
θ
=
v
x
s
˙
sin
Δ
θ
v
x
=
s
˙
1
−
k
r
l
cos
Δ
θ
(15)
(1-k_rl)tan\Delta\theta=\frac{v_x}{\dot{s}}\sin\Delta\theta \\ \space \\ v_x=\dot{s}\frac{1-k_rl}{\cos\Delta\theta} \tag{15}
(
1
−
k
r
l
)
t
an
Δ
θ
=
s
˙
v
x
sin
Δ
θ
v
x
=
s
˙
cos
Δ
θ
1
−
k
r
l
(
15
)
令
s
x
s_x
s
x
为车辆当前轨迹
x
⃗
\vec{x}
x
的弧长,则有:
d
d
s
=
d
d
s
x
d
s
x
d
s
=
d
d
s
x
d
s
x
d
t
d
t
d
s
=
v
x
s
˙
d
d
s
x
\frac{d}{ds}=\frac{d}{ds_x}\frac{ds_x}{ds}=\frac{d}{ds_x}\frac{ds_x}{dt}\frac{dt}{ds}=\frac{v_x}{\dot{s}}\frac{d}{ds_x}
d
s
d
=
d
s
x
d
d
s
d
s
x
=
d
s
x
d
d
t
d
s
x
d
s
d
t
=
s
˙
v
x
d
s
x
d
将(15)式代入,得到:
d
d
s
=
1
−
k
r
l
cos
Δ
θ
d
d
s
x
(16)
\frac{d}{ds}=\frac{1-k_rl}{\cos\Delta\theta}\frac{d}{ds_x} \tag{16}
d
s
d
=
cos
Δ
θ
1
−
k
r
l
d
s
x
d
(
16
)
对(14)式求关于参考线弧长
s
s
s
的偏导:
l
′
′
=
(
1
−
k
r
l
)
′
tan
Δ
θ
+
(
1
−
k
r
l
)
(
Δ
θ
)
′
cos
2
Δ
θ
(17)
l^{”}=(1-k_rl)^{‘}\tan\Delta\theta+\frac{(1-k_rl)(\Delta\theta)^{‘}}{\cos^2\Delta\theta} \tag{17}
l
′′
=
(
1
−
k
r
l
)
′
tan
Δ
θ
+
cos
2
Δ
θ
(
1
−
k
r
l
)
(
Δ
θ
)
′
(
17
)
注意到:
Δ
θ
=
θ
x
−
θ
r
\Delta\theta = \theta_x-\theta_r
Δ
θ
=
θ
x
−
θ
r
,于是有:
(
Δ
θ
)
′
=
d
d
s
θ
x
−
θ
r
′
(\Delta\theta)^{‘}=\frac{d}{ds}\theta_x-\theta^{‘}_{r}
(
Δ
θ
)
′
=
d
s
d
θ
x
−
θ
r
′
根据曲率的定义:
k
r
=
θ
r
′
=
d
θ
r
d
s
k_r=\theta^{‘}_{r}=\frac{d\theta_r}{ds}
k
r
=
θ
r
′
=
d
s
d
θ
r
,
k
x
=
d
θ
x
d
s
x
k_x=\frac{d\theta_x}{ds_x}
k
x
=
d
s
x
d
θ
x
并将(16)式代入,得到:
(
Δ
θ
)
′
=
1
−
k
r
l
cos
Δ
θ
d
d
s
θ
x
−
θ
r
′
(
Δ
θ
)
′
=
k
x
1
−
k
r
l
cos
Δ
θ
−
k
r
(18)
(\Delta\theta)^{‘}=\frac{1-k_rl}{\cos\Delta\theta}\frac{d}{ds}\theta_x-\theta^{‘}_{r} \\ \space \\ (\Delta\theta)^{‘}=k_x\frac{1-k_rl}{\cos\Delta\theta}-k_r \tag{18}
(
Δ
θ
)
′
=
cos
Δ
θ
1
−
k
r
l
d
s
d
θ
x
−
θ
r
′
(
Δ
θ
)
′
=
k
x
cos
Δ
θ
1
−
k
r
l
−
k
r
(
18
)
将(18)式代入(17)式,得:
l
′
′
=
−
(
k
r
′
l
+
k
r
l
′
)
tan
Δ
θ
+
(
1
−
k
r
l
)
cos
2
Δ
θ
[
k
x
1
−
k
r
l
cos
Δ
θ
−
k
r
]
(19)
l^{”}=-(k^{‘}_{r}l+k_{r}l^{‘})\tan\Delta\theta+\frac{(1-k_rl)}{\cos^2\Delta\theta}[k_x\frac{1-k_rl}{\cos\Delta\theta}-k_r] \tag{19}
l
′′
=
−
(
k
r
′
l
+
k
r
l
′
)
tan
Δ
θ
+
cos
2
Δ
θ
(
1
−
k
r
l
)
[
k
x
cos
Δ
θ
1
−
k
r
l
−
k
r
]
(
19
)
最后求解
a
x
=
v
x
˙
=
v
x
d
t
a_x=\dot{v_x}=\frac{v_x}{dt}
a
x
=
v
x
˙
=
d
t
v
x
。对(15)式求关于时间
t
t
t
的导数,得:
a
x
=
s
¨
1
−
k
r
l
cos
Δ
θ
+
s
˙
d
d
s
1
−
k
r
l
cos
Δ
θ
s
˙
a
x
=
s
¨
1
−
k
r
l
cos
Δ
θ
+
s
˙
2
cos
Δ
θ
[
(
1
−
k
r
l
)
tan
Δ
θ
(
Δ
θ
)
′
−
(
k
r
′
l
+
k
r
l
′
)
]
(20)
a_x=\ddot{s}\frac{1-k_rl}{\cos\Delta\theta}+\dot{s}\frac{d}{ds}\frac{1-k_rl}{\cos\Delta\theta}\dot{s} \\ \space \\ a_x=\ddot{s}\frac{1-k_rl}{\cos\Delta\theta}+\frac{\dot{s}^{2}}{\cos\Delta\theta}[(1-k_rl)\tan\Delta\theta(\Delta\theta)^{‘}-(k^{‘}_{r}l+k_{r}l^{‘})] \tag{20}
a
x
=
s
¨
cos
Δ
θ
1
−
k
r
l
+
s
˙
d
s
d
cos
Δ
θ
1
−
k
r
l
s
˙
a
x
=
s
¨
cos
Δ
θ
1
−
k
r
l
+
cos
Δ
θ
s
˙
2
[(
1
−
k
r
l
)
tan
Δ
θ
(
Δ
θ
)
′
−
(
k
r
′
l
+
k
r
l
′
)]
(
20
)
将(18)式代入(20)式,得:
a
x
=
s
¨
1
−
k
r
l
cos
Δ
θ
+
s
˙
2
cos
Δ
θ
[
(
1
−
k
r
l
)
tan
Δ
θ
(
k
x
1
−
k
r
l
cos
Δ
θ
−
k
r
)
−
(
k
r
′
l
+
k
r
l
′
)
]
(21)
a_x=\ddot{s}\frac{1-k_rl}{\cos\Delta\theta}+\frac{\dot{s}^{2}}{\cos\Delta\theta}[(1-k_rl)\tan\Delta\theta(k_x\frac{1-k_rl}{\cos\Delta\theta}-k_r)-(k^{‘}_{r}l+k_{r}l^{‘})] \tag{21}
a
x
=
s
¨
cos
Δ
θ
1
−
k
r
l
+
cos
Δ
θ
s
˙
2
[(
1
−
k
r
l
)
tan
Δ
θ
(
k
x
cos
Δ
θ
1
−
k
r
l
−
k
r
)
−
(
k
r
′
l
+
k
r
l
′
)]
(
21
)
(4.a)、(14)、(15)、(19)、(21)式便是我们要求的坐标转换公式,经过一些变换后有,
从笛卡尔坐标系到Frenet坐标系:
l
=
±
(
x
−
x
r
)
2
+
(
y
−
y
r
)
2
[
(
y
−
y
r
)
c
o
s
θ
r
−
(
x
−
x
r
)
s
i
n
θ
r
]
>
0
?
p
o
s
i
t
i
v
e
:
n
e
g
t
i
v
e
l=\pm \sqrt{(x-x_r)^2+(y-y_r)^2} \\ \space \\ [(y-y_r)cos\theta_r-(x-x_r)sin\theta_r] > 0 \space ? \space positive \space : \space negtive
l
=
±
(
x
−
x
r
)
2
+
(
y
−
y
r
)
2
[(
y
−
y
r
)
cos
θ
r
−
(
x
−
x
r
)
s
in
θ
r
]
>
0
?
p
os
i
t
i
v
e
:
n
e
g
t
i
v
e
l
′
=
(
1
−
k
r
l
)
tan
Δ
θ
l^{‘}=(1-k_rl)\tan\Delta\theta
l
′
=
(
1
−
k
r
l
)
tan
Δ
θ
l
′
′
=
−
(
k
r
′
l
+
k
r
l
′
)
tan
Δ
θ
+
(
1
−
k
r
l
)
cos
2
Δ
θ
(
k
x
1
−
k
r
l
cos
Δ
θ
−
k
r
)
l^{”}=-(k^{‘}_{r}l+k_{r}l^{‘})\tan\Delta\theta+\frac{(1-k_rl)}{\cos^2\Delta\theta}(k_x\frac{1-k_rl}{\cos\Delta\theta}-k_r)
l
′′
=
−
(
k
r
′
l
+
k
r
l
′
)
tan
Δ
θ
+
cos
2
Δ
θ
(
1
−
k
r
l
)
(
k
x
cos
Δ
θ
1
−
k
r
l
−
k
r
)
s
˙
=
v
x
cos
Δ
θ
1
−
k
r
l
\dot{s}=\frac{v_{x}\cos\Delta\theta}{1-k_rl}
s
˙
=
1
−
k
r
l
v
x
cos
Δ
θ
s
¨
=
[
a
x
cos
Δ
θ
−
s
˙
2
(
(
1
−
k
r
l
)
tan
Δ
θ
(
k
x
1
−
k
r
l
cos
Δ
θ
−
k
r
)
−
(
k
r
′
l
+
k
r
l
′
)
)
]
/
(
1
−
k
r
l
)
\ddot{s} = [a_{x}\cos\Delta\theta-\dot{s}^{2}((1-k_rl)\tan\Delta\theta(k_x\frac{1-k_rl}{\cos\Delta\theta}-k_r)-(k^{‘}_{r}l+k_{r}l^{‘}))]/(1-k_{r}l)
s
¨
=
[
a
x
cos
Δ
θ
−
s
˙
2
((
1
−
k
r
l
)
tan
Δ
θ
(
k
x
cos
Δ
θ
1
−
k
r
l
−
k
r
)
−
(
k
r
′
l
+
k
r
l
′
))]
/
(
1
−
k
r
l
)
从Frenet到笛卡尔坐标系:
首先,参考线上
s
s
s
点的对应笛卡尔坐标系的各个参数为
x
r
,
y
r
,
θ
r
,
k
r
,
d
k
r
x_r,y_r,\theta_r,k_r,dk_r
x
r
,
y
r
,
θ
r
,
k
r
,
d
k
r
,由于车辆参考点与参考轨迹上的点的连线垂直于切线方向,所以有,
x
=
x
r
−
l
sin
θ
r
y
=
y
r
+
l
cos
θ
r
x=x_r-l\sin{\theta_r} \\ y=y_r+l\cos{\theta_r}
x
=
x
r
−
l
sin
θ
r
y
=
y
r
+
l
cos
θ
r
由式(14)可知,有
θ
x
=
arctan
l
′
1
−
k
r
l
+
θ
r
\theta_x=\arctan \frac{l^{‘}}{1-k_{r}l}+\theta_{r}
θ
x
=
arctan
1
−
k
r
l
l
′
+
θ
r
由式(19)可知,有
k
x
=
[
l
′
′
+
(
k
r
′
l
+
k
r
l
′
)
tan
Δ
θ
cos
2
Δ
θ
(
1
−
k
r
l
)
+
k
r
]
cos
Δ
θ
1
−
k
r
l
Δ
θ
=
θ
x
−
θ
r
k_x=[l^{”}+(k^{‘}_{r}l+k_{r}l^{‘})\tan\Delta\theta\frac{\cos^2\Delta\theta}{(1-k_rl)}+k_{r}]\frac{\cos\Delta\theta}{1-k_rl} \\ \Delta\theta=\theta_x-\theta_r
k
x
=
[
l
′′
+
(
k
r
′
l
+
k
r
l
′
)
tan
Δ
θ
(
1
−
k
r
l
)
cos
2
Δ
θ
+
k
r
]
1
−
k
r
l
cos
Δ
θ
Δ
θ
=
θ
x
−
θ
r
v
x
=
s
˙
1
−
k
r
l
cos
Δ
θ
=
[
s
˙
(
1
−
k
r
)
l
]
2
+
l
˙
2
=
[
s
˙
(
1
−
k
r
)
l
]
2
+
l
′
2
s
˙
2
v_x=\dot{s}\frac{1-k_rl}{\cos\Delta\theta}=\sqrt{[\dot{s}(1-k_r)l]^{2}+\dot{l}^2} = \sqrt{[\dot{s}(1-k_r)l]^{2}+l^{‘2}\dot{s}^2}
v
x
=
s
˙
cos
Δ
θ
1
−
k
r
l
=
[
s
˙
(
1
−
k
r
)
l
]
2
+
l
˙
2
=
[
s
˙
(
1
−
k
r
)
l
]
2
+
l
′
2
s
˙
2
a
x
=
s
¨
1
−
k
r
l
cos
Δ
θ
+
s
˙
2
cos
Δ
θ
[
(
1
−
k
r
l
)
tan
Δ
θ
(
k
x
1
−
k
r
l
cos
Δ
θ
−
k
r
)
−
(
k
r
′
l
+
k
r
l
′
)
]
a_x=\ddot{s}\frac{1-k_rl}{\cos\Delta\theta}+\frac{\dot{s}^{2}}{\cos\Delta\theta}[(1-k_rl)\tan\Delta\theta(k_x\frac{1-k_rl}{\cos\Delta\theta}-k_r)-(k^{‘}_{r}l+k_{r}l^{‘})]
a
x
=
s
¨
cos
Δ
θ
1
−
k
r
l
+
cos
Δ
θ
s
˙
2
[(
1
−
k
r
l
)
tan
Δ
θ
(
k
x
cos
Δ
θ
1
−
k
r
l
−
k
r
)
−
(
k
r
′
l
+
k
r
l
′
)]
以上就是Frenet坐标系下的
s
,
s
˙
,
s
¨
,
l
,
l
′
,
l
′
′
s,\dot{s},\ddot{s},l,l^{‘},l^{”}
s
,
s
˙
,
s
¨
,
l
,
l
′
,
l
′′
转换到笛卡尔坐标系下的
x
,
y
,
θ
x
,
k
x
,
v
x
,
a
x
x,y,\theta_{x},k_{x},v_{x},a_{x}
x
,
y
,
θ
x
,
k
x
,
v
x
,
a
x
的公式。
四、Apollo项目中Frenet坐标系与笛卡尔坐标系转换代码
函数声明文件planning/math/frame_conversion/cartesian_frenet_conversion.h:
#ifndef MODULES_PLANNING_MATH_FRAME_CONVERSION_CARTESIAN_FRENET_CONVERSION_H_
#define MODULES_PLANNING_MATH_FRAME_CONVERSION_CARTESIAN_FRENET_CONVERSION_H_
#include <array>
#include "modules/common/math/vec2d.h"
namespace apollo {
namespace planning {
// Notations:
// s_condition = [s, s_dot, s_ddot]
// s: longitudinal coordinate w.r.t reference line.
// s_dot: ds / dt
// s_ddot: d(s_dot) / dt
// d_condition = [d, d_prime, d_pprime]
// d: lateral coordinate w.r.t. reference line
// d_prime: dd / ds
// d_pprime: d(d_prime) / ds
// l: the same as d.
class CartesianFrenetConverter {
public:
CartesianFrenetConverter() = delete;
/**
* Convert a vehicle state in Cartesian frame to Frenet frame.
* Decouple a 2d movement to two independent 1d movement w.r.t. reference
* line.
* The lateral movement is a function of longitudinal accumulated distance s
* to achieve better satisfaction of nonholonomic constraints.
*/
static void cartesian_to_frenet(const double rs, const double rx,
const double ry, const double rtheta,
const double rkappa, const double rdkappa,
const double x, const double y,
const double v, const double a,
const double theta, const double kappa,
std::array<double, 3>* const ptr_s_condition,
std::array<double, 3>* const ptr_d_condition);
/**
* Convert a vehicle state in Frenet frame to Cartesian frame.
* Combine two independent 1d movement w.r.t. reference line to a 2d movement.
*/
static void frenet_to_cartesian(const double rs, const double rx,
const double ry, const double rtheta,
const double rkappa, const double rdkappa,
const std::array<double, 3>& s_condition,
const std::array<double, 3>& d_condition,
double* const ptr_x, double* const ptr_y,
double* const ptr_theta,
double* const ptr_kappa, double* const ptr_v,
double* const ptr_a);
// given sl point extract x, y, theta, kappa
static double CalculateTheta(const double rtheta, const double rkappa,
const double l, const double dl);
static double CalculateKappa(const double rkappa, const double rdkappa,
const double l, const double dl, const double ddl);
static common::math::Vec2d CalculateCartesianPoint(
const double rtheta, const common::math::Vec2d& rpoint, const double l);
/**
* @brief: given sl, theta, and road's theta, kappa, extract derivative l,
*second order derivative l:
*/
static double CalculateLateralDerivative(const double theta_ref,
const double theta, const double l, const double kappa_ref);
// given sl, theta, and road's theta, kappa, extract second order derivative
static double CalculateSecondOrderLateralDerivative(
const double theta_ref, const double theta, const double kappa_ref,
const double kappa, const double dkappa_ref, const double l);
};
} // namespace planning
} // namespace apollo
函数实现文件planning/math/frame_conversion/cartesian_frenet_conversion.cc:
#include "modules/planning/math/frame_conversion/cartesian_frenet_conversion.h"
#include <cmath>
#include "modules/common/log.h"
#include "modules/common/math/math_utils.h"
namespace apollo {
namespace planning {
using apollo::common::math::Vec2d;
void CartesianFrenetConverter::cartesian_to_frenet(
const double rs, const double rx, const double ry, const double rtheta,
const double rkappa, const double rdkappa, const double x, const double y,
const double v, const double a, const double theta, const double kappa,
std::array<double, 3>* const ptr_s_condition,
std::array<double, 3>* const ptr_d_condition) {
const double dx = x - rx;
const double dy = y - ry;
const double cos_theta_r = std::cos(rtheta);
const double sin_theta_r = std::sin(rtheta);
const double cross_rd_nd = cos_theta_r * dy - sin_theta_r * dx;
// 求解d
ptr_d_condition->at(0) =
std::copysign(std::sqrt(dx * dx + dy * dy), cross_rd_nd);
const double delta_theta = theta - rtheta;
const double tan_delta_theta = std::tan(delta_theta);
const double cos_delta_theta = std::cos(delta_theta);
const double one_minus_kappa_r_d = 1 - rkappa * ptr_d_condition->at(0);
// 求解d' = dd / ds
ptr_d_condition->at(1) = one_minus_kappa_r_d * tan_delta_theta;
const double kappa_r_d_prime =
rdkappa * ptr_d_condition->at(0) + rkappa * ptr_d_condition->at(1);
// 求解d'' = dd' / ds
ptr_d_condition->at(2) =
-kappa_r_d_prime * tan_delta_theta +
one_minus_kappa_r_d / cos_delta_theta / cos_delta_theta *
(kappa * one_minus_kappa_r_d / cos_delta_theta - rkappa);
// 求解s
ptr_s_condition->at(0) = rs;
// 求解ds / dt
ptr_s_condition->at(1) = v * cos_delta_theta / one_minus_kappa_r_d;
const double delta_theta_prime =
one_minus_kappa_r_d / cos_delta_theta * kappa - rkappa;
// 求解d(ds) / dt
ptr_s_condition->at(2) =
(a * cos_delta_theta -
ptr_s_condition->at(1) * ptr_s_condition->at(1) *
(ptr_d_condition->at(1) * delta_theta_prime - kappa_r_d_prime))
/ one_minus_kappa_r_d;
return;
}
void CartesianFrenetConverter::frenet_to_cartesian(
const double rs, const double rx, const double ry, const double rtheta,
const double rkappa, const double rdkappa,
const std::array<double, 3>& s_condition,
const std::array<double, 3>& d_condition, double* const ptr_x,
double* const ptr_y, double* const ptr_theta, double* const ptr_kappa,
double* const ptr_v, double* const ptr_a) {
CHECK(std::abs(rs - s_condition[0]) < 1.0e-6)
<< "The reference point s and s_condition[0] don't match";
const double cos_theta_r = std::cos(rtheta);
const double sin_theta_r = std::sin(rtheta);
*ptr_x = rx - sin_theta_r * d_condition[0];
*ptr_y = ry + cos_theta_r * d_condition[0];
const double one_minus_kappa_r_d = 1 - rkappa * d_condition[0];
const double tan_delta_theta = d_condition[1] / one_minus_kappa_r_d;
const double delta_theta = std::atan2(d_condition[1], one_minus_kappa_r_d);
const double cos_delta_theta = std::cos(delta_theta);
*ptr_theta = common::math::NormalizeAngle(delta_theta + rtheta);
const double kappa_r_d_prime =
rdkappa * d_condition[0] + rkappa * d_condition[1];
*ptr_kappa = (((d_condition[2] + kappa_r_d_prime * tan_delta_theta) *
cos_delta_theta * cos_delta_theta) /
(one_minus_kappa_r_d) +
rkappa) *
cos_delta_theta / (one_minus_kappa_r_d);
const double d_dot = d_condition[1] * s_condition[1];
*ptr_v = std::sqrt(one_minus_kappa_r_d * one_minus_kappa_r_d *
s_condition[1] * s_condition[1] +
d_dot * d_dot);
const double delta_theta_prime =
one_minus_kappa_r_d / cos_delta_theta * (*ptr_kappa) - rkappa;
*ptr_a = s_condition[2] * one_minus_kappa_r_d / cos_delta_theta +
s_condition[1] * s_condition[1] / cos_delta_theta *
(d_condition[1] * delta_theta_prime - kappa_r_d_prime);
}
double CartesianFrenetConverter::CalculateTheta(const double rtheta,
const double rkappa,
const double l,
const double dl) {
return common::math::NormalizeAngle(rtheta + std::atan2(dl, 1 - l * rkappa));
}
double CartesianFrenetConverter::CalculateKappa(const double rkappa,
const double rdkappa,
const double l, const double dl,
const double ddl) {
double denominator = (dl * dl + (1 - l * rkappa) * (1 - l * rkappa));
if (std::fabs(denominator) < 1e-8) {
return 0.0;
}
denominator = std::pow(denominator, 1.5);
const double numerator = rkappa + ddl - 2 * l * rkappa * rkappa -
l * ddl * rkappa + l * l * rkappa * rkappa * rkappa +
l * dl * rdkappa + 2 * dl * dl * rkappa;
return numerator / denominator;
}
Vec2d CartesianFrenetConverter::CalculateCartesianPoint(const double rtheta,
const Vec2d& rpoint,
const double l) {
const double x = rpoint.x() - l * std::sin(rtheta);
const double y = rpoint.y() + l * std::cos(rtheta);
return Vec2d(x, y);
}
double CartesianFrenetConverter::CalculateLateralDerivative(
const double rtheta, const double theta, const double l,
const double rkappa) {
return (1 - rkappa * l) * std::tan(theta - rtheta);
}
double CartesianFrenetConverter::CalculateSecondOrderLateralDerivative(
const double rtheta, const double theta, const double rkappa,
const double kappa, const double rdkappa, const double l) {
const double dl = CalculateLateralDerivative(rtheta, theta, l, rkappa);
const double theta_diff = theta - rtheta;
const double cos_theta_diff = std::cos(theta_diff);
const double res = -(rdkappa * l + rkappa * dl) * std::tan(theta - rtheta) +
(1 - rkappa * l) / (cos_theta_diff * cos_theta_diff) *
(kappa * (1 - rkappa * l) / cos_theta_diff - rkappa);
if (std::isinf(res)) {
AWARN << "result is inf when calculate second order lateral "
"derivative. input values are rtheta:"
<< rtheta << " theta: " << theta << ", rkappa: " << rkappa
<< ", kappa: " << kappa << ", rdkappa: " << rdkappa << ", l: " << l
<< std::endl;
}
return res;
}
参考资料:
- https://github.com/ApolloAuto/apollo/blob/master/docs/specs/coordination.pdf
- https://en.wikipedia.org/wiki/Frenet–Serret_formulas
- Optimal trajectory generation for dynamic street scenarios in a Frenét Frame, http://ieeexplore.ieee.org/document/5509799/citations?tabFilter=papers
- https://zhuanlan.zhihu.com/p/29836354
- https://zhuanlan.zhihu.com/p/304474902
- https://blog.csdn.net/u013468614/article/details/108748016