Go to the documentation of this file.
1 #pragma once
3 #include <memory>
4 #include <vector>
14 namespace drake {
15 namespace maliput {
16 namespace monolane {
18 /// A simple api::RoadGeometry implementation that only supports a single
19 /// lane per segment. Use the Builder interface to actually assemble
20 /// a sensible road network.
22  public:
25  /// Constructs an empty RoadGeometry with the specified tolerances.
26  RoadGeometry(const api::RoadGeometryId& id,
27  const double linear_tolerance,
28  const double angular_tolerance)
29  : id_(id),
30  linear_tolerance_(linear_tolerance),
31  angular_tolerance_(angular_tolerance) {}
33  /// Creates and adds a new Junction with the specified @p id.
36  /// Creates and adds a new BranchPoint with the specified @p id.
39  ~RoadGeometry() override = default;
41  private:
42  const api::RoadGeometryId do_id() const override { return id_; }
44  int do_num_junctions() const override { return junctions_.size(); }
46  const api::Junction* do_junction(int index) const override;
48  int do_num_branch_points() const override { return branch_points_.size(); }
50  const api::BranchPoint* do_branch_point(int index) const override;
52  const IdIndex& DoById() const override { return id_index_; }
54  // Returns a RoadPosition for a lane containing the provided `geo_position`.
55  // If there is no containing lane, the position is returned for the lane
56  // closest to the centerline curve. If `hint` is non-null, then the search is
57  // restricted to the `hint->lane` and lanes adjacent to `hint->lane`.
58  api::RoadPosition DoToRoadPosition(
59  const api::GeoPosition& geo_position,
60  const api::RoadPosition* hint,
61  api::GeoPosition* nearest_position,
62  double* distance) const override;
64  double do_linear_tolerance() const override { return linear_tolerance_; }
66  double do_angular_tolerance() const override { return angular_tolerance_; }
69  double linear_tolerance_{};
70  double angular_tolerance_{};
71  std::vector<std::unique_ptr<Junction>> junctions_;
72  std::vector<std::unique_ptr<BranchPoint>> branch_points_;
73  api::BasicIdIndex id_index_;
74 };
76 } // namespace monolane
77 } // namespace maliput
78 } // namespace drake
A simple api::RoadGeometry implementation that only supports a single lane per segment.
Definition: road_geometry.h:21
Junction * NewJunction(api::JunctionId id)
Creates and adds a new Junction with the specified id.
Definition: road_geometry.cc:44
A BranchPoint is a node in the network of a RoadGeometry at which Lanes connect to one another...
Definition: branch_point.h:67
Definition: bullet_model.cc:22
Basic general-purpose concrete implementation of the RoadGeometry::IdIndex interface.
Definition: basic_id_index.h:19
Abstract API for the geometry of a road network, including both the network topology and the geometry...
Definition: road_geometry.h:30
Abstract interface for a collection of methods which allow accessing objects in a RoadGeometry&#39;s obje...
Definition: road_geometry.h:170
TypeSpecificIdentifier< class BranchPoint > BranchPointId
Definition: branch_point.h:19
BranchPoint * NewBranchPoint(api::BranchPointId id)
Creates and adds a new BranchPoint with the specified id.
Definition: road_geometry.cc:54
double linear_tolerance() const
Returns the tolerance guaranteed for linear measurements (positions).
Definition: road_geometry.h:120
GeoPositionT< double > GeoPosition
Definition: lane_data.h:186
double angular_tolerance() const
Returns the tolerance guaranteed for angular measurements (orientations).
Definition: road_geometry.h:125
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:23
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
An implementation of api::BranchPoint.
Definition: branch_point.h:42
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...