Drake
segment.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <utility>
5 
14 
15 namespace drake {
16 namespace maliput {
17 namespace multilane {
18 
19 class ArcLane;
20 class LineLane;
21 
23 class Segment : public api::Segment {
24  public:
26 
27 
28  Segment(const api::SegmentId& id,
39  std::unique_ptr<RoadCurve> road_curve)
40  : id_(id), junction_(junction), road_curve_(std::move(road_curve)) {
41  DRAKE_DEMAND(road_curve_.get() != nullptr);
42  }
43 
54  const api::RBounds& lane_bounds,
55  const api::RBounds& driveable_bounds,
56  const api::HBounds& elevation_bounds);
57 
58  ~Segment() override = default;
59 
60  private:
61  const api::SegmentId do_id() const override { return id_; }
62 
63  const api::Junction* do_junction() const override;
64 
65  int do_num_lanes() const override { return 1; }
66 
67  const api::Lane* do_lane(int index) const override;
68 
69  // Segment's ID.
70  api::SegmentId id_;
71  // Parent junction.
72  api::Junction* junction_{};
73  // Child Lane pointer.
74  std::unique_ptr<Lane> lane_;
75  // Reference trajectory over the Segment's surface.
76  std::unique_ptr<RoadCurve> road_curve_;
77 };
78 
79 } // namespace multilane
80 } // namespace maliput
81 } // namespace drake
Definition: automotive_demo.cc:88
Lane * NewLane(api::LaneId id, const api::RBounds &lane_bounds, const api::RBounds &driveable_bounds, const api::HBounds &elevation_bounds)
Creates a new Lane object.
Definition: segment.cc:11
Base class for the multilane implementation of api::Lane.
Definition: lane.h:51
A Lane represents a lane of travel in a road network.
Definition: lane.h:32
Definition: arc_road_curve.cc:11
TypeSpecificIdentifier<T> represents an identifier specifically identifying an entity of type T...
Definition: type_specific_identifier.h:38
const Junction * junction() const
Returns the Junction to which this Segment belongs.
Definition: segment.h:37
Provides Drake&#39;s assertion implementation.
#define DRAKE_DEMAND(condition)
Evaluates condition and iff the value is false will trigger an assertion failure with a message showi...
Definition: drake_assert.h:47
An api::Segment implementation.
Definition: segment.h:23
Bounds in the lateral dimension (r component) of a Lane-frame, consisting of a pair of minimum and ma...
Definition: lane_data.h:274
Bounds in the elevation dimension (h component) of a Lane-frame, consisting of a pair of minimum and ...
Definition: lane_data.h:309
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:35
Provides careful macros to selectively enable or disable the special member functions for copy-constr...