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