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>
impl<'a> RoadGeometry<'a>
Sourcepub fn num_junctions(&self) -> i32
pub fn num_junctions(&self) -> i32
Returns the number of Junctions in the RoadGeometry.
Return value is non-negative.
Sourcepub fn linear_tolerance(&self) -> f64
pub fn linear_tolerance(&self) -> f64
Returns the tolerance guaranteed for linear measurements (positions).
Sourcepub fn angular_tolerance(&self) -> f64
pub fn angular_tolerance(&self) -> f64
Returns the tolerance guaranteed for angular measurements (orientations).
Sourcepub fn num_branch_points(&self) -> i32
pub fn num_branch_points(&self) -> i32
Returns the number of BranchPoints in the RoadGeometry.
Return value is non-negative.
Sourcepub fn to_road_position(
&self,
inertial_position: &InertialPosition,
) -> RoadPositionResult
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
.
Sourcepub fn get_lanes(&self) -> Vec<Lane<'_>>
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());
}
Sourcepub fn get_segment(&self, segment_id: &String) -> Segment<'_>
pub fn get_segment(&self, segment_id: &String) -> Segment<'_>
Get the segment matching given segment_id
.
Sourcepub fn get_junction(&self, junction_id: &String) -> Junction<'_>
pub fn get_junction(&self, junction_id: &String) -> Junction<'_>
Get the junction matching given junction_id
.
Sourcepub fn get_branch_point(&self, branch_point_id: &String) -> BranchPoint<'_>
pub fn get_branch_point(&self, branch_point_id: &String) -> BranchPoint<'_>
Get the branch point matching given branch_point_id
.