maliput
Phase Class Referencefinal

Detailed Description

Manages a phase in a Route, towards its end.

It is composed of a set of api::LaneSRanges. All these api::LaneSRanges are adjacent and present different alternative path segments towards the end of the Route. This is a convenient entity to reduce the result space of all the api::LaneSRange permutations that yield valid paths within the Route.

All the initial api::RoadPositions constitute the set of start positions of this phase. All the end api::RoadPositions constitute the set of end positions of this phase. Certain api::RoadPositions in the start and end sets may not have connectivity at the api::BranchPoint level, but the api::LaneSRanges are included because they offer alternative volume for agents to maneuver in. At least one api::RoadPosition in both the start and end sets must be equal or overlapping in the INERTIAL-Frame another api::RoadPosition in the preceeding and succeeding Phase respectively.

Agents can localize themselves within a Phase by using FindLaneSRange() methods. This is useful when they are initially placing themselves on a path or for iterative querying.

Simple agents may consider directly using the Route object and Route::ComputeLaneSRoute() to traverse the Route. Those willing to exploit the possibilities of the Route in favor of satisfying complex behaviors will find Phases useful to better cluster adjacent api::LaneSRanges and the entry / exit api::RoadPositions of them.

#include <include/maliput/routing/phase.h>

Public Member Functions

 MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN (Phase)
 
 Phase ()=delete
 
 Phase (int index, double lane_s_range_tolerance, const std::vector< api::RoadPosition > &start_positions, const std::vector< api::RoadPosition > &end_positions, const std::vector< api::LaneSRange > &lane_s_ranges, const api::RoadNetwork *road_network)
 Constructs a Phase. More...
 
int index () const
 
double lane_s_range_tolerance () const
 
const std::vector< api::RoadPosition > & start_positions () const
 
const std::vector< api::RoadPosition > & end_positions () const
 
const std::vector< api::LaneSRange > & lane_s_ranges () const
 
PhasePositionResult FindPhasePosition (const api::InertialPosition &inertial_position) const
 Finds the PhasePositionResult where inertial_position best fits. More...
 
PhasePositionResult FindPhasePosition (const api::RoadPosition &road_position) const
 Finds the PhasePositionResult where road_position best fits. More...
 

Constructor & Destructor Documentation

◆ Phase() [1/2]

Phase ( )
delete

◆ Phase() [2/2]

Phase ( int  index,
double  lane_s_range_tolerance,
const std::vector< api::RoadPosition > &  start_positions,
const std::vector< api::RoadPosition > &  end_positions,
const std::vector< api::LaneSRange > &  lane_s_ranges,
const api::RoadNetwork road_network 
)

Constructs a Phase.

Parameters
indexThe index at the parent Route. It must be non-negative.
lane_s_range_toleranceTolerance to compare api::LaneSRanges. It must be non-negative.
start_positionsThe start api::RoadPositions of this Phase. Each api::RoadPosition must be valid and it must be in lane_s_ranges. There must be at least one api::RoadPosition.
end_positionThe end api::RoadPositions of this Phase. Each api::RoadPosition must be valid and it must be in lane_s_ranges. There must be at least one api::RoadPosition.
lane_s_rangesA right-to-left (see api::Segment semantics) ordered list of api::LaneSRanges. It must not be empty, all elements must exist in road_network and should be consecutively adjacent and ordered.
road_networkThe pointer to the api::RoadNetwork. It must not be nullptr. The lifetime of this pointer must exceed that of this object.
Exceptions
common::assertion_errorWhen index is negative.
common::assertion_errorWhen lane_s_range_tolerance is negative.
common::assertion_errorWhen any start_positions is invalid.
common::assertion_errorWhen start_positions is empty.
common::assertion_errorWhen any start_positions are not positions in lane_s_ranges.
common::assertion_errorWhen any end_positions is invalid.
common::assertion_errorWhen end_positions is empty.
common::assertion_errorWhen any end_positions are not positions in lane_s_ranges.
common::assertion_errorWhen lane_s_ranges is empty.
common::assertion_errorWhen lane_s_ranges contains non-adjacent or ordered consecutive api::LaneSRanges.
common::assertion_errorWhen lane_s_ranges contains api::LaneSRanges that do not exist in road_network.
common::assertion_errorWhen road_network is nullptr.

Member Function Documentation

◆ end_positions()

const std::vector<api::RoadPosition>& end_positions ( ) const
Returns
The end api::RoadPositions of this Phase.

◆ FindPhasePosition() [1/2]

PhasePositionResult FindPhasePosition ( const api::InertialPosition inertial_position) const

Finds the PhasePositionResult where inertial_position best fits.

The fitting of the inertial_position into the complete Route will use the same set of rules api::RoadGeometry::ToRoadPosition() uses to find a matching api::RoadPositionResult within the api::RoadGeometry. When the inertial_position does not fall into the volume defined by the set of api::LaneSRanges each Phase has, the returned Phase will be the one that minimizes the Euclidean distance to the Route. The mapping is done right on r=0, h=0 over the api::Lanes, i.e. at the centerline. This means that the returned distance and INERTIAL- Frame position are evaluated there as well.

Parameters
inertial_positionThe INERTIAL-Frame position.
Returns
A PhasePositionResult.

◆ FindPhasePosition() [2/2]

PhasePositionResult FindPhasePosition ( const api::RoadPosition road_position) const

Finds the PhasePositionResult where road_position best fits.

The fitting of the road_position into the complete Route will use the same set of rules api::RoadGeometry::ToRoadPosition() uses to find a matching api::RoadPositionResult within the api::RoadGeometry. When the road_position does not fall into the volume defined by the set of api::LaneSRanges each Phase has, the returned Phase will be the one that minimizes the Euclidean distance to the Route. The mapping is done right on r=0, h=0 over the api::Lanes, i.e. at the centerline. This means that the returned distance and INERTIAL- Frame position are evaluated there as well.

Parameters
road_positionThe road position. It must be valid.
Returns
A PhasePositionResult.
Exceptions
common::assertion_errorWhen road_position is not valid.

◆ index()

int index ( ) const
Returns
The index of this Phase.

◆ lane_s_range_tolerance()

double lane_s_range_tolerance ( ) const
Returns
Tolerance to compare api::LaneSRanges.

◆ lane_s_ranges()

const std::vector<api::LaneSRange>& lane_s_ranges ( ) const
Returns
The vector of api::LaneSRanges.

◆ MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN()

MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN ( Phase  )

◆ start_positions()

const std::vector<api::RoadPosition>& start_positions ( ) const
Returns
The start api::RoadPositions of this Phase.

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