open_simulation_interface
master (560d23a)
|
A reference line for defining a non-Euclidean ST coordinate system. More...
Classes | |
struct | ReferenceLinePoint |
A point on the reference line. More... | |
Public Types | |
enum | Type { TYPE_POLYLINE = 0 , TYPE_POLYLINE_WITH_T_AXIS = 1 } |
ReferenceLine types. More... | |
Public Attributes | |
optional Identifier | id = 1 |
The ID of the reference line. More... | |
optional Type | type = 3 |
The type of the reference line. More... | |
repeated ReferenceLinePoint | poly_line = 2 |
Points comprising the polyline. More... | |
A reference line for defining a non-Euclidean ST coordinate system.
A reference line is a 3D polyline, used for generating a non-Euclidean ST coordinate system.
Notes on design decisions:
ReferenceLine types.
ReferenceLinePoints might be interpreted differently depending on the type of the ReferenceLine.
See also: "Adding T coordinates"
Enumerator | |
---|---|
TYPE_POLYLINE | ReferenceLine is a polyline, where the coordinates of points are calculated by projection onto the nearest point on the line.
|
TYPE_POLYLINE_WITH_T_AXIS | ReferenceLine is a polyline, where the coordinates of points are calculated using the T axis definition.
|
optional Identifier osi3::ReferenceLine::id = 1 |
The ID of the reference line.
optional Type osi3::ReferenceLine::type = 3 |
The type of the reference line.
repeated ReferenceLinePoint osi3::ReferenceLine::poly_line = 2 |
Points comprising the polyline.
At least two points must be given. The polyline is defined as the lines between consecutive points. Each point has an S coordinate. Other attributes might be set, depending on the type of the polyline (see Type).
There are a few requirements on the S position:
Together, these rules allow directly putting OpenDRIVE S coordinates into an OSI ReferenceLine.
If the reference line approximates a curve (e.g. a clothoid in OpenDRIVE), the points must be chosen in a way that the lateral distance to the ideal line does not exceed 5cm. As shown in the following image:
Approximation error green line.
Between two ReferenceLinePoints, both the world coordinate and the S coordinate is interpolated linearly. So each S value uniquely describes a point on the polyline.
For the purpose of this discussion, let's call the S position of the first point sStart
, and the S position of the last point sEnd
.
For some purposes, S positions outside the normally defined range (i.e. outside [sStart
,sEnd
]) need to be defined. For this purpose, the first line of the polyline is infinitely extended in negative S direction. Similarly, the last line of the polyline is infinitely extended beyond the last point. The S value of points outside [sStart
,sEnd
] is defined by the Euclidean 2D distance from the start or end point, respectively. So if sStart = 15
, and a point is on the line extended from the start position, with a 2D Euclidean distance of 10 from the first point, then it has an S position of 5.
A point is "before" the reference line, if its s coordinate is < sStart
. A point is "after" the reference line, if its s coordinate is > sEnd
.
To describe points that are not directly on the polyline, a T coordinate is added. T is the signed 2D distance between the point to describe (P) and a projected point (P_proj) on the polyline. There are two ways of defining this point, depending on the ReferenceLine::Type (see below).
The T coordinate of the point in question is then defined as hypot(P.X-P_proj.X,P.Y-P_proj.Y)
. The projected point P_proj might either be on a line segment or at an edge between two line segments. The distance is positive if the point is left of the polyline (in definition direction), negative if it is right of it. The S position of such a point outside the reference line is the same as the S value of the projected point on the polyline.
The projection point is the nearest point on the polyline (this point might either be on a line segment or at an edge between two line segments).
Notes:
Example:
This shows a reference line (consisting of three points), and five points not on the reference line.
P1
, the situation is clear, since there is exactly one nearest point on the polyline. The resulting ST coordinate uniquely maps back to P1
.P2
has multiple points "nearest points" on the polyline. As can be seen here, two ST coordinates map to P2
(red and gray dotted line). Following the rules above, the one with the smallest S value is chosen (the red dotted line).P3
has a unique "nearest point" on the polyline. However, multiple points map to the same ST coordinate as that of P3
, e.g. P4
(drawn in gray).P5
shows how the reference line is extended infinitely for points that are "outside" the reference line.The T axes of the two ReferenceLinePoints of each ReferenceLine segment define a sector (or strip if parallel) of the plane. A point is associated with the segment if it lies within this sector. For points being associated with multiple segments, the actual segment to consider is determined by the shortest 3D Euclidean distance between the point and the segments in question.
The T axis (projecting axis) is the line going through P and the intersection point (I). I is defined as the intersection of both T axes of two consecutive ReferenceLinePoints (see example and image below for illustration).
Special cases:
For the T axis at a specific ReferenceLinePoint the following rules apply:
Example:
This shows a reference line (consisting of three points R0
, R1
and R2
) and two points (P1
and P2
) not part of the reference line.
Calculation of ST for P1:
I
of the T axes of R0
and R1
.P1
lies in the sector defined by these T axes it is considered part of the reference line section between R0
and R1
.P1
is projected onto the line segment [R0
, R1
] via the straight line through I
(by calculating the intersection of the line segment and the projection axis), resulting in point P1_proj
. If the T axes are parallel, projection is applied in the direction of these axes.P1
is the S coordinate of P1_proj
P1
is the signed Euclidean distance to P1_proj
.Calculation of P2
follows the same pattern.
Sometimes an angle to a reference line is needed. This shall be defined as follows: First the projected point on the polyline is determined, as described below. If this point is on a line segment, then the angle is calculated relative to the line segment on which the reference point lays. If the projected point is at the edge between line segments, then the angle of the following line shall be chosen.
The above rules define an ST coordinate system across the whole XY plane. Every XY position has an ST coordinate, but not necessarily a unique ST coordinate.
The sampling of the polyline must be chosen such that the error when converting coordinates is "small enough". The exact needed precision is defined for each user, where the reference line is referenced.
When OSI is generated from OpenDRIVE, typically the reference lines will be taken directly from the road reference lines in OpenDRIVE, and sampled according to the accuracy requirements outlined above.
Other map formats may not have reference lines, so they will have to be synthesized by the tool generating OSI data. A few guidelines on this process:
Notes on OpenDRIVE compatibility: Ideally, one would want the polyline to be fully compatible with OpenDRIVE, so that calculations done for OpenDRIVE directly match those in OSI. There are a few difficulties with this:
t_OSI = t_OpenDRIVE * cos(alpha)
, where alpha is the superelevation angle.Notes on design decisions: