maliput
RoadGeometry Class Referenceabstract

Detailed Description

Abstract API for the geometry of a road network, including both the network topology and the geometry of its embedding in 3-space.

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

Inheritance diagram for RoadGeometry:
[legend]

Classes

class  IdIndex
 Abstract interface for a collection of methods which allow accessing objects in a RoadGeometry's object graph (Lanes, Segments, Junctions, BranchPoints) by their unique id's. More...
 

Public Member Functions

virtual ~RoadGeometry ()=default
 
RoadGeometryId id () const
 Returns the persistent identifier. More...
 
int num_junctions () const
 Returns the number of Junctions in the RoadGeometry. More...
 
const Junctionjunction (int index) const
 Returns the Junction indexed by index. More...
 
int num_branch_points () const
 Returns the number of BranchPoints in the RoadGeometry. More...
 
const BranchPointbranch_point (int index) const
 Returns the BranchPoint indexed by index. More...
 
const IdIndexById () const
 Accesses the IdIndex interface, which allows getting elements of the RoadGeometry's object graph by their unique id's. More...
 
RoadPositionResult ToRoadPosition (const InertialPosition &inertial_position, const std::optional< RoadPosition > &hint=std::nullopt) const
 Determines the RoadPosition corresponding to InertialPosition inertial_position. More...
 
std::vector< RoadPositionResultFindRoadPositions (const InertialPosition &inertial_position, double radius) const
 Obtains all RoadPositions within radius of inertial_position. More...
 
std::vector< RoadPositionResultFindSurfaceRoadPositionsAtXY (double x, double y, double radius) const
 Finds all RoadPositions within a 2D radius of the given (x, y) inertial coordinates. More...
 
double linear_tolerance () const
 Returns the tolerance guaranteed for linear measurements (positions). More...
 
double angular_tolerance () const
 Returns the tolerance guaranteed for angular measurements (orientations). More...
 
double scale_length () const
 Returns the characteristic scale length expressed by this RoadGeometry. More...
 
std::vector< std::string > CheckInvariants () const
 Verifies certain invariants guaranteed by the API. More...
 
std::vector< InertialPositionSampleAheadWaypoints (const LaneSRoute &lane_s_route, double path_length_sampling_rate) const
 Samples lane_s_route at path_length_sampling_rate and converts those LanePositions into InertialPositions. More...
 
math::Vector3 inertial_to_backend_frame_translation () const
 The Backend Frame is an inertial frame similar to the Inertial Frame that differ one from another by an isometric transformation. More...
 
std::string BackendCustomCommand (const std::string &command) const
 This method is meant to provide an extra feature for the backend implementation. More...
 
std::string GeoReferenceInfo () const
 Returns the Geo Reference info of this RoadGeometry. More...
 

Protected Member Functions

 RoadGeometry ()=default
 

Constructor & Destructor Documentation

◆ ~RoadGeometry()

virtual ~RoadGeometry ( )
virtualdefault

Reimplemented in RoadGeometry.

◆ RoadGeometry()

RoadGeometry ( )
protecteddefault

Member Function Documentation

◆ angular_tolerance()

double angular_tolerance ( ) const

Returns the tolerance guaranteed for angular measurements (orientations).

◆ BackendCustomCommand()

std::string BackendCustomCommand ( const std::string &  command) const

This method is meant to provide an extra feature for the backend implementation.

The maliput::API is rigid with respect to its API and the non-transparency with the backend implementation, so this method is a placeholder for commands that the maliput backend might decide to implement to forward some other useful information that might be needed by the user. Each backend that implements this method should provide detailed information about the available commands and what's the format used for the input/output.Use with caution.

Parameters
commandString that contains a command that the maliput backend being used can parse.
Returns
A string with the command's output.
Exceptions
maliput::assertion_errorWhen the pointed backend hasn't implemented the API.
maliput::assertion_errorWhen the requested command can't be resolved.

◆ branch_point()

const BranchPoint* branch_point ( int  index) const

Returns the BranchPoint indexed by index.

Precondition
index must be >= 0 and < num_branch_points().

◆ ById()

const IdIndex& ById ( ) const

Accesses the IdIndex interface, which allows getting elements of the RoadGeometry's object graph by their unique id's.

◆ CheckInvariants()

std::vector< std::string > CheckInvariants ( ) const

Verifies certain invariants guaranteed by the API.

Returns a vector of strings describing violations of invariants. Return value with size() == 0 indicates success.

◆ FindRoadPositions()

std::vector< RoadPositionResult > FindRoadPositions ( const InertialPosition inertial_position,
double  radius 
) const

Obtains all RoadPositions within radius of inertial_position.

Only Lanes whose segment regions include points that are within radius of inertial_position are included in the search. For each of these Lanes, include the RoadPosition or RoadPositions with the minimum distance to inertial_position in the returned result.

Parameters
inertial_positionThe inertial position to convert into one or more RoadPositions.
radiusThe maximum distance from inertial_position to search. It must not be negative.
Returns
A vector of RoadPositionResults representing the possible RoadPositions. When radius is zero, the vector contains results with distance parameter being less or equal to linear_tolerance. When radius is infinity, the query should return the closest point for each lane.
Exceptions
maliput::common::assertion_errorWhen radius is negative.

