pub struct Intersection<'a> { /* private fields */ }Expand description
An abstract convenience class that aggregates information pertaining to an intersection. Its primary purpose is to serve as a single source of this information and to remove the need for users to query numerous disparate data structures and state providers.
Implementations§
Source§impl<'a> Intersection<'a>
impl<'a> Intersection<'a>
Sourcepub fn phase(&self) -> StateProviderQuery<String>
pub fn phase(&self) -> StateProviderQuery<String>
Returns the current phase of the Intersection.
Based on the current phase, it returns a rules::StateProviderQuery with the phase’s ID
and the next state.
§Returns
A rules::StateProviderQuery for the current rules::Phase.
Sourcepub fn region(&self) -> Vec<LaneSRange>
pub fn region(&self) -> Vec<LaneSRange>
Returns the region of the RoadNetwork that is considered part of the Intersection.
§Returns
A vector of LaneSRanges where the intersection lives.
Sourcepub fn phase_ring_id(&self) -> String
pub fn phase_ring_id(&self) -> String
Returns the ID of the rules::PhaseRing that applies to this intersection.
§Returns
A String with the ID of a rules::PhaseRing.
pub fn bulb_ids(&self) -> Vec<UniqueBulbId>
Sourcepub fn get_bulb_state(&self, unique_bulb_id: &UniqueBulbId) -> Option<BulbState>
pub fn get_bulb_state(&self, unique_bulb_id: &UniqueBulbId) -> Option<BulbState>
Returns the current rules::BulbStates within the Intersection.
§Returns
A vector of rules::BulbStates.
Sourcepub fn discrete_value_rule_states(&self) -> Vec<DiscreteValueRuleState>
pub fn discrete_value_rule_states(&self) -> Vec<DiscreteValueRuleState>
Returns the current discrete value rule states within the intersection.
Sourcepub fn includes_traffic_light(&self, traffic_light_id: &str) -> bool
pub fn includes_traffic_light(&self, traffic_light_id: &str) -> bool
Determines whether the rules::TrafficLight is within this Intersection.
§Arguments
traffic_light_id- A rules::TrafficLight ID.
§Returns
True when traffic_light_id is within this Intersection.
Sourcepub fn includes_discrete_value_rule(&self, rule_id: &str) -> bool
pub fn includes_discrete_value_rule(&self, rule_id: &str) -> bool
Determines whether the rules::DiscreteValueRule is within this Intersection.
§Arguments
rule_id- A rules::DiscreteValueRule ID.
§Returns
True when rule_id is within this Intersection.
Sourcepub fn includes_inertial_position(
&self,
inertial_position: &InertialPosition,
road_geometry: &RoadGeometry<'_>,
) -> bool
pub fn includes_inertial_position( &self, inertial_position: &InertialPosition, road_geometry: &RoadGeometry<'_>, ) -> bool
Determines whether inertial_position is within this Intersection::region.
inertial_position is contained if the distance to the closest LanePosition in
Intersection::region is less or equal than the linear tolerance of the road_geometry.
§Arguments
inertial_position- An InertialPosition in theInertial-frame.road_geometry- The RoadGeometry.
§Returns
True when inertial_position is within Intersection::region. False otherwise.