maliput_multilane
Builder Class Reference

Detailed Description

Convenient builder class which makes it easy to construct a multilane road network.

multilane is a simple road-network implementation:

  • multiple lanes per segment;
  • constant lane width, lane_bounds, and elevation_bounds, same for all lanes;
  • only linear and constant-curvature-arc primitives in XY-plane;
  • cubic polynomials (parameterized on XY-arc-length) for elevation and superelevation;
  • superelevation (bank of road) rotates around the reference line (r = 0) of the path.

The Builder class simplifies the assembly of multilane road network components into a valid RoadGeometry. In the Builder model, an Endpoint specifies a point in world coordinates (along with a direction, slope, and superelevation parameters). A Connection is a path from an explicit start Endpoint to an end Endpoint calculated via a linear (LineOffset) or arc displacement (ArcOffset). A Group is a collection of Connections.

Builder::Build() constructs a RoadGeometry. Each Connection yields a Segment bearing multiple Lanes. Each Group yields a Junction containing the Segments associated with the grouped Connections; ungrouped Connections each receive their own Junction.

At Endpoints where theta_dot (i.e. the rate of change of superelevation with respect to an arc-length coordinate t that travels along the Connection curve’s projection over the z = 0 plane) has not been explicitly specified the Builder will automatically calculate theta_dot values to preserve G1 continuity across Connections. theta_dot values can only be explicitly specified for a Connection created from a reference curve with an explicit start or end Endpoint. However, specifying an explicit theta_dot may cause Builder::Build() to throw if it cannot assemble a G1 continuous RoadGeometry.

Specific suffixes are used to name Maliput entities. The following list explains the naming convention:

Note
'lane_index' is the index in the Segment, and 'branch_point_index' is is the index in the RoadGeometry.

#include <include/maliput_multilane/builder.h>

Inheritance diagram for Builder:
[legend]

Public Member Functions

 Builder (double lane_width, const api::HBounds &elevation_bounds, double linear_tolerance, double angular_tolerance, double scale_length, ComputationPolicy computation_policy, std::unique_ptr< GroupFactoryBase > group_factory)
 Constructs a Builder which can be used to specify and assemble a multilane implementation of an api::RoadGeometry. More...
 
double get_lane_width () const override
 Gets lane_width value. More...
 
const api::HBoundsget_elevation_bounds () const override
 Gets elevation_bounds value. More...
 
double get_linear_tolerance () const override
 Gets linear_tolerance value. More...
 
double get_angular_tolerance () const override
 Gets angular_tolerance value. More...
 
double get_scale_length () const override
 Gets scale_length value. More...
 
ComputationPolicy get_computation_policy () const override
 Gets computation_policy value. More...
 
const ConnectionConnect (const std::string &id, const LaneLayout &lane_layout, const StartReference::Spec &start_spec, const LineOffset &line_offset, const EndReference::Spec &end_spec) override
 Connects start_spec's Endpoint to an end-point linearly displaced from start_spec's Endpoint. More...
 
const ConnectionConnect (const std::string &id, const LaneLayout &lane_layout, const StartReference::Spec &start_spec, const ArcOffset &arc_offset, const EndReference::Spec &end_spec) override
 Connects start_spec's Endpoint to an end-point displaced from start_spec's Endpoint via an arc. More...
 
const ConnectionConnect (const std::string &id, const LaneLayout &lane_layout, const StartLane::Spec &start_spec, const LineOffset &line_offset, const EndLane::Spec &end_spec) override
 Creates a Connection whose planar reference curve is a line. More...
 
const ConnectionConnect (const std::string &id, const LaneLayout &lane_layout, const StartLane::Spec &start_spec, const ArcOffset &arc_offset, const EndLane::Spec &end_spec) override
 Creates a Connection whose planar reference curve is an arc. More...
 
void SetDefaultBranch (const Connection *in, int in_lane_index, const api::LaneEnd::Which in_end, const Connection *out, int out_lane_index, const api::LaneEnd::Which out_end) override
 Sets the default branch for one end of a connection. More...
 
GroupMakeGroup (const std::string &id) override
 Creates a new empty connection group with ID string id. More...
 
GroupMakeGroup (const std::string &id, const std::vector< const Connection * > &connections) override
 Creates a new connection group with ID id, populated with the given connections. More...
 
std::unique_ptr< const api::RoadGeometryBuild (const api::RoadGeometryId &id) const override
 Produces a RoadGeometry, with the ID id. More...
 
- Public Member Functions inherited from BuilderBase
 BuilderBase ()=default
 
virtual ~BuilderBase ()=default
 

Constructor & Destructor Documentation

◆ Builder()

Builder ( double  lane_width,
const api::HBounds elevation_bounds,
double  linear_tolerance,
double  angular_tolerance,
double  scale_length,
ComputationPolicy  computation_policy,
std::unique_ptr< GroupFactoryBase group_factory 
)

Constructs a Builder which can be used to specify and assemble a multilane implementation of an api::RoadGeometry.

