Drake
junction.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <vector>
5 
12 
13 namespace drake {
14 namespace maliput {
15 namespace multilane {
16 
17 /// An api::Junction implementation.
18 class Junction : public api::Junction {
19  public:
21 
22  /// Constructs an empty Junction.
23  ///
24  /// @p road_geometry must remain valid for the lifetime of this class,
25  /// and must refer to the RoadGeometry which will contain the newly
26  /// constructed Junction instance.
28  : id_(id), road_geometry_(road_geometry) {}
29 
30  /// Creates and adds a new Segment.
31  /// @param id Segment's ID.
32  /// @param road_curve Reference trajectory over the Segment's surface.
33  /// @param r_min Lateral distance to the minimum extent of road_curve's curve
34  /// from where Segment's surface starts.
35  /// @param r_max Lateral distance to the maximum extent of road_curve's curve
36  /// from where Segment's surface ends.
37  /// @param elevation_bounds The height bounds over the segment' surface.
38  /// @return A Segment object.
40  std::unique_ptr<RoadCurve> road_curve, double r_min,
41  double r_max, const api::HBounds& elevation_bounds);
42 
43  ~Junction() override = default;
44 
45  private:
46  const api::JunctionId do_id() const override { return id_; }
47 
48  const api::RoadGeometry* do_road_geometry() const override;
49 
50  int do_num_segments() const override { return segments_.size(); }
51 
52  const api::Segment* do_segment(int index) const override {
53  return segments_[index].get();
54  }
55 
56  api::JunctionId id_;
57  api::RoadGeometry* road_geometry_{};
58  std::vector<std::unique_ptr<Segment>> segments_;
59 };
60 
61 } // namespace multilane
62 } // namespace maliput
63 } // namespace drake
Definition: automotive_demo.cc:88
const RoadGeometry * road_geometry() const
Returns the RoadGeometry to which this Junction belongs.
Definition: junction.h:37
Segment * NewSegment(const api::SegmentId &id, std::unique_ptr< RoadCurve > road_curve, double r_min, double r_max, const api::HBounds &elevation_bounds)
Creates and adds a new Segment.
Definition: junction.cc:14
Abstract API for the geometry of a road network, including both the network topology and the geometry...
Definition: road_geometry.h:26
Definition: arc_road_curve.cc:11
An api::Segment implementation.
Definition: segment.h:24
TypeSpecificIdentifier< class Junction > JunctionId
Persistent identifier for a Junction element.
Definition: junction.h:17
Bounds in the elevation dimension (h component) of a Lane-frame, consisting of a pair of minimum and ...
Definition: lane_data.h:343
A Segment represents a bundle of adjacent Lanes which share a continuously traversable road surface...
Definition: segment.h:27
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
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
TypeSpecificIdentifier< class Segment > SegmentId
Persistent identifier for a Segment element.
Definition: segment.h:17
#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
Provides careful macros to selectively enable or disable the special member functions for copy-constr...