Drake
road_geometry.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <limits>
4 #include <memory>
5 #include <vector>
6 
14 
15 namespace drake {
16 namespace maliput {
17 namespace dragway {
18 
19 /// Dragway's implementation of api::RoadGeometry.
20 ///
21 /// To understand the characteristics of the geometry, consult the
22 /// dragway::Segment and dragway::Lane detailed class overview docs.
23 class RoadGeometry final : public api::RoadGeometry {
24  public:
26 
27  /// Constructs a dragway RoadGeometry.
28  ///
29  /// @param[in] id The ID of this RoadGeometry. This can be any user-selectable
30  /// value.
31  ///
32  /// @param[in] num_lanes The number of lanes. This must be greater than zero.
33  ///
34  /// @param[in] length The length of the dragway.
35  ///
36  /// @param[in] lane_width The width of each lane.
37  ///
38  /// @param[in] shoulder_width The width of the shoulders on each side of the
39  /// road.
40  ///
41  /// @param[in] maximum_height The maximum height above the road surface
42  /// modelled by the RoadGeometry.
43  ///
44  /// @param[in] linear_tolerance The tolerance guaranteed for linear
45  /// measurements (positions).
46  ///
47  /// @param[in] angular_tolerance The tolerance guaranteed for angular
48  /// measurements (orientations).
49  ///
51  int num_lanes,
52  double length,
53  double lane_width,
54  double shoulder_width,
55  double maximum_height,
56  double linear_tolerance,
57  double angular_tolerance);
58 
59  ~RoadGeometry() final = default;
60 
61  private:
62  const api::RoadGeometryId do_id() const final { return id_; }
63 
64  int do_num_junctions() const final { return 1; }
65 
66  const api::Junction* do_junction(int index) const final;
67 
68  int do_num_branch_points() const final;
69 
70  const api::BranchPoint* do_branch_point(int index) const final;
71 
72  api::RoadPosition DoToRoadPosition(
73  const api::GeoPosition& geo_position,
74  const api::RoadPosition* hint,
75  api::GeoPosition* nearest_position,
76  double* distance) const final;
77 
78  double do_linear_tolerance() const final { return linear_tolerance_; }
79 
80  double do_angular_tolerance() const final { return angular_tolerance_; }
81 
82  // Returns true iff `geo_pos` is "on" the dragway. It is on the dragway iff
83  // `geo_pos.x` and `geo_pos.y` fall within the dragway's driveable region.
84  bool IsGeoPositionOnDragway(const api::GeoPosition& geo_pos) const;
85 
86  // Returns the index of the lane on which the provided `geo_pos` resides. This
87  // method requires that the provided `geo_pos` be on the dragway as determined
88  // by IsGeoPositionOnDragway().
89  int GetLaneIndex(const api::GeoPosition& geo_pos) const;
90 
91  const api::RoadGeometryId id_;
92  const double linear_tolerance_{};
93  const double angular_tolerance_{};
94  const Junction junction_;
95 };
96 
97 } // namespace dragway
98 } // namespace maliput
99 } // namespace drake
A BranchPoint is a node in the network of a RoadGeometry at which Lanes connect to one another...
Definition: branch_point.h:67
Definition: automotive_demo.cc:88
Abstract API for the geometry of a road network, including both the network topology and the geometry...
Definition: road_geometry.h:26
double linear_tolerance() const
Returns the tolerance guaranteed for linear measurements (positions).
Definition: road_geometry.h:110
GeoPositionT< double > GeoPosition
Definition: lane_data.h:178
double angular_tolerance() const
Returns the tolerance guaranteed for angular measurements (orientations).
Definition: road_geometry.h:115
TypeSpecificIdentifier< class RoadGeometry > RoadGeometryId
Persistent identifier for a RoadGeometry element.
Definition: road_geometry.h:19
Dragway&#39;s implementation of api::Junction.
Definition: junction.h:20
Dragway&#39;s implementation of api::RoadGeometry.
Definition: road_geometry.h:23
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
#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
A position in the road network, consisting of a pointer to a specific Lane and a Lane-frame position ...
Definition: lane_data.h:282
Provides careful macros to selectively enable or disable the special member functions for copy-constr...