RoadGeometry Class Reference

Detailed Description

geometry_base provides basic implementations for a subset of the interfaces of maliput's geometry API (api::RoadGeometry, etc) that can be shared by most "leaf" backends.

It is suitable for use as base classes for a complete backend implementation, or for mock implementations for unit tests (such as test_utilities/mock_geometry.h).

geometry_base implements all the virtual methods involved in managing the object graph of the road network. It does not implement any of the fundamental geometric methods that define the immersion of lane-frame into Inertial-frame; that is the job of each specific backend. geometry_base's implementation of api::RoadGeometry.

A base implementation for the DoToRoadPosition and DoToFindRoadPosition virtual methods are offered. These methods could be initialize with two different strategies for performing their tasks:

  1. BruteForceStrategy: This strategy performs a brute force search for the nearest lane on the road network. It performs repetitive queries on the maliput::api::Lane::ToLanePosition method.
  2. KdTreeStrategy: This strategy performs a search for the nearest lane on the road network using a KdTree. In order to achieve this, the kdtree space needs to initialized, which is done by calling InitializeStrategy() method, after all the lanes have been added to the road geometry.

The InitializeStrategy() method allows you to indicate which strategy you want to use for the search and it is mandatory to call it before using the DoToRoadPosition and DoToFindRoadPosition methods. By default the BruteForceStrategy is used.

// create road geometry.
RoadGeometry road_geometry("road_geometry", 0.1, 0.1, 1.0, math::Vector3(0., 0., 0.));
// Add lanes to the road geometry.
// ...
// Add branchpoints to the road geometry.
// ...
// Initialize the strategy.
road_geometry->InitializeStrategy<maliput::geometry_base::KDTreeStrategy>(0.25 /* sampling step */);
// or road_geometry->InitializeStrategy<maliput::geometry_base::BruteForceStrategy>();

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

Inheritance diagram for RoadGeometry:

Public Member Functions

 RoadGeometry (const api::RoadGeometryId &id, double linear_tolerance, double angular_tolerance, double scale_length, const math::Vector3 &inertial_to_backend_frame_translation)
 Constructs an empty RoadGeometry with the specified tolerances. More...
template<class T >
T * AddJunction (std::unique_ptr< T > junction)
 Adds junction to this RoadGeometry. More...
template<class T >
T * AddBranchPoint (std::unique_ptr< T > branch_point)
 Adds branch_point to this RoadGeometry. More...
template<class StrategyT = KDTreeStrategy, class... Args>
void InitializeStrategy (Args &&... args)
 ~RoadGeometry () override=default
- Public Member Functions inherited from RoadGeometry
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...
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...

Additional Inherited Members

- Protected Member Functions inherited from RoadGeometry
 RoadGeometry ()=default

Constructor & Destructor Documentation

◆ RoadGeometry()

RoadGeometry ( const api::RoadGeometryId id,
double  linear_tolerance,
double  angular_tolerance,
double  scale_length,
const math::Vector3 inertial_to_backend_frame_translation 

Constructs an empty RoadGeometry with the specified tolerances.

idthe ID of the RoadGeometry
linear_tolerancethe linear tolerance
angular_tolerancethe angular tolerance
scale_lengththe scale length
inertial_to_backend_frame_translationthe Inertial Frame to Backend Frame translation vector
maliput::common::assertion_errorif either linear_tolerance or angular_tolerance or scale_length is non-positive.

◆ ~RoadGeometry()

~RoadGeometry ( )

Reimplemented from RoadGeometry.

Member Function Documentation

◆ AddBranchPoint()

T* AddBranchPoint ( std::unique_ptr< T >  branch_point)

Adds branch_point to this RoadGeometry.

This RoadGeometry will take ownership of branch_point and will be assigned as its parent.

branch_point's raw pointer.
Template Parameters
Tmust be derived from geometry_base::BranchPoint.
std::exceptionif branch_point is empty.

◆ AddJunction()

T* AddJunction ( std::unique_ptr< T >  junction)

Adds junction to this RoadGeometry.

This RoadGeometry will take ownership of junction and will be assigned as its parent.

junction's raw pointer.
Template Parameters
Tmust be derived from geometry_base::Junction.
std::exceptionif junction is empty.

◆ InitializeStrategy()

void InitializeStrategy ( Args &&...  args)



The documentation for this class was generated from the following files:
Implements StrategyBase by reorganizing the maliput::api::Lane space into a kd-tree for achieving sig...
Definition: kd_tree_strategy.h:46
Eigen::Matrix< Scalar, 3, 1 > Vector3
A column vector of size 3, templated on scalar type.
Definition: eigen_types.h:39