Drake
segment.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
10 
11 namespace drake {
12 namespace maliput {
13 namespace monolane {
14 
15 class ArcLane;
16 class LineLane;
17 
18 /// An api::Segment implementation.
19 class Segment : public api::Segment {
20  public:
22 
23  /// Constructs a new Segment.
24  ///
25  /// The Segment is not fully initialized until one of NewLineLane()
26  /// or NewArcLane() is called exactly once. @p junction must remain
27  /// valid for the lifetime of this class.
28  Segment(const api::SegmentId& id, api::Junction* junction)
29  : id_(id), junction_(junction) {}
30 
31  /// Gives the segment a newly constructed LineLane.
33  const V2& xy0, const V2& dxy,
34  const api::RBounds& lane_bounds,
35  const api::RBounds& driveable_bounds,
36  const api::HBounds& elevation_bounds,
37  const CubicPolynomial& elevation,
38  const CubicPolynomial& superelevation);
39 
40  /// Gives the segment a newly constructed ArcLane.
42  const V2& center, const double radius,
43  const double theta0, const double d_theta,
44  const api::RBounds& lane_bounds,
45  const api::RBounds& driveable_bounds,
46  const api::HBounds& elevation_bounds,
47  const CubicPolynomial& elevation,
48  const CubicPolynomial& superelevation);
49 
50  ~Segment() override = default;
51 
52  private:
53  const api::SegmentId do_id() const override { return id_; }
54 
55  const api::Junction* do_junction() const override;
56 
57  int do_num_lanes() const override { return 1; }
58 
59  const api::Lane* do_lane(int index) const override;
60 
61  api::SegmentId id_;
62  api::Junction* junction_{};
63  std::unique_ptr<Lane> lane_;
64 };
65 
66 } // namespace monolane
67 } // namespace maliput
68 } // namespace drake
A cubic polynomial, f(p) = a + b*p + c*p^2 + d*p^3.
Definition: lane.h:50
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:88
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:36
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:34
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
Bounds in the lateral dimension (r component) of a Lane-frame, consisting of a pair of minimum and ma...
Definition: lane_data.h:298
An api::Segment implementation.
Definition: segment.h:19
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
An api::Junction implementation.
Definition: junction.h:17
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