Lane

Struct Lane 

Source
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>

Source

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.

Source

pub fn index(&self) -> i32

Returns the index of this Lane within the Segment which owns it.

Source

pub fn segment(&self) -> Segment<'a>

Returns the Segment to which this Lane belongs.

§Returns

A Segment containing the Segment to which this Lane belongs.

Source

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.

Source

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.

Source

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.

Source

pub fn get_orientation( &self, lane_position: &LanePosition, ) -> Result<Rotation, MaliputError>

Get the orientation of the Lane at the given LanePosition.

Source

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
§Precondition

The s component of lane_position must be in domain [0, Lane::length()].

§Return

The InertialPosition corresponding to the input LanePosition.

Source

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
§Return

A LanePositionResult with the closest LanePosition, the corresponding InertialPosition to that LanePosition and the distance between the input and output InertialPositions.

Source

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
§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.

Source

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()]).

Source

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()]).

Source

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 at s.
§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.

Source

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 the Lane-frame at lane_position.
§Returns

Returns Lane-frame derivatives packed into a LanePosition struct.

Source

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.

Source

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.

Source

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.

Source

pub fn get_default_branch(&self, end: &LaneEnd<'_>) -> Option<LaneEnd<'_>>

Returns the default ongoing LaneEnd connected at end, or None if no default branch has been established.

§Arguments
  • end - This lane’s start or end LaneEnd.
§Return

An Option<LaneEnd> containing the default branch if it exists, or None if no default branch has been established.

Source

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 the Lane.
§Returns

A boolean indicating whether the Lane contains the LanePosition.

Trait Implementations§

Source§

impl Clone for Lane<'_>

Copy trait for Lane. A reference to the Lane is copied.

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Lane<'a>

§

impl<'a> RefUnwindSafe for Lane<'a>

§

impl<'a> !Send for Lane<'a>

§

impl<'a> !Sync for Lane<'a>

§

impl<'a> Unpin for Lane<'a>

§

impl<'a> UnwindSafe for Lane<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.