Drake
line_lane.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 namespace drake {
7 namespace maliput {
8 namespace monolane {
9 
10 /// Specialization of Lane with a line segment as its reference curve
11 /// in the xy-plane (the ground plane) of the world frame.
12 class LineLane : public Lane {
13  public:
15 
16  /// Constructs a LineLane, a lane specified by a line segment defined in the
17  /// xy-plane (the ground plane) of the world frame.
18  ///
19  /// @param xy0 start point of the reference line segment
20  /// @param dxy displacement to the end point of the reference line segment
21  ///
22  /// @param id,segment,lane_bounds,driveable_bounds,elevation_bounds
23  /// See documentation for the Lane base class.
24  /// @param elevation,superelevation
25  /// See documentation for the Lane base class.
26  ///
27  /// N.B. The override LineLane::ToLanePosition() is currently restricted to
28  /// lanes in which superelevation and elevation change are both zero.
29  LineLane(const api::LaneId& id, const api::Segment* segment, const V2& xy0,
30  const V2& dxy, const api::RBounds& lane_bounds,
31  const api::RBounds& driveable_bounds,
32  const api::HBounds& elevation_bounds,
35  : Lane(id, segment,
36  lane_bounds, driveable_bounds, elevation_bounds,
37  dxy.norm(),
38  elevation, superelevation),
39  x0_(xy0.x()),
40  y0_(xy0.y()),
41  dx_(dxy.x()),
42  dy_(dxy.y()),
43  heading_(std::atan2(dy_, dx_)) {}
44 
45  ~LineLane() override = default;
46 
47  private:
48  // Computes the LanePosition from a given GeoPosition. This function is exact
49  // (to numerical precision) under the assumption that the road is flat
50  // (superelevation is everywhere zero and the elevation has zero gradient),
51  // and a close approximation for lanes exhibiting small elevation changes.
52  api::LanePosition DoToLanePosition(const api::GeoPosition& geo_position,
53  api::GeoPosition* nearest_position,
54  double* distance) const override;
55 
56  V2 xy_of_p(const double p) const override;
57  V2 xy_dot_of_p(const double p) const override;
58  double heading_of_p(const double p) const override;
59  double heading_dot_of_p(const double p) const override;
60 
61  const double x0_{};
62  const double y0_{};
63  const double dx_{};
64  const double dy_{};
65  const double heading_{}; // Memoized; derived from dy_, dx_.
66 };
67 
68 } // namespace monolane
69 } // namespace maliput
70 } // namespace drake
int y
Definition: rgbd_renderer_test.cc:33
A cubic polynomial, f(p) = a + b*p + c*p^2 + d*p^3.
Definition: lane.h:50
std::vector< Number > x
Definition: ipopt_solver.cc:150
const CubicPolynomial & superelevation() const
Definition: lane.h:204
Definition: automotive_demo.cc:88
Expression atan2(const Expression &e1, const Expression &e2)
Definition: symbolic_expression.cc:652
STL namespace.
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
const CubicPolynomial & elevation() const
Definition: lane.h:202
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:89
TypeSpecificIdentifier< class Lane > LaneId
Persistent identifier for a Lane element.
Definition: lane.h:22
const Segment * segment() const
Returns the Segment to which this Lane belongs.
Definition: lane.h:44
GeoPositionT< double > GeoPosition
Definition: lane_data.h:178
Base class for the monolane implementation of api::Lane.
Definition: lane.h:127
An api::Segment implementation.
Definition: segment.h:19
RBounds driveable_bounds(double s) const
Returns the driveable lateral (r) bounds of the lane as a function of s.
Definition: lane.h:83
RBounds lane_bounds(double s) const
Returns the nominal lateral (r) bounds for the lane as a function of s.
Definition: lane.h:75
#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...