Drake
lane.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 rndf {
14 
15 class BranchPoint;
16 
27 class Lane : public api::Lane {
28  public:
30 
31 
32  Lane(const api::LaneId& id, const api::Segment* segment, int index)
38  : id_(id), segment_(segment), index_(index) {}
39 
43  void SetStartBp(BranchPoint* bp) { start_bp_ = bp; }
44 
48  void SetEndBp(BranchPoint* bp) { end_bp_ = bp; }
49 
52  BranchPoint* start_bp() { return start_bp_; }
53 
56  BranchPoint* end_bp() { return end_bp_; }
57 
58  ~Lane() override = default;
59 
60  private:
61  const api::LaneId do_id() const override { return id_; }
62 
63  const api::Segment* do_segment() const override;
64 
65  int do_index() const override { return index_; }
66 
67  const api::Lane* do_to_left() const override {
68  if ((segment_->num_lanes() - 1) == index_) {
69  return nullptr;
70  }
71  return segment_->lane(index_ + 1);
72  }
73 
74  const api::Lane* do_to_right() const override {
75  if (index_ == 0) {
76  return nullptr;
77  }
78  return segment_->lane(index_ - 1);
79  }
80 
81  const api::BranchPoint* DoGetBranchPoint(
82  const api::LaneEnd::Which which_end) const override;
83 
84  const api::LaneEndSet* DoGetConfluentBranches(
85  const api::LaneEnd::Which which_end) const override;
86 
87  const api::LaneEndSet* DoGetOngoingBranches(
88  const api::LaneEnd::Which which_end) const override;
89 
90  std::unique_ptr<api::LaneEnd> DoGetDefaultBranch(
91  const api::LaneEnd::Which which_end) const override;
92 
93  const api::LaneId id_;
94  const api::Segment* segment_{};
95  BranchPoint* start_bp_{};
96  BranchPoint* end_bp_{};
97  const int index_{};
98 };
99 
100 } // namespace rndf
101 } // namespace maliput
102 } // namespace drake
BranchPoint * end_bp()
Getter of the BranchPoint set as ending.
Definition: lane.h:56
A BranchPoint is a node in the network of a RoadGeometry at which Lanes connect to one another...
Definition: branch_point.h:66
BranchPoint * start_bp()
Getter of the BranchPoint set as starting.
Definition: lane.h:52
Definition: automotive_demo.cc:88
~Lane() override=default
int num_lanes() const
Returns the number of Lanes contained in this Segment.
Definition: segment.h:42
A set of LaneEnds.
Definition: branch_point.h:22
A Lane represents a lane of travel in a road network.
Definition: lane.h:32
Base class for the RNDF implementation of api::Lane.
Definition: lane.h:27
int index() const
Returns the index of this Lane within the Segment which owns it.
Definition: lane.h:45
TypeSpecificIdentifier<T> represents an identifier specifically identifying an entity of type T...
Definition: type_specific_identifier.h:38
void SetStartBp(BranchPoint *bp)
Sets the pointer of the BranchPoint that contains a api::LaneEnd::Which::kStart value attached to thi...
Definition: lane.h:43
const Segment * segment() const
Returns the Segment to which this Lane belongs.
Definition: lane.h:42
A Segment represents a bundle of adjacent Lanes which share a continuously traversable road surface...
Definition: segment.h:27
const Lane * lane(int index) const
Returns the Lane indexed by index.
Definition: segment.h:51
Which
Labels for the endpoints of a Lane.
Definition: lane_data.h:25
An implementation of api::BranchPoint for RNDF.
Definition: branch_point.h:39
void SetEndBp(BranchPoint *bp)
Sets the pointer of the BranchPoint that contains a api::LaneEnd::Which::kFinish value attached to th...
Definition: lane.h:48
#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...