maliput
maliput::routing Namespace Reference

Classes

class  Phase
 Manages a phase in a Route, towards its end. More...
 
struct  PhasePositionResult
 The result of a position query on a Phase. More...
 
class  Route
 Describes the sequence of paths that go from one api::RoadPosition to another. More...
 
struct  RoutePositionResult
 The result of a position query on a Route. More...
 
class  Router
 Computes Routes within an api::RoadNetwork. More...
 
struct  RoutingConstraints
 Holds the constraints that can be applied to the Router when computing a Route. More...
 

Enumerations

enum  LaneSRangeRelation {
  kAdjacentLeft, kAdjacentRight, kLeft, kRight,
  kSucceedingStraight, kSucceedingLeft, kSucceedingRight, kPreceedingStraight,
  kPreceedingLeft, kPreceedingRight, kCoincident, kUnrelated,
  kUnknown
}
 Defines the possible relationships the routing API can interpret between two api::LaneSRanges within a Route. More...
 

Functions

common::ComparisonResult< PhasePositionResultIsPhasePositionResultClose (const PhasePositionResult &ppr_a, const PhasePositionResult &ppr_b, double tolerance)
 Compares equality within tolerance deviation of the PhasePositionResult ppr_a and ppr_b. More...
 
common::ComparisonResult< RoutePositionResultIsRoutePositionResultClose (const RoutePositionResult &rpr_a, const RoutePositionResult &rpr_b, double tolerance)
 Compares equality within tolerance deviation of the RoutePositionResult rpr_a and rpr_b. More...
 
std::vector< api::LaneSRouteDeriveLaneSRoutes (const api::RoadPosition &start, const api::RoadPosition &end, double max_length_m)
 Derives and returns a set of LaneSRoute objects that go from start to end. More...
 
std::vector< std::vector< const maliput::api::Lane * > > FindLaneSequences (const maliput::api::Lane *start, const maliput::api::Lane *end, double max_length_m)
 Finds and returns sequences of lanes that go from a specified start lane to a specified end lane. More...
 
std::vector< std::vector< const maliput::api::Lane * > > FindLaneSequences (const maliput::api::Lane *start, const maliput::api::Lane *end, double max_length_m, bool no_u_turns)
 Overload to FindLaneSequences() that removes from the result those sequences presenting U-turns when no_u_turns is true. More...
 
std::map< LaneSRangeRelation, const char * > LaneSRangeRelationMapper ()
 
std::ostream & operator<< (std::ostream &os, const LaneSRangeRelation &relation)
 Convenient overload to serialize as string a LaneSRangeRelation. More...
 
bool ValidatePositionIsInLaneSRanges (const maliput::api::RoadPosition &position, const std::vector< api::LaneSRange > &lane_s_ranges, double tolerance)
 Determines whether the position resides in any of lane_s_ranges. More...
 
void ValidateRoutingConstraints (const RoutingConstraints &routing_constraints)
 Validates the constraints of each parameter of routing_constraints. More...
 

Enumeration Type Documentation

◆ LaneSRangeRelation

enum LaneSRangeRelation
strong

Defines the possible relationships the routing API can interpret between two api::LaneSRanges within a Route.

Relations described in this enum must be mutually exclusive and comprehensive, i.e., exactly one relation will apply for any given pair of LaneSRange objects.

The following ASCII art helps to understand the relative relations described below.

 x------A>-------x
 x------B>-------x------E>-------x------H>-------x
 x------C>-------x------F>-------x------I>-------x
 x------D>-------x------G>-------x

In the diagram above:

  • x indicates the beginning or the end of a api::LaneSRange.
  • > indicates the direction of travel of the route.
  • The letters name the api::LaneSRanges in the Route.

Thus,

LaneSRangeRelation::kUnknown represents the case when any of the api::LaneSRanges is not found in the Route.

Enumerator
kAdjacentLeft 
kAdjacentRight 
kLeft 
kRight 
kSucceedingStraight 
kSucceedingLeft 
kSucceedingRight 
kPreceedingStraight 
kPreceedingLeft 
kPreceedingRight 
kCoincident 
kUnrelated 
kUnknown 

Function Documentation

◆ DeriveLaneSRoutes()

std::vector< api::LaneSRoute > DeriveLaneSRoutes ( const api::RoadPosition start,
const api::RoadPosition end,
double  max_length_m 
)

Derives and returns a set of LaneSRoute objects that go from start to end.

