maliput
|
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>
Public Types | |
using | Id = TypeSpecificIdentifier< class Intersection > |
Unique identifier for an Intersection. More... | |
Public Member Functions | |
Intersection (const Id &id, const std::vector< LaneSRange > ®ion, const rules::PhaseRing &ring) | |
Constructs an Intersection instance. More... | |
virtual | ~Intersection ()=default |
const Id & | id () const |
Returns the persistent identifier. More... | |
virtual std::optional< rules::PhaseProvider::Result > | Phase () 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::Id & | ring_id () const |
Returns the rules::PhaseRing::Id of the rules::PhaseRing that applies to this intersection. More... | |
const std::optional< rules::BulbStates > | bulb_states () const |
Returns the current bulb states within the intersection. More... | |
const std::optional< rules::DiscreteValueRuleStates > | DiscreteValueRuleStates () 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... | |
using Id = TypeSpecificIdentifier<class Intersection> |
Unique identifier for an Intersection.
Intersection | ( | const Id & | id, |
const std::vector< LaneSRange > & | region, | ||
const rules::PhaseRing & | ring | ||
) |
Constructs an Intersection instance.
id | The intersection's unique ID. |
region | The region of the road network that should be considered part of the intersection. |
ring | The PhaseRing that defines the phases within the intersection. |
|
virtualdefault |
Reimplemented in Intersection.
const std::optional< BulbStates > bulb_states | ( | ) | const |
Returns the current bulb states within the intersection.
const std::optional< rules::DiscreteValueRuleStates > DiscreteValueRuleStates | ( | ) | const |
Returns the current discrete value rule states within the intersection.
const Id& id | ( | ) | const |
Returns the persistent identifier.
bool Includes | ( | const InertialPosition & | inertial_position, |
const RoadGeometry * | road_geometry | ||
) | const |
Determines whether inertial_position
is within this Intersection::Region().
inertial_position | A InertialPosition in the Inertial -frame. |
road_geometry | The RoadGeometry where Intersection::Region() is contained. It must not be nullptr. |
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
.common::assertion_error | When road_geometry is nullptr. |
common::assertion_error | When Lanes in Intersection::Region() are not found in road_geometry . |
bool Includes | ( | const rules::DiscreteValueRule::Id & | id | ) | const |
Determines whether the rules::DiscreteValueRule::Id is within this Intersection.
id | A rules::DiscreteValueRule::Id. |
id
is within this Intersection. bool Includes | ( | const rules::RightOfWayRule::Id & | id | ) | const |
Determines whether the rules::RightOfWayRule::Id is within this Intersection.
id | A rules::RightOfWayRule::Id. |
id
is within this Intersection. bool Includes | ( | const rules::TrafficLight::Id & | id | ) | const |
Determines whether the rules::TrafficLight::Id is within this Intersection.
id | A rules::TrafficLight::Id. |
id
is within this Intersection.
|
pure virtual |
Returns the current phase.
Implemented in Intersection.
const std::vector<LaneSRange>& region | ( | ) | const |
Returns the region. See constructor parameter region
for more details.
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.
const std::optional< rules::RuleStates > RuleStates | ( | ) | const |
Returns the current RightOfWayRule states within the intersection.
|
pure virtual |
Sets the current Phase and optionally the next Phase.
std::exception | if duration_until is defined when next_phase is undefined. |
Implemented in Intersection.