lane_width is the width assigned to all Lanes. It must be greater or equal to zero. Lane reference path (which are offsets of parent Segment reference curve) are centered within the Lane. Lane spacing will be lane_width too. Segment extents will be derived from the composition of left and right shoulders, number of lanes and lane spacing. The elevation_bounds is applied uniformly to all lanes of every segment. linear_tolerance and angular_tolerance specify the respective tolerances for the resulting RoadGeometry. scale_length constrains the maximum level of detail captured by the resulting RoadGeometry. computation_policy sets the speed vs. accuracy balance for computations. group_factory allows to create groups.

Member Function Documentation

◆ Build()

std::unique_ptr< const api::RoadGeometry > Build ( const api::RoadGeometryId id) const
overridevirtual

Produces a RoadGeometry, with the ID id.

Exceptions
maliput::common::assertion_errorif unable to produce a valid (i.e. G1) RoadGeometry.

Implements BuilderBase.

◆ Connect() [1/4]

const Connection * Connect ( const std::string &  id,
const LaneLayout lane_layout,
const StartLane::Spec start_spec,
const ArcOffset arc_offset,
const EndLane::Spec end_spec 
)
overridevirtual

Creates a Connection whose planar reference curve is an arc.

start_spec.lane_id() lane starts at start_spec.endpoint() and end_spec.lane_id() lane ends with end_spec.endpoint_z() which specifies the elevation characteristics.

arc_offset specifies the shape of the arc.

lane_layout defines the number of lanes, their width, extra shoulder asphalt extensions and placing with respect to connection's reference curve.

Implements BuilderBase.

◆ Connect() [2/4]

const Connection * Connect ( const std::string &  id,
const LaneLayout lane_layout,
const StartLane::Spec start_spec,
const LineOffset line_offset,
const EndLane::Spec end_spec 
)
overridevirtual

Creates a Connection whose planar reference curve is a line.

start_spec.lane_id() lane starts at start_spec.endpoint() and end_spec.lane_id() lane ends with end_spec.endpoint_z() which specifies the elevation characteristics.

line_offset specifies the length of displacement (in the direction of the heading of start_spec's Endpoint).

lane_layout defines the number of lanes, their width, extra shoulder asphalt extensions and placing with respect to connection's reference curve.

Implements BuilderBase.

◆ Connect() [3/4]

const Connection * Connect ( const std::string &  id,
const LaneLayout lane_layout,
const StartReference::Spec start_spec,
const ArcOffset arc_offset,
const EndReference::Spec end_spec 
)
overridevirtual

Connects start_spec's Endpoint to an end-point displaced from start_spec's Endpoint via an arc.

arc_offset specifies the shape of the arc. end_spec specifies the elevation characteristics at the end-point.

lane_layout defines the number of lanes, their width, extra shoulder asphalt extensions and placing with respect to connection's reference curve.

Implements BuilderBase.

◆ Connect() [4/4]

const Connection * Connect ( const std::string &  id,
const LaneLayout lane_layout,
const StartReference::Spec start_spec,
const LineOffset line_offset,
const EndReference::Spec end_spec 
)
overridevirtual

Connects start_spec's Endpoint to an end-point linearly displaced from start_spec's Endpoint.

line_offset specifies the length of displacement (in the direction of the heading of start_spec's Endpoint). end_spec specifies the elevation characteristics at the end-point.

lane_layout defines the number of lanes, their width, extra shoulder asphalt extensions and placing with respect to connection's reference curve.

Implements BuilderBase.

◆ get_angular_tolerance()

double get_angular_tolerance ( ) const
overridevirtual

Gets angular_tolerance value.

Implements BuilderBase.

◆ get_computation_policy()

ComputationPolicy get_computation_policy ( ) const
overridevirtual

Gets computation_policy value.

Implements BuilderBase.

◆ get_elevation_bounds()

const api::HBounds& get_elevation_bounds ( ) const
overridevirtual

Gets elevation_bounds value.

Implements BuilderBase.

◆ get_lane_width()

double get_lane_width ( ) const
overridevirtual

Gets lane_width value.

Implements BuilderBase.

◆ get_linear_tolerance()

double get_linear_tolerance ( ) const
overridevirtual

Gets linear_tolerance value.

Implements BuilderBase.

◆ get_scale_length()

double get_scale_length ( ) const
overridevirtual

Gets scale_length value.

Implements BuilderBase.

◆ MakeGroup() [1/2]

Group * MakeGroup ( const std::string &  id)
overridevirtual

Creates a new empty connection group with ID string id.

Implements BuilderBase.

◆ MakeGroup() [2/2]

Group * MakeGroup ( const std::string &  id,
const std::vector< const Connection * > &  connections 
)
overridevirtual

Creates a new connection group with ID id, populated with the given connections.

Implements BuilderBase.

◆ SetDefaultBranch()

void SetDefaultBranch ( const Connection in,
int  in_lane_index,
const api::LaneEnd::Which  in_end,
const Connection out,
int  out_lane_index,
const api::LaneEnd::Which  out_end 
)
overridevirtual

Sets the default branch for one end of a connection.

The default branch for the in_end of connection in at Lane in_lane_indexwill set to be out_end of connection out at Lane out_lane_index. The specified connections must actually be joined at the specified ends (i.e., the Endpoint's for those ends must be coincident and (anti)parallel within the tolerances for the Builder).

Implements BuilderBase.


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