pub struct Lane<'a> { /* private fields */ }
Expand description
A Lane represents a lane of travel in a road network. A Lane defines a curvilinear coordinate system covering the road surface, with a longitudinal ‘s’ coordinate that expresses the arc-length along a central reference curve. The reference curve nominally represents an ideal travel trajectory along the Lane.
Lanes are grouped by Segment. All Lanes belonging to a Segment represent the same road surface, but with different coordinate parameterizations (e.g., each Lane has its own reference curve).
Implementations§
Source§impl<'a> Lane<'a>
impl<'a> Lane<'a>
Sourcepub fn id(&self) -> String
pub fn id(&self) -> String
Returns the id of the Lane.
The id is a unique identifier for the Lane within the RoadGeometry.
§Returns
A String
containing the id of the Lane.
Sourcepub fn to_left(&self) -> Option<Lane<'_>>
pub fn to_left(&self) -> Option<Lane<'_>>
Returns the adjacent lane to the left, if one exists.
“Left” is defined as the direction of +r
in the (s, r, h)
lane-coordinate frame.
§Returns
An Option<Lane>
containing the left lane, or None
if this is the
leftmost lane.
Sourcepub fn to_right(&self) -> Option<Lane<'_>>
pub fn to_right(&self) -> Option<Lane<'_>>
Returns the adjacent lane to the right, if one exists.
“Right” is defined as the direction of -r
in the (s, r, h)
lane-coordinate
frame.
§Returns
An Option<Lane>
containing the right lane, or None
if this is the
rightmost lane.
Sourcepub fn length(&self) -> f64
pub fn length(&self) -> f64
Returns the arc-length of the Lane along its reference curve.
The value of length() is also the maximum s-coordinate for this Lane; i.e., the domain of s is [0, length()].
§Returns
The length of the Lane in meters.
Sourcepub fn get_orientation(
&self,
lane_position: &LanePosition,
) -> Result<Rotation, MaliputError>
pub fn get_orientation( &self, lane_position: &LanePosition, ) -> Result<Rotation, MaliputError>
Get the orientation of the Lane
at the given LanePosition
.
Sourcepub fn to_inertial_position(
&self,
lane_position: &LanePosition,
) -> Result<InertialPosition, MaliputError>
pub fn to_inertial_position( &self, lane_position: &LanePosition, ) -> Result<InertialPosition, MaliputError>
§Brief
Get the InertialPosition of the Lane at the given LanePosition.
§Notes
Note there is no constraint for the r
coordinate, as it can be outside the lane boundaries.
In that scenario, the resultant inertial position represents a point in the s-r
plane at the given s
and h
coordinates. It’s on the user side to verify, if needed, that the lane position is within lane boundaries.
Bare in mind that the inertial position will be a point in the s-r
plane, but not necessarily on the road surface.
§Arguments
lane_position
- A maliput LanePosition.
§Precondition
The s component of lane_position
must be in domain [0, Lane::length()].
§Return
The InertialPosition corresponding to the input LanePosition.
Sourcepub fn to_lane_position(
&self,
inertial_position: &InertialPosition,
) -> Result<LanePositionResult, MaliputError>
pub fn to_lane_position( &self, inertial_position: &InertialPosition, ) -> Result<LanePositionResult, MaliputError>
Determines the LanePosition corresponding to InertialPosition inertial_position
.
The LanePosition is expected to be contained within the lane’s boundaries.
See Lane::to_segment_position method.
This method guarantees that its result satisfies the condition that
to_inertial_position(result.lane_position)
is within linear_tolerance()
of result.nearest_position
.
§Arguments
inertial_position
- A InertialPosition to get a LanePosition from.
§Return
A LanePositionResult with the closest LanePosition, the corresponding InertialPosition to that LanePosition and the distance between the input and output InertialPositions.
Sourcepub fn to_segment_position(
&self,
inertial_position: &InertialPosition,
) -> Result<LanePositionResult, MaliputError>
pub fn to_segment_position( &self, inertial_position: &InertialPosition, ) -> Result<LanePositionResult, MaliputError>
Determines the LanePosition corresponding to InertialPosition inertial_position
.
The LanePosition is expected to be contained within the segment’s boundaries.
See Lane::to_lane_position method.
This method guarantees that its result satisfies the condition that
to_inertial_position(result.lane_position)
is within linear_tolerance()
of result.nearest_position
.
§Arguments
inertial_position
- A InertialPosition to get a SegmentPosition from.
§Return
A LanePositionResult with the closest LanePosition within the segment, the corresponding InertialPosition to that LanePosition and the distance between the input and output InertialPositions.
Sourcepub fn lane_bounds(&self, s: f64) -> Result<RBounds, MaliputError>
pub fn lane_bounds(&self, s: f64) -> Result<RBounds, MaliputError>
Returns the nominal lateral (r) bounds for the lane as a function of s.
These are the lateral bounds for a position that is considered to be “staying in the lane”.
See also Lane::segment_bounds that defines the whole surface.
§Arguments
s
- The longitudinal position along the lane’s reference line.
§Returns
A RBounds containing the lateral bounds of the lane at the given `s.
§Errors
If lane bounds cannot be computed, an error is returned. This can happen if the
s
value is out of bounds (i.e., not in the range [0, Lane::length()]).
Sourcepub fn segment_bounds(&self, s: f64) -> Result<RBounds, MaliputError>
pub fn segment_bounds(&self, s: f64) -> Result<RBounds, MaliputError>
Returns the lateral segment (r) bounds of the lane as a function of s.
These are the lateral bounds for a position that is considered to be “on segment”, reflecting the physical extent of the surface of the lane’s segment.
See also Lane::lane_bounds that defines what’s considered to be “staying in the lane”.
§Arguments
s
- The longitudinal position along the lane’s reference line.
§Returns
A RBounds containing the lateral segment bounds of the lane at the given s
.
§Errors
If segment bounds cannot be computed, an error is returned. This can happen if the
s
value is out of bounds (i.e., not in the range [0, Lane::length()]).
Sourcepub fn elevation_bounds(&self, s: f64, r: f64) -> Result<HBounds, MaliputError>
pub fn elevation_bounds(&self, s: f64, r: f64) -> Result<HBounds, MaliputError>
Returns the elevation (h
) bounds of the lane as a function of (s, r)
.
These are the elevation bounds for a position that is considered to be within the Lane’s volume modeled by the RoadGeometry.
s
is within [0, length()
] of this Lane and r
is within
lane_bounds(s)
.
§Arguments
s
- The longitudinal position along the lane’s reference line.r
- The lateral position perpendicular to the reference line ats
.
§Returns
A HBounds containing the elevation bounds of the lane at the given (s, r)
.
§Errors
If elevation bounds cannot be computed, an error is returned. This can happen if the
s
value is out of bounds (i.e., not in the range [0, Lane::length()]) or if r
is not within the
lane bounds at s
.
Sourcepub fn eval_motion_derivatives(
&self,
lane_position: &LanePosition,
velocity: &IsoLaneVelocity,
) -> LanePosition
pub fn eval_motion_derivatives( &self, lane_position: &LanePosition, velocity: &IsoLaneVelocity, ) -> LanePosition
Computes derivatives of LanePosition given a velocity vector velocity
.
velocity
is a isometric velocity vector oriented in the Lane
-frame
at position
.
§Arguments
lane_position
- A LanePosition at which to evaluate the derivatives.velocity
- An IsoLaneVelocity representing the velocity vector in theLane
-frame atlane_position
.
§Returns
Returns Lane
-frame derivatives packed into a LanePosition struct.
Sourcepub fn get_branch_point(
&self,
end: &LaneEnd<'_>,
) -> Result<BranchPoint<'_>, MaliputError>
pub fn get_branch_point( &self, end: &LaneEnd<'_>, ) -> Result<BranchPoint<'_>, MaliputError>
Returns the lane’s BranchPoint for the specified end.
§Argument
end
- This lane’s start or end LaneEnd.
§Return
The lane’s BranchPoint for the specified end.
Sourcepub fn get_confluent_branches(
&self,
end: &LaneEnd<'_>,
) -> Result<LaneEndSet<'_>, MaliputError>
pub fn get_confluent_branches( &self, end: &LaneEnd<'_>, ) -> Result<LaneEndSet<'_>, MaliputError>
Returns the set of LaneEnd’s which connect with this lane on the
same side of the BranchPoint at end
. At a minimum,
this set will include this Lane.
§Arguments
end
- This lane’s start or end LaneEnd.
§Return
A LaneEndSet with all the LaneEnds at the same side of the BranchPoint at end
.
Sourcepub fn get_ongoing_branches(
&self,
end: &LaneEnd<'_>,
) -> Result<LaneEndSet<'_>, MaliputError>
pub fn get_ongoing_branches( &self, end: &LaneEnd<'_>, ) -> Result<LaneEndSet<'_>, MaliputError>
Returns the set of LaneEnds which continue onward from this lane at the
BranchPoint at end
.
§Arguments
end
- This lane’s start or end LaneEnd.
§Return
A LaneEndSet with all the LaneEnds at the opposite side of the BranchPoint at end
.
Sourcepub fn get_default_branch(&self, end: &LaneEnd<'_>) -> Option<LaneEnd<'_>>
pub fn get_default_branch(&self, end: &LaneEnd<'_>) -> Option<LaneEnd<'_>>
Sourcepub fn contains(&self, lane_position: &LanePosition) -> bool
pub fn contains(&self, lane_position: &LanePosition) -> bool
Evaluates if the Lane
contains the given LanePosition
.
§Arguments
lane_position
- A LanePosition to check if it is contained within theLane
.
§Returns
A boolean indicating whether the Lane
contains the LanePosition
.