maliput_sparse
builder.h File Reference

Detailed Description

Builder API to construct a maliput::api::RoadGeometry.

It allows simple construction of nested nodes in the maliput::api::RoadGeometry graph. The geometry details are expected to be computed / loaded outside this method to allow parallelization of that process. The graph construction is a synchronous operation though and requires that the geometry information is available when building maliput::api::Lanes.

A super simple 2-lane dragway could be constructed as follows:

const maliput::math:Vector3 start_left_lane_1{0., 0., 0.};
const maliput::math:Vector3 end_left_lane_1{100., 0., 0.};
const maliput::math:Vector3 start_right_lane_1{0., 5., 0.};
const maliput::math:Vector3 end_right_lane_1{100., 5., 0.};
const maliput::math:Vector3 start_left_lane_2 = start_right_lane_1;
const maliput::math:Vector3 end_left_lane_2 = end_right_lane_1;
const maliput::math:Vector3 start_right_lane_2{0., 10., 0.};
const maliput::math:Vector3 end_right_lane_2{100., 10., 0.};
const maliput::api::HBounds hbounds_l1{0., 5.};
const maliput::api::HBounds hbounds_l2{0., 10.};
LineString3d left_line_string_1{start_left_lane_1, end_left_lane_1};
LineString3d right_line_string_1{start_right_lane_1, end_right_lane_1};
LineString3d left_line_string_2{start_left_lane_2, end_left_lane_2};
LineString3d right_line_string_2{start_right_lane_2, end_right_lane_2};
RoadGeometryBuilder rg_builder;
std::unique_ptr<RoadGeometry> road_geometry = RoadGeometryBuilder()
.Id("two_lane_dragway")
.StartJunction()
.Id("j0")
.StartSegment()
.Id("j0_s0")
.StartLane()
.Id("j0_s0_l1")
.HeightBounds(hbounds_l1)
.StartLaneGeometry()
.LeftLineString(left_line_string_1)
.RightLineString(right_line_string_1)
.EndLaneGeometry()
.EndLane()
.StartLane()
.Id("j0_s0_l2")
.HeightBounds(hbounds_l2)
.StartLaneGeometry()
.LeftLineString(left_line_string_2)
.RightLineString(right_line_string_2)
.EndLaneGeometry()
.EndLane()
.EndSegment()
.EndJunction()
.StartBranchPoints()
.EndBranchPoints()
.Build();

{cpp}

#include <cstddef>
#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include <maliput/api/branch_point.h>
#include <maliput/api/junction.h>
#include <maliput/api/lane.h>
#include <maliput/api/lane_data.h>
#include <maliput/api/road_geometry.h>
#include <maliput/api/segment.h>
#include <maliput/common/passkey.h>
#include <maliput/geometry_base/branch_point.h>
#include <maliput/geometry_base/junction.h>
#include <maliput/geometry_base/lane.h>
#include <maliput/geometry_base/road_geometry.h>
#include <maliput/geometry_base/segment.h>
#include "maliput_sparse/geometry/lane_geometry.h"
#include "maliput_sparse/geometry/line_string.h"
Include dependency graph for builder.h:
This graph shows which files directly or indirectly include this file:

Classes

class  NestedBuilder< ParentT >
 Holds the parent Builder class and offers a small set of convenient methods to manage the Builder lifecycle. More...
 
class  LaneGeometryBuilder
 Builder class for maliput_sparse::geometry::LaneGeometry. More...
 
class  LaneBuilder
 Builder class for maliput::api::Lanes. More...
 
class  SegmentBuilder
 Builder class for maliput::api::Segments. More...
 
class  JunctionBuilder
 Builder class for maliput::api::Junctions. More...
 
struct  LaneEnd
 maliput::api::LaneEnd is not convenient in the building stage because there is no valid Lane pointer yet. More...
 
class  BranchPointBuilder
 
class  RoadGeometryBuilder
 Builder class for maliput::api::RoadGeometry. More...
 

Namespaces

 maliput_sparse
 
 maliput_sparse::builder
 
 maliput_sparse::builder::details
 
maliput_sparse::geometry::LineString3d
LineString< maliput::math::Vector3 > LineString3d
Definition: line_string.h:279