maliput::api

Struct RoadGeometry

Source
pub struct RoadGeometry<'a> { /* private fields */ }
Expand description

A RoadGeometry. Wrapper around C++ implementation maliput::api::RoadGeometry. See RoadNetwork for an example of how to get a RoadGeometry.

Implementations§

Source§

impl<'a> RoadGeometry<'a>

Source

pub fn id(&self) -> String

Returns the id of the RoadGeometry.

Source

pub fn num_junctions(&self) -> i32

Returns the number of Junctions in the RoadGeometry.

Return value is non-negative.

Source

pub fn linear_tolerance(&self) -> f64

Returns the tolerance guaranteed for linear measurements (positions).

Source

pub fn angular_tolerance(&self) -> f64

Returns the tolerance guaranteed for angular measurements (orientations).

Source

pub fn num_branch_points(&self) -> i32

Returns the number of BranchPoints in the RoadGeometry.

Return value is non-negative.

Source

pub fn to_road_position( &self, inertial_position: &InertialPosition, ) -> RoadPositionResult

Determines the RoadPosition corresponding to InertialPosition inertial_position.

Returns a RoadPositionResult. Its RoadPosition is the point in the RoadGeometry’s manifold which is, in the Inertial-frame, closest to inertial_position. Its InertialPosition is the Inertial-frame equivalent of the RoadPosition and its distance is the Cartesian distance from inertial_position to the nearest point.

This method guarantees that its result satisfies the condition that result.lane.to_lane_position(result.pos) is within linear_tolerance() of the returned InertialPosition.

The map from RoadGeometry to the Inertial-frame is not onto (as a bounded RoadGeometry cannot completely cover the unbounded Cartesian universe). If inertial_position does represent a point contained within the volume of the RoadGeometry, then result distance is guaranteed to be less than or equal to linear_tolerance().

The map from RoadGeometry to Inertial-frame is not necessarily one-to-one. Different (s,r,h) coordinates from different Lanes, potentially from different Segments, may map to the same (x,y,z) Inertial-frame location.

If inertial_position is contained within the volumes of multiple Segments, then ToRoadPosition() will choose a Segment which yields the minimum height h value in the result. If the chosen Segment has multiple Lanes, then ToRoadPosition() will choose a Lane which contains inertial_position within its lane_bounds() if possible, and if that is still ambiguous, it will further select a Lane which minimizes the absolute value of the lateral r coordinate in the result.

Wrapper around C++ implementation maliput::api::RoadGeometry::ToRoadPosition.

Source

pub fn get_lane(&self, lane_id: &String) -> Option<Lane<'_>>

Get the lane matching given lane_id.

§Arguments
  • lane_id - The id of the lane.
§Return

The lane with the given id. If no lane is found with the given id, return None.

Source

pub fn get_lanes(&self) -> Vec<Lane<'_>>

Get all lanes of the RoadGeometry. Returns a vector of Lane.

§Example
use maliput::api::RoadNetwork;
use std::collections::HashMap;

let package_location = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let xodr_path = format!("{}/data/xodr/TShapeRoad.xodr", package_location);
let road_network_properties = HashMap::from([("road_geometry_id", "my_rg_from_rust"), ("opendrive_file", xodr_path.as_str())]);
let road_network = RoadNetwork::new("maliput_malidrive", &road_network_properties);
let road_geometry = road_network.road_geometry();
let lanes = road_geometry.get_lanes();
for lane in lanes {
   println!("lane_id: {}", lane.id());
}
Source

pub fn get_segment(&self, segment_id: &String) -> Segment<'_>

Get the segment matching given segment_id.

Source

pub fn get_junction(&self, junction_id: &String) -> Junction<'_>

Get the junction matching given junction_id.

Source

pub fn get_branch_point(&self, branch_point_id: &String) -> BranchPoint<'_>

Get the branch point matching given branch_point_id.

Auto Trait Implementations§

§

impl<'a> Freeze for RoadGeometry<'a>

§

impl<'a> RefUnwindSafe for RoadGeometry<'a>

§

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

§

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

§

impl<'a> Unpin for RoadGeometry<'a>

§

impl<'a> UnwindSafe for RoadGeometry<'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> 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, 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.