Drake
segment.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 #include <memory>
5 
11 
12 namespace drake {
13 namespace maliput {
14 namespace monolane {
15 
16 class ArcLane;
17 class LineLane;
18 
19 /// An api::Segment implementation.
20 class Segment : public api::Segment {
21  public:
23 
24  /// Constructs a new Segment.
25  ///
26  /// The Segment is not fully initialized until one of NewLineLane()
27  /// or NewArcLane() is called exactly once. @p junction must remain
28  /// valid for the lifetime of this class.
29  ///
30  /// @p register_lane will be called on any new Lane instance created as
31  /// a child of the Segment.
33  const std::function<void(const api::Lane*)>& register_lane)
34  : id_(id), junction_(junction), register_lane_(register_lane) {}
35 
36  /// Gives the segment a newly constructed LineLane.
38  const V2& xy0, const V2& dxy,
39  const api::RBounds& lane_bounds,
40  const api::RBounds& driveable_bounds,
42  const CubicPolynomial& elevation,
43  const CubicPolynomial& superelevation);
44 
45  /// Gives the segment a newly constructed ArcLane.
47  const V2& center, const double radius,
48  const double theta0, const double d_theta,
49  const api::RBounds& lane_bounds,
50  const api::RBounds& driveable_bounds,
51  const api::HBounds& elevation_bounds,
52  const CubicPolynomial& elevation,
53  const CubicPolynomial& superelevation);
54 
55  ~Segment() override = default;
56 
57  private:
58  const api::SegmentId do_id() const override { return id_; }
59 
60  const api::Junction* do_junction() const override;
61 
62  int do_num_lanes() const override { return 1; }
63 
64  const api::Lane* do_lane(int index) const override;
65 
66  api::SegmentId id_;
67  const api::Junction* junction_{};
68  std::function<void(const api::Lane*)> register_lane_;
69  std::unique_ptr<Lane> lane_;
70 };
71 
72 } // namespace monolane
73 } // namespace maliput
74 } // namespace drake
A cubic polynomial, f(p) = a + b*p + c*p^2 + d*p^3.
Definition: lane.h:54
LineLane * NewLineLane(api::LaneId id, const V2 &xy0, const V2 &dxy, const api::RBounds &lane_bounds, const api::RBounds &driveable_bounds, const api::HBounds &elevation_bounds, const CubicPolynomial &elevation, const CubicPolynomial &superelevation)
Gives the segment a newly constructed LineLane.
Definition: segment.cc:18
Definition: automotive_demo.cc:90
ArcLane * NewArcLane(api::LaneId id, const V2 &center, const double radius, const double theta0, const double d_theta, const api::RBounds &lane_bounds, const api::RBounds &driveable_bounds, const api::HBounds &elevation_bounds, const CubicPolynomial &elevation, const CubicPolynomial &superelevation)
Gives the segment a newly constructed ArcLane.
Definition: segment.cc:37
Vector2< double > V2
Definition: lane.h:21
Specialization of Lane with a line segment as its reference curve in the xy-plane (the ground plane) ...
Definition: line_lane.h:12
A Lane represents a lane of travel in a road network.
Definition: lane.h:35
const Junction * junction() const
Returns the Junction to which this Segment belongs.
Definition: segment.h:37
const api::HBounds elevation_bounds
Definition: multilane_line_road_curve_test.cc:34
Segment(const api::SegmentId &id, const api::Junction *junction, const std::function< void(const api::Lane *)> &register_lane)
Constructs a new Segment.
Definition: segment.h:32
Bounds in the lateral dimension (r component) of a Lane-frame, consisting of a pair of minimum and ma...
Definition: lane_data.h:315
An api::Segment implementation.
Definition: segment.h:20
Bounds in the elevation dimension (h component) of a Lane-frame, consisting of a pair of minimum and ...
Definition: lane_data.h:360
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
Provides careful macros to selectively enable or disable the special member functions for copy-constr...
Specialization of Lane with a circular arc as its reference curve in the xy-plane (the ground plane) ...
Definition: arc_lane.h:15