Drake
lane.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 
9 
10 namespace drake {
11 namespace maliput {
12 namespace api {
13 
14 class BranchPoint;
15 class Segment;
16 class LaneEndSet;
17 
18 
21 
22 
32 class Lane {
33  public:
35 
36  virtual ~Lane() = default;
37 
39  const LaneId id() const { return do_id(); }
40 
42  const Segment* segment() const { return do_segment(); }
43 
45  int index() const { return do_index(); }
46 
53  const Lane* to_left() const { return do_to_left(); }
54 
61  const Lane* to_right() const { return do_to_right(); }
62 
67  double length() const { return do_length(); }
68 
73  RBounds lane_bounds(double s) const { return do_lane_bounds(s); }
74 
80  RBounds driveable_bounds(double s) const { return do_driveable_bounds(s); }
81 
86  HBounds elevation_bounds(double s, double r) const {
87  return do_elevation_bounds(s, r); }
88 
94  GeoPosition ToGeoPosition(const LanePosition& lane_pos) const {
95  return DoToGeoPosition(lane_pos);
96  }
97 
111  GeoPosition* nearest_point,
112  double* distance) const {
113  return DoToLanePosition(geo_position, nearest_point, distance);
114  }
115 
116  // TODO(maddog@tri.global) Method to convert LanePosition to that of
117  // another Lane. (Should assert that both
118  // lanes belong to same Segment.) It should look
119  // something like this:
120  // LanePosition ToOtherLane(const LanePosition& in_this_lane,
121  // const Lane* other_lane) const;
122 
126  Rotation GetOrientation(const LanePosition& lane_pos) const {
127  return DoGetOrientation(lane_pos);
128  }
129 
136  const IsoLaneVelocity& velocity) const {
137  return DoEvalMotionDerivatives(position, velocity);
138  }
139 
140  // TODO(maddog@tri.global) Design/implement this.
141  // void EvalSurfaceDerivatives(...) const { return do_(); }
142 
143 
145  const BranchPoint* GetBranchPoint(const LaneEnd::Which which_end) const {
146  return DoGetBranchPoint(which_end);
147  }
148 
153  const LaneEnd::Which which_end) const {
154  return DoGetConfluentBranches(which_end);
155  }
156 
160  const LaneEnd::Which which_end) const {
161  return DoGetOngoingBranches(which_end);
162  }
163 
168  // TODO(maddog@tri.global) The return type yearns to be
169  // const boost::optional<LaneEnd>&.
170  std::unique_ptr<LaneEnd> GetDefaultBranch(
171  const LaneEnd::Which which_end) const {
172  return DoGetDefaultBranch(which_end);
173  }
174 
175  protected:
176  Lane() = default;
177 
178  private:
183  virtual const LaneId do_id() const = 0;
184 
185  virtual const Segment* do_segment() const = 0;
186 
187  virtual int do_index() const = 0;
188 
189  virtual const Lane* do_to_left() const = 0;
190 
191  virtual const Lane* do_to_right() const = 0;
192 
193  virtual double do_length() const = 0;
194 
195  virtual RBounds do_lane_bounds(double s) const = 0;
196 
197  virtual RBounds do_driveable_bounds(double s) const = 0;
198 
199  virtual HBounds do_elevation_bounds(double s, double r) const = 0;
200 
201  virtual GeoPosition DoToGeoPosition(const LanePosition& lane_pos) const = 0;
202 
203  virtual LanePosition DoToLanePosition(const GeoPosition& geo_position,
204  GeoPosition* nearest_point,
205  double* distance) const = 0;
206 
207  virtual Rotation DoGetOrientation(const LanePosition& lane_pos) const = 0;
208 
209  virtual LanePosition DoEvalMotionDerivatives(
210  const LanePosition& position, const IsoLaneVelocity& velocity) const = 0;
211 
212  virtual const BranchPoint* DoGetBranchPoint(
213  const LaneEnd::Which which_end) const = 0;
214 
215  virtual const LaneEndSet* DoGetConfluentBranches(
216  const LaneEnd::Which which_end) const = 0;
217 
218  virtual const LaneEndSet* DoGetOngoingBranches(
219  const LaneEnd::Which which_end) const = 0;
220 
221  virtual std::unique_ptr<LaneEnd> DoGetDefaultBranch(
222  const LaneEnd::Which which_end) const = 0;
224 };
225 
226 } // namespace api
227 } // namespace maliput
228 } // namespace drake
std::unique_ptr< LaneEnd > GetDefaultBranch(const LaneEnd::Which which_end) const
Returns the default ongoing LaneEnd connected at which_end.
Definition: lane.h:170
Rotation GetOrientation(const LanePosition &lane_pos) const
Returns the rotation which expresses the orientation of the Lane-frame basis at lane_pos with respect...
Definition: lane.h:126
const BranchPoint * GetBranchPoint(const LaneEnd::Which which_end) const
Returns the lane&#39;s BranchPoint for the end specified by which_end.
Definition: lane.h:145
A position in 3-dimensional geographical Cartesian space, i.e., in the world frame, consisting of three components x, y, and z.
Definition: lane_data.h:128
A BranchPoint is a node in the network of a RoadGeometry at which Lanes connect to one another...
Definition: branch_point.h:66
LanePosition EvalMotionDerivatives(const LanePosition &position, const IsoLaneVelocity &velocity) const
Computes derivatives of LanePosition given a velocity vector velocity.
Definition: lane.h:135
double position
Definition: system_identification_test.cc:205
Definition: automotive_demo.cc:88
GeoPosition ToGeoPosition(const LanePosition &lane_pos) const
Returns the GeoPosition corresponding to the given LanePosition.
Definition: lane.h:94
const Lane * to_right() const
Returns a pointer to the adjacent Lane to the right of this Lane.
Definition: lane.h:61
const LaneId id() const
Returns the persistent identifier.
Definition: lane.h:39
const LaneEndSet * GetOngoingBranches(const LaneEnd::Which which_end) const
Returns the set of LaneEnd&#39;s which continue onward from this lane at the BranchPoint at which_end...
Definition: lane.h:159
const LaneEndSet * GetConfluentBranches(const LaneEnd::Which which_end) const
Returns the set of LaneEnd&#39;s which connect with this lane on the same side of the BranchPoint at whic...
Definition: lane.h:152
A set of LaneEnds.
Definition: branch_point.h:22
A Lane represents a lane of travel in a road network.
Definition: lane.h:32
Isometric velocity vector in a Lane-frame.
Definition: lane_data.h:242
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
HBounds elevation_bounds(double s, double r) const
Returns the elevation (h) bounds of the lane as a function of (s, r).
Definition: lane.h:86
const Segment * segment() const
Returns the Segment to which this Lane belongs.
Definition: lane.h:42
LanePosition ToLanePosition(const GeoPosition &geo_position, GeoPosition *nearest_point, double *distance) const
Determines the LanePosition corresponding to GeoPosition geo_position.
Definition: lane.h:110
Bounds in the lateral dimension (r component) of a Lane-frame, consisting of a pair of minimum and ma...
Definition: lane_data.h:274
A 3-dimensional rotation.
Definition: lane_data.h:53
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
Which
Labels for the endpoints of a Lane.
Definition: lane_data.h:25
A 3-dimensional position in a Lane-frame, consisting of three components:
Definition: lane_data.h:187
const Lane * to_left() const
Returns a pointer to the adjacent Lane to the left of this Lane.
Definition: lane.h:53
double length() const
Returns the arc-length of the Lane along its reference curve.
Definition: lane.h:67
virtual ~Lane()=default
RBounds driveable_bounds(double s) const
Returns the driveable lateral (r) bounds of the lane as a function of s.
Definition: lane.h:80
RBounds lane_bounds(double s) const
Returns the nominal lateral (r) bounds for the lane as a function of s.
Definition: lane.h:73
int r
Definition: rgbd_camera.cc:89
#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
Vector6< double > velocity
Definition: pose_smoother.cc:29
Provides careful macros to selectively enable or disable the special member functions for copy-constr...