Drake
road_geometry.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <vector>
5 
13 
14 namespace drake {
15 namespace maliput {
16 namespace multilane {
17 
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:
24 
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) {}
32 
33  /// Creates and adds a new Junction with the specified @p id.
35 
36  /// Creates and adds a new BranchPoint with the specified @p id.
38 
39  ~RoadGeometry() override = default;
40 
41  private:
42  const api::RoadGeometryId do_id() const override { return id_; }
43 
44  int do_num_junctions() const override { return junctions_.size(); }
45 
46  const api::Junction* do_junction(int index) const override;
47 
48  int do_num_branch_points() const override { return branch_points_.size(); }
49 
50  const api::BranchPoint* do_branch_point(int index) const override;
51 
52  const IdIndex& DoById() const override { return id_index_; }
53 
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  api::RoadPosition DoToRoadPosition(
61  const api::GeoPosition& geo_position,
62  const api::RoadPosition* hint,
63  api::GeoPosition* nearest_position,
64  double* distance) const override;
65 
66  double do_linear_tolerance() const override { return linear_tolerance_; }
67 
68  double do_angular_tolerance() const override { return angular_tolerance_; }
69 
71  double linear_tolerance_{};
72  double angular_tolerance_{};
73  std::vector<std::unique_ptr<Junction>> junctions_;
74  std::vector<std::unique_ptr<BranchPoint>> branch_points_;
75  api::BasicIdIndex id_index_;
76 };
77 
78 } // namespace multilane
79 } // namespace maliput
80 } // 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
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:99
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:21
An api::Junction implementation.
Definition: junction.h:19
#define DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Classname)
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...