Go to the documentation of this file.
1 #pragma once
3 #include <memory>
4 #include <vector>
14 namespace drake {
15 namespace maliput {
16 namespace multilane {
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  // Either if there is or not a containing lane, the position is returned for
56  // the lane whose centerline curve is closest to `geo_position`. In other
57  // words, for the lane whose LanePosition makes the r coordinate be the
58  // smallest. If `hint` is non-null, then the search is restricted to the
59  // `hint->lane` and lanes adjacent to `hint->lane`.
60  // TODO(agalbachicar) Take into account `h` coordinate to return by minimum
61  // `h` and then minimum `r`.
62  api::RoadPosition DoToRoadPosition(
63  const api::GeoPosition& geo_position,
64  const api::RoadPosition* hint,
65  api::GeoPosition* nearest_position,
66  double* distance) const override;
68  double do_linear_tolerance() const override { return linear_tolerance_; }
70  double do_angular_tolerance() const override { return angular_tolerance_; }
73  double linear_tolerance_{};
74  double angular_tolerance_{};
75  std::vector<std::unique_ptr<Junction>> junctions_;
76  std::vector<std::unique_ptr<BranchPoint>> branch_points_;
77  api::BasicIdIndex id_index_;
78 };
80 } // namespace multilane
81 } // namespace maliput
82 } // 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: 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
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: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
BranchPoint * NewBranchPoint(api::BranchPointId id)
Creates and adds a new BranchPoint with the specified id.
Definition: road_geometry.cc:112
Junction * NewJunction(api::JunctionId id)
Creates and adds a new Junction with the specified id.
Definition: road_geometry.cc:101
A simple api::RoadGeometry implementation that only supports a single lane per segment.
Definition: road_geometry.h:21
An api::Junction implementation.
Definition: junction.h:19
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...