|
maliput
|
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>
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 Junction * | junction (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 BranchPoint * | branch_point (int index) const |
Returns the BranchPoint indexed by index. More... | |
| const IdIndex & | ById () 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< RoadPositionResult > | FindRoadPositions (const InertialPosition &inertial_position, double radius) const |
Obtains all RoadPositions within radius of inertial_position. More... | |
| 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. 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< 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. 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 | |
|
virtualdefault |
Reimplemented in RoadGeometry.
|
protecteddefault |
| double angular_tolerance | ( | ) | const |
Returns the tolerance guaranteed for angular measurements (orientations).
| 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.
| command | String that contains a command that the maliput backend being used can parse. |
| maliput::assertion_error | When the pointed backend hasn't implemented the API. |
| maliput::assertion_error | When the requested command can't be resolved. |
| const BranchPoint* branch_point | ( | int | index | ) | const |
Returns the BranchPoint indexed by index.
index must be >= 0 and < num_branch_points(). | const IdIndex& ById | ( | ) | const |
Accesses the IdIndex interface, which allows getting elements of the RoadGeometry's object graph by their unique id's.
| 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.
| 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.
| inertial_position | The inertial position to convert into one or more RoadPositions. |
| radius | The maximum distance from inertial_position to search. It must not be negative. |
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.| maliput::common::assertion_error | When radius is negative. |
Note that derivative implementations may choose to violate the above semantics for performance reasons. See docstrings of derivative implementations for details.
| 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.
| x | The x-coordinate in the Inertial frame. |
| y | The y-coordinate in the Inertial frame. |
| radius | The 2D search radius (in meters). Only results within this planar distance are returned. It must not be negative. |
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).| maliput::common::assertion_error | When radius is negative. |
| std::string GeoReferenceInfo | ( | ) | const |
Returns the Geo Reference info of this RoadGeometry.
| RoadGeometryId id | ( | ) | const |
Returns the persistent identifier.
| 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.
| const Junction* junction | ( | int | index | ) | const |
Returns the Junction indexed by index.
index must be >= 0 and < num_junctions(). | double linear_tolerance | ( | ) | const |
Returns the tolerance guaranteed for linear measurements (positions).
| int num_branch_points | ( | ) | const |
Returns the number of BranchPoints in the RoadGeometry.
Return value is non-negative.
| int num_junctions | ( | ) | const |
Returns the number of Junctions in the RoadGeometry.
Return value is non-negative.
| 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.
| lane_s_route | A lane route. |
| path_length_sampling_rate | The s coordinate sampling rate to sample lane_s_route. It must be positive. |
| maliput::assertion_error | When path_length_sampling_rate is not positive. |
| maliput::assertion_error | When any LaneSRange in lane_s_route.ranges() refers to an unknown Lane. |
| double scale_length | ( | ) | const |
Returns the characteristic scale length expressed by this RoadGeometry.
| 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.