Go to the documentation of this file.
1 #pragma once
3 #include <memory>
4 #include <vector>
13 namespace drake {
14 namespace maliput {
15 namespace multilane {
17 /// A simple api::RoadGeometry implementation that only supports a single
18 /// lane per segment. Use the Builder interface to actually assemble
19 /// a sensible road network.
21  public:
24  /// Constructs an empty RoadGeometry with the specified tolerances.
25  RoadGeometry(const api::RoadGeometryId& id,
26  const double linear_tolerance,
27  const double angular_tolerance)
28  : id_(id),
29  linear_tolerance_(linear_tolerance),
30  angular_tolerance_(angular_tolerance) {}
32  /// Creates and adds a new Junction with the specified @p id.
35  /// Creates and adds a new BranchPoint with the specified @p id.
38  ~RoadGeometry() override = default;
40  private:
41  const api::RoadGeometryId do_id() const override { return id_; }
43  int do_num_junctions() const override { return junctions_.size(); }
45  const api::Junction* do_junction(int index) const override;
47  int do_num_branch_points() const override { return branch_points_.size(); }
49  const api::BranchPoint* do_branch_point(int index) const override;
51  // Returns a RoadPosition for a lane containing the provided `geo_position`.
52  // Either if there is or not a containing lane, the position is returned for
53  // the lane whose centerline curve is closest to `geo_position`. In other
54  // words, for the lane whose LanePosition makes the r coordinate be the
55  // smallest. If `hint` is non-null, then the search is restricted to the
56  // `hint->lane` and lanes adjacent to `hint->lane`.
57  api::RoadPosition DoToRoadPosition(
58  const api::GeoPosition& geo_position,
59  const api::RoadPosition* hint,
60  api::GeoPosition* nearest_position,
61  double* distance) const override;
63  double do_linear_tolerance() const override { return linear_tolerance_; }
65  double do_angular_tolerance() const override { return angular_tolerance_; }
68  double linear_tolerance_{};
69  double angular_tolerance_{};
70  std::vector<std::unique_ptr<Junction>> junctions_;
71  std::vector<std::unique_ptr<BranchPoint>> branch_points_;
72 };
74 } // namespace multilane
75 } // namespace maliput
76 } // namespace drake
A BranchPoint is a node in the network of a RoadGeometry at which Lanes connect to one another...
Definition: branch_point.h:67
Definition: automotive_demo.cc:90
Abstract API for the geometry of a road network, including both the network topology and the geometry...
Definition: road_geometry.h:26
TypeSpecificIdentifier< class BranchPoint > BranchPointId
Definition: branch_point.h:19
An implementation of api::BranchPoint.
Definition: branch_point.h:42
Definition: arc_road_curve.cc:11
double linear_tolerance() const
Returns the tolerance guaranteed for linear measurements (positions).
Definition: road_geometry.h:110
GeoPositionT< double > GeoPosition
Definition: lane_data.h:186
double angular_tolerance() const
Returns the tolerance guaranteed for angular measurements (orientations).
Definition: road_geometry.h:115
TypeSpecificIdentifier< class Junction > JunctionId
Persistent identifier for a Junction element.
Definition: junction.h:17
TypeSpecificIdentifier< class RoadGeometry > RoadGeometryId
Persistent identifier for a RoadGeometry element.
Definition: road_geometry.h:19
A Junction is a closed set of Segments which have physically coplanar road surfaces, in the sense that RoadPositions with the same h value (height above surface) in the domains of two Segments map to the same GeoPosition.
Definition: junction.h:27
BranchPoint * NewBranchPoint(api::BranchPointId id)
Creates and adds a new BranchPoint with the specified id.
Definition: road_geometry.cc:93
Junction * NewJunction(api::JunctionId id)
Creates and adds a new Junction with the specified id.
Definition: road_geometry.cc:88
A simple api::RoadGeometry implementation that only supports a single lane per segment.
Definition: road_geometry.h:20
An api::Junction implementation.
Definition: junction.h:18
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN deletes the special member functions for copy-construction, copy-assignment, move-construction, and move-assignment.
Definition: drake_copyable.h:33
A position in the road network, consisting of a pointer to a specific Lane and a Lane-frame position ...
Definition: lane_data.h:299
Provides careful macros to selectively enable or disable the special member functions for copy-constr...