目录 Catalog
前段时间在看OpenDRIVE文档,做相关的建模。现整理一下参考线(Reference Line)的采样方式,考虑采样出来的每个点都记录一些辅助信息。
前言 Foreword
本文根据OpenDRIVE 1.6 第6章Coordinate Systems以及第7章Geometry编写。
坐标系 Coordinate Systems
关于坐标系,OpenDRIVE 1.6版本并没有改动,很多讲OpenDRIVE的文章也讲得很详细,这里不细讲。
OpenDRIVE的坐标系分为惯性系(xyz)、参考线系(sth)、局部系(uvz),均为右手系,如Figure 5。
Figure 5. available coordinate systems in OpenDRIVE
坐标系的关系可由Figure 6反映。局部系的原点一般为上下文中参考线系的原点,即局部系 u = 0 , v = 0 u=0,v=0 u=0,v=0处,参考线系 s = 0 , t = 0 s=0,t=0 s=0,t=0。
Figure 6. Coordinate systems in OpenDRIVE interacting with another
坐标系的旋转如Figure 7, Figure 10所示。
Figure 7. Inertial coordinate system with defined rotations
Figure 10. Reference line system with defined rotations
从Figure 9可以看出,道路上每个位置的参考线坐标系的 s s s方向沿着参考线切线方向,所以参考系的坐标基可能处处不相等。
Figure 9. Reference line coordinate system
参考线坐标系在OpenDRIVE至关重要,大部分几何属性都是以参考线坐标系为基础定义的。
参考线几何描述 Geometry
OpenDRIVE使用的参考线类型如Figure 19所示(三次曲线cubic polynomials在1.6版本已经弃用)。
Figure 19. Geometry elements in OpenDRIVE
几何体的数据结构如Figure 21所示。
Figure 21. UML model Road Geometry including the Reference Line elements
采样时,我们希望记录每个点的惯性系xyz坐标、参考线系sth坐标(在进行后续Elevation, Superelevation, Shape等变换之前,总有 t = 0 , h = 0 t=0, h=0 t=0,h=0)、参考线系的坐标基在惯性系中的表示。即: V ( s ) = { p ⃗ = ( x , y , z ) , q ⃗ = ( s , t , h ) , e s ⃗ , e t ⃗ , e h ⃗ , κ } . \mathbf{V}(s)=\{\vec{p}=(x,y,z),\vec{q}=(s,t,h),\vec{e_s},\vec{e_t},\vec{e_h},\kappa\}. V(s)={ p=(x,y,z),q=(s,t,h),es,et,eh,κ}.
直线 Line
Figure 22. A straight line
<planView>
<geometry
s="0.0000000000000000e+00"
x="-4.7170752711170401e+01"
y="7.2847983820912710e-01"
hdg="6.5477882613167993e-01"
length="5.7280000000000000e+01">
<line/>
</geometry>
</planView>
参考线坐标系 e s ⃗ , e t ⃗ , e h ⃗ \vec{e_s}, \vec{e_t}, \vec{e_h} es,et,eh
参考线坐标基可以通过 h d g hdg hdg属性求出:
e s ⃗ = R h d g ∗ e x ⃗ , \vec{e_s}=R_{hdg}*\vec{e_x}, es=Rhdg∗ex, e t ⃗ = R h d g ∗ e y ⃗ , \vec{e_t}=R_{hdg}*\vec{e_y}, et=Rhdg∗ey, e h ⃗ = e z ⃗ , \vec{e_h}=\vec{e_z}, eh=ez,其中 R h d g = [ c o s ( h d g ) − s i n ( h d g ) 0 s i n ( h d g ) c o s ( h d g ) 0 0 0 1 ] . R_{hdg}=\begin{bmatrix} cos(hdg) & -sin(hdg) & 0 \\ sin(hdg) & cos(hdg) & 0 \\ 0 & 0 & 1 \end{bmatrix}. Rhdg=⎣⎡cos(hdg)sin(hdg)0−sin(hdg)cos(hdg)0001⎦⎤.
曲率 κ \kappa κ
由于直线上处处有曲率 κ = 0 \kappa=0 κ=0,所以参考线坐标系处处相同。
位置 p ⃗ \vec{p} p
对于每个 s s s对应的采样点,下一个采样点 s + Δ s s+\Delta s s+Δs的位置可以通过下式求得:
p ⃗ ( s + Δ s ) = p ⃗ ( s ) + Δ s ∗ e s ⃗ \vec{p}(s+\Delta s)=\vec{p}(s)+\Delta s*\vec{e_s} p(s+Δs)=p(s)+Δs∗es
欧拉螺旋线 & 弧线 Sipral & Arc
此处两种几何线统一处理。
弧线是曲率为定值的曲线,即圆形的一段。
欧拉螺旋线是曲率随长度线性变化的曲线,的主要作用是消除直线与弧线之间的曲率突变。所以,欧拉螺旋线一般会与其他两种曲线相连。
欧拉螺旋线与弧线的曲率都可以取负值。取正表示曲线以逆时针方向绘制,取负表示曲线以顺时针方向绘制。
Figure 23. Road geometry described by a spiral
<geometry s="100.0" x="38.00" y="-1.81" hdg="0.33" length="30.00">
<spiral curvStart="0.0" curvEnd="0.013"/>
</geometry>
Figure 24. Road geometry described by an arc
<planView>
<geometry
s="3.6612031746270386e+00"
x="-4.6416930098385274e+00"
y="4.3409250448366459e+00"
hdg="5.2962250374496271e+00"
length="9.1954178989066371e+00">
<arc curvature="-1.2698412698412698e-01"/>
</geometry>
</planView>
Figure 25. Creating a reference line from geometry elements