maliput
|
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... | |
|
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.
index | The index at the parent Route. It must be non-negative. |
lane_s_range_tolerance | Tolerance to compare api::LaneSRanges. It must be non-negative. |
start_positions | The 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_position | The 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_ranges | A 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_network | The pointer to the api::RoadNetwork. It must not be nullptr. The lifetime of this pointer must exceed that of this object. |
common::assertion_error | When index is negative. |
common::assertion_error | When lane_s_range_tolerance is negative. |
common::assertion_error | When any start_positions is invalid. |
common::assertion_error | When start_positions is empty. |
common::assertion_error | When any start_positions are not positions in lane_s_ranges . |
common::assertion_error | When any end_positions is invalid. |
common::assertion_error | When end_positions is empty. |
common::assertion_error | When any end_positions are not positions in lane_s_ranges . |
common::assertion_error | When lane_s_ranges is empty. |
common::assertion_error | When lane_s_ranges contains non-adjacent or ordered consecutive api::LaneSRanges. |
common::assertion_error | When lane_s_ranges contains api::LaneSRanges that do not exist in road_network . |
common::assertion_error | When road_network is nullptr. |
const std::vector<api::RoadPosition>& end_positions | ( | ) | const |
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.
inertial_position | The INERTIAL-Frame position. |
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.
road_position | The road position. It must be valid. |
common::assertion_error | When road_position is not valid. |
int index | ( | ) | const |
double lane_s_range_tolerance | ( | ) | const |
const std::vector<api::LaneSRange>& lane_s_ranges | ( | ) | const |
MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN | ( | Phase | ) |
const std::vector<api::RoadPosition>& start_positions | ( | ) | const |