Note that derivative implementations may choose to violate the above semantics for performance reasons. See docstrings of derivative implementations for details.

◆ FindSurfaceRoadPositionsAtXY()

std::vector< RoadPositionResult > FindSurfaceRoadPositionsAtXY ( double  x,
double  y,
double  radius 
) const

Finds all RoadPositions within a 2D radius of the given (x, y) inertial coordinates.

Unlike FindRoadPositions(), this method uses only the X and Y components for distance filtering (2D planar distance). The Z coordinate of the returned nearest positions is computed from the road surface (i.e., the point on the road at h=0).

This is useful for mapping 2D trajectories onto the road network, where the caller has (x, y) coordinates but not the elevation.

Parameters
xThe x-coordinate in the Inertial frame.
yThe y-coordinate in the Inertial frame.
radiusThe 2D search radius (in meters). Only results within this planar distance are returned. It must not be negative.
Returns
A vector of RoadPositionResult where:
  • road_position.pos.h() is 0 (on the road surface).
  • nearest_position contains the full 3D inertial position on the road surface.
  • distance is the 2D planar distance between (x, y) and the nearest point. Results are sorted by ascending distance (nearest first).
Exceptions
maliput::common::assertion_errorWhen radius is negative.

◆ GeoReferenceInfo()

std::string GeoReferenceInfo ( ) const

Returns the Geo Reference info of this RoadGeometry.

Returns
A string containing the Geo Reference projection, if any.

◆ id()

RoadGeometryId id ( ) const

Returns the persistent identifier.

◆ inertial_to_backend_frame_translation()

math::Vector3 inertial_to_backend_frame_translation ( ) const

The Backend Frame is an inertial frame similar to the Inertial Frame that differ one from another by an isometric transformation.

This method returns the translation vector between both frames.

For an explanation on the two different frames, see the explanation in maliput_design.h.

Returns
maliput's Inertial Frame to Backend Frame translation vector.

◆ junction()

const Junction* junction ( int  index) const

Returns the Junction indexed by index.

Precondition
index must be >= 0 and < num_junctions().

◆ linear_tolerance()

double linear_tolerance ( ) const

Returns the tolerance guaranteed for linear measurements (positions).

◆ num_branch_points()

int num_branch_points ( ) const

Returns the number of BranchPoints in the RoadGeometry.

Return value is non-negative.

◆ num_junctions()

int num_junctions ( ) const

Returns the number of Junctions in the RoadGeometry.

Return value is non-negative.

◆ SampleAheadWaypoints()

std::vector< InertialPosition > SampleAheadWaypoints ( const LaneSRoute lane_s_route,
double  path_length_sampling_rate 
) const

Samples lane_s_route at path_length_sampling_rate and converts those LanePositions into InertialPositions.

When path_length_sampling_rate is smaller than linear_tolerance, linear_tolerance will be used instead. When path_length_sampling_rate is bigger than total lane_s_route length (accumulated length of all LaneSRoute::ranges()) the minimum will be considered and two samples are taken. When total lane_s_route's length is not an integral multiple of path_length_sampling_rate, the last sampling step will be the remaining distance long only.

Parameters
lane_s_routeA lane route.
path_length_sampling_rateThe s coordinate sampling rate to sample lane_s_route. It must be positive.
Returns
A vector of InertialPositions which result of mapping to the inertial frame the samples of LanePositions.
Exceptions
maliput::assertion_errorWhen path_length_sampling_rate is not positive.
maliput::assertion_errorWhen any LaneSRange in lane_s_route.ranges() refers to an unknown Lane.

◆ scale_length()

double scale_length ( ) const

Returns the characteristic scale length expressed by this RoadGeometry.

◆ ToRoadPosition()

RoadPositionResult ToRoadPosition ( const InertialPosition inertial_position,
const std::optional< RoadPosition > &  hint = std::nullopt 
) const

Determines the RoadPosition corresponding to InertialPosition inertial_position.

If hint is provided, its value is used to help determine the result.

Returns a RoadPositionResult. Its RoadPosition is the point in the RoadGeometry's manifold which is, in the Inertial-frame, closest to inertial_position. Its InertialPosition is the Inertial-frame equivalent of the RoadPosition and its distance is the Cartesian distance from inertial_position to the nearest point.

This method guarantees that its result satisfies the condition that result.lane->ToInertialPosition(result.pos) is within linear_tolerance() of the returned InertialPosition.

The map from RoadGeometry to the Inertial-frame is not onto (as a bounded RoadGeometry cannot completely cover the unbounded Cartesian universe). If inertial_position does represent a point contained within the volume of the RoadGeometry, then result distance is guaranteed to be less than or equal to linear_tolerance().

The map from RoadGeometry to Inertial-frame is not necessarily one-to-one. Different (s,r,h) coordinates from different Lanes, potentially from different Segments, may map to the same (x,y,z) Inertial-frame location.

If inertial_position is contained within the volumes of multiple Segments, then ToRoadPosition() will choose a Segment which yields the minimum height h value in the result. If the chosen Segment has multiple Lanes, then ToRoadPosition() will choose a Lane which contains inertial_position within its lane_bounds() if possible, and if that is still ambiguous, it will further select a Lane which minimizes the absolute value of the lateral r coordinate in the result.


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