Drake
segment.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <utility>
5 #include <vector>
6 
13 
14 namespace drake {
15 namespace maliput {
16 namespace dragway {
17 
18 class Junction;
19 
20 /**
21  Dragway's implementation of api::Segment. It contains multiple straight
22  lanes. For the lane semantics, see the class descriptions of Lane.
23 
24  The following ASCII art shows how N lanes are arranged in a segment.
25 
26  <pre>
27 
28  lane_bounds --- X -------- lane index 1
29  | ^ |
30  lane index n --- | | | --- lane index 0
31  | | | | |
32  V |<->| | V V
33  -------------------------------------
34  | | : | : | : | : | : | : | : | : | |
35  | | : | : | : | : | : | : | : | : | |
36  | | : | : | : | : | : | : | : | : | |
37  | | : | : | : | : | : | : | : | : | |
38  | | : | : | : | : | : | : | : | : | |
39  | | : | : | : | : | : | : | : | : | |
40  Y <-----------------------------o----------------------------->
41  ^ | ^ ^
42  | | | |
43  y_max | | y_min
44  | |
45  V --- y offset of lane 0
46 
47  |<--------------------------------->|
48  road_width
49 
50  </pre>
51 
52  Note that lane indices increase to the left, which matches the fact that
53  within a Lane, `r` increases to the left.
54 **/
55 class Segment final : public api::Segment {
56  public:
58 
59  /// Constructs a new dragway Segment.
60  ///
61  /// @param[in] junction The junction to which this Segment belongs.
62  ///
63  /// @param[in] num_lanes The number of lanes in the segment.
64  ///
65  /// @param[in] length The length of the dragway.
66  ///
67  /// @param[in] lane_width The width of each lane.
68  ///
69  /// @param[in] shoulder_width The width of the shoulders on each side of the
70  /// road.
71  ///
72  /// @param[in] maximum_height The maximum height above the road surface.
73  /// modelled by the RoadGeometry.
75  int num_lanes,
76  double length,
77  double lane_width,
78  double shoulder_width,
79  double maximum_height);
80 
81  ~Segment() final = default;
82 
83  private:
84  const api::SegmentId do_id() const final { return id_; }
85 
86  const api::Junction* do_junction() const final;
87 
88  int do_num_lanes() const final { return static_cast<int>(lanes_.size()); }
89 
90  const api::Lane* do_lane(int index) const final;
91 
92  const api::SegmentId id_;
93  const Junction* junction_{};
94  std::vector<std::unique_ptr<Lane>> lanes_;
95 };
96 
97 } // namespace dragway
98 } // namespace maliput
99 } // namespace drake
Definition: automotive_demo.cc:88
int num_lanes() const
Returns the number of Lanes contained in this Segment.
Definition: segment.h:42
A Lane represents a lane of travel in a road network.
Definition: lane.h:34
const Junction * junction() const
Returns the Junction to which this Segment belongs.
Definition: segment.h:37
Dragway&#39;s implementation of api::Junction.
Definition: junction.h:20
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
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
Dragway&#39;s implementation of api::Segment.
Definition: segment.h:55
Provides careful macros to selectively enable or disable the special member functions for copy-constr...