If no routes are found, a vector of length zero is returned. Parameter max_length_m is the maximum length of the intermediate lanes between start and end. See the description of FindLaneSequences() for more details. If start and end are the same lane, a route consisting of one lane is returned regardless of max_length_m.

◆ FindLaneSequences() [1/2]

std::vector< std::vector< const Lane * > > FindLaneSequences ( const maliput::api::Lane start,
const maliput::api::Lane end,
double  max_length_m 
)

Finds and returns sequences of lanes that go from a specified start lane to a specified end lane.

Only ongoing lanes are searched (adjacent lanes are not). If start and end are the same lane, a sequence of one lane is returned regardless of max_length_m.

Parameters
startThe lane at the start of the sequence.
endThe lane at the end of the sequence.
max_length_mThe maximum length of a sequence in meters, not including start and end. The lengths of start and end are not included because a vehicle may not fully traverse them. Getting from start to end, however, requires a vehicle to fully traverse all intermediate lanes in the sequence, which is why only the sum of their lengths are included in the comparison with this upper bound.
Returns
A vector of lane sequences in which the first lane is start and the last lane is end. An empty vector is returned if no sequences are found.

◆ FindLaneSequences() [2/2]

std::vector< std::vector< const Lane * > > FindLaneSequences ( const maliput::api::Lane start,
const maliput::api::Lane end,
double  max_length_m,
bool  no_u_turns 
)

Overload to FindLaneSequences() that removes from the result those sequences presenting U-turns when no_u_turns is true.

Otherwise, the function behaves exactly the same. In this context, a U-turn is when the route backtracks against itself within the same lane.

◆ IsPhasePositionResultClose()

common::ComparisonResult< PhasePositionResult > IsPhasePositionResultClose ( const PhasePositionResult ppr_a,
const PhasePositionResult ppr_b,
double  tolerance 
)

Compares equality within tolerance deviation of the PhasePositionResult ppr_a and ppr_b.

Parameters
ppr_aThe first PhasePositionResult to compare.
ppr_bThe second PhasePositionResult to compare.
toleranceThe tolerance to use for the comparison.
Returns
A ComparisonResult indicating whether the two PhasePositionResults are the equivalent within the tolerance.

◆ IsRoutePositionResultClose()

common::ComparisonResult< RoutePositionResult > IsRoutePositionResultClose ( const RoutePositionResult rpr_a,
const RoutePositionResult rpr_b,
double  tolerance 
)

Compares equality within tolerance deviation of the RoutePositionResult rpr_a and rpr_b.

Parameters
rpr_aThe first RoutePositionResult to compare.
rpr_bThe second RoutePositionResult to compare.
toleranceThe tolerance to use for the comparison.
Returns
A ComparisonResult indicating whether the two RoutePositionResults are the equivalent within the tolerance.

◆ LaneSRangeRelationMapper()

std::map<LaneSRangeRelation, const char*> maliput::routing::LaneSRangeRelationMapper ( )
Returns
A convenient dictionary that maps LaneSRangeRelation to a const char *.

◆ operator<<()

std::ostream& maliput::routing::operator<< ( std::ostream &  os,
const LaneSRangeRelation relation 
)

Convenient overload to serialize as string a LaneSRangeRelation.

Parameters
osA mutable reference to a std::ostream.
relationThe LaneSRangeRelation to serialize.
Returns
os with relation serialized.

◆ ValidatePositionIsInLaneSRanges()

bool ValidatePositionIsInLaneSRanges ( const maliput::api::RoadPosition position,
const std::vector< api::LaneSRange > &  lane_s_ranges,
double  tolerance 
)

Determines whether the position resides in any of lane_s_ranges.

tolerance is used to expand the range of lane_s_ranges when evaluating position.

Parameters
positionThe api::RoadPosition to evaluate. It must be valid.
lane_s_rangesThe api::LaneSRanges. It must not be empty.
toleranceTolerance to compare api::LaneSRanges' ranges with position. It must be non-negative.
Returns
true When position is in any of lane_s_ranges with tolerance in the LANE-Frame s coordinate.
Exceptions
common::assertion_errorWhen position is not valid.
common::assertion_errorWhen lane_s_ranges is empty.
common::assertion_errorWhen tolerance is negative.

◆ ValidateRoutingConstraints()

void ValidateRoutingConstraints ( const RoutingConstraints routing_constraints)

Validates the constraints of each parameter of routing_constraints.

Parameters
routing_constraintsA RoutingConstraints to validate.
Exceptions
common::assertion_errorWhen one of the preconditions of routing_constraints are violated.