maliput
Intersection Class Referenceabstract

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

#include <include/maliput/api/intersection.h>

Inheritance diagram for Intersection:
[legend]

Public Types

using Id = TypeSpecificIdentifier< class Intersection >
 Unique identifier for an Intersection. More...
 

Public Member Functions

 Intersection (const Id &id, const std::vector< LaneSRange > &region, const rules::PhaseRing &ring)
 Constructs an Intersection instance. More...
 
virtual ~Intersection ()=default
 
const Idid () const
 Returns the persistent identifier. More...
 
virtual std::optional< rules::PhaseProvider::ResultPhase () const =0
 Returns the current phase. More...
 
virtual void SetPhase (const api::rules::Phase::Id &phase_id, const std::optional< api::rules::Phase::Id > &next_phase=std::nullopt, const std::optional< double > &duration_until=std::nullopt)=0
 Sets the current Phase and optionally the next Phase. More...
 
const std::vector< LaneSRange > & region () const
 Returns the region. See constructor parameter region for more details. More...
 
const rules::PhaseRing::Idring_id () const
 Returns the rules::PhaseRing::Id of the rules::PhaseRing that applies to this intersection. More...
 
const std::optional< rules::BulbStatesbulb_states () const
 Returns the current bulb states within the intersection. More...
 
const std::optional< rules::DiscreteValueRuleStatesDiscreteValueRuleStates () const
 Returns the current discrete value rule states within the intersection. More...
 
const std::optional< rules::RuleStates > RuleStates () const
 Returns the current RightOfWayRule states within the intersection. More...
 
bool Includes (const rules::TrafficLight::Id &id) const
 Determines whether the rules::TrafficLight::Id is within this Intersection. More...
 
bool Includes (const rules::DiscreteValueRule::Id &id) const
 Determines whether the rules::DiscreteValueRule::Id is within this Intersection. More...
 
bool Includes (const rules::RightOfWayRule::Id &id) const
 Determines whether the rules::RightOfWayRule::Id is within this Intersection. More...
 
bool Includes (const InertialPosition &inertial_position, const RoadGeometry *road_geometry) const
 Determines whether inertial_position is within this Intersection::Region(). More...
 

Member Typedef Documentation

◆ Id

Unique identifier for an Intersection.

Constructor & Destructor Documentation

◆ Intersection()

Intersection ( const Id id,
const std::vector< LaneSRange > &  region,
const rules::PhaseRing ring 
)

Constructs an Intersection instance.

Parameters
idThe intersection's unique ID.
regionThe region of the road network that should be considered part of the intersection.
ringThe PhaseRing that defines the phases within the intersection.

◆ ~Intersection()

virtual ~Intersection ( )
virtualdefault

Reimplemented in Intersection.

Member Function Documentation

◆ bulb_states()

const std::optional< BulbStates > bulb_states ( ) const

Returns the current bulb states within the intersection.

◆ DiscreteValueRuleStates()

const std::optional< rules::DiscreteValueRuleStates > DiscreteValueRuleStates ( ) const

Returns the current discrete value rule states within the intersection.

◆ id()

const Id& id ( ) const

Returns the persistent identifier.

◆ Includes() [1/4]

bool Includes ( const InertialPosition inertial_position,
const RoadGeometry road_geometry 
) const

Determines whether inertial_position is within this Intersection::Region().

Parameters
inertial_positionA InertialPosition in the Inertial-frame.
road_geometryThe RoadGeometry where Intersection::Region() is contained. It must not be nullptr.
Returns
True When inertial_position is within 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.
Exceptions
common::assertion_errorWhen road_geometry is nullptr.
common::assertion_errorWhen Lanes in Intersection::Region() are not found in road_geometry.

◆ Includes() [2/4]

bool Includes ( const rules::DiscreteValueRule::Id id) const

Determines whether the rules::DiscreteValueRule::Id is within this Intersection.

Parameters
idA rules::DiscreteValueRule::Id.
Returns
True When id is within this Intersection.

◆ Includes() [3/4]

bool Includes ( const rules::RightOfWayRule::Id &  id) const

Determines whether the rules::RightOfWayRule::Id is within this Intersection.

Parameters
idA rules::RightOfWayRule::Id.
Returns
True When id is within this Intersection.

◆ Includes() [4/4]

bool Includes ( const rules::TrafficLight::Id id) const

Determines whether the rules::TrafficLight::Id is within this Intersection.

Parameters
idA rules::TrafficLight::Id.
Returns
True When id is within this Intersection.

◆ Phase()

std::optional< api::rules::PhaseProvider::Result > Phase ( ) const
pure virtual

Returns the current phase.

Implemented in Intersection.

◆ region()

const std::vector<LaneSRange>& region ( ) const

Returns the region. See constructor parameter region for more details.

◆ ring_id()

const rules::PhaseRing::Id& ring_id ( ) const

Returns the rules::PhaseRing::Id of the rules::PhaseRing that applies to this intersection.

See constructor parameter ring for more details.

◆ RuleStates()

const std::optional< rules::RuleStates > RuleStates ( ) const

Returns the current RightOfWayRule states within the intersection.

◆ SetPhase()

void SetPhase ( const api::rules::Phase::Id phase_id,
const std::optional< api::rules::Phase::Id > &  next_phase = std::nullopt,
const std::optional< double > &  duration_until = std::nullopt 
)
pure virtual

Sets the current Phase and optionally the next Phase.

Exceptions
std::exceptionif duration_until is defined when next_phase is undefined.

Implemented in Intersection.


The documentation for this class was generated from the following files: