forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonolane_onramp_merge.h
75 lines (61 loc) · 2.45 KB
/
monolane_onramp_merge.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
#include <cmath>
#include <memory>
#include "drake/automotive/maliput/api/road_geometry.h"
#include "drake/automotive/maliput/monolane/builder.h"
namespace drake {
namespace automotive {
/// RoadCharacteristics computes and stores characteristics of a road network;
/// i.e. bounds on the lane width and driveable width. Default settings are
/// taken if no others are specified.
struct RoadCharacteristics {
/// Constructor for using default road geometries.
RoadCharacteristics() = default;
/// Constructor for custom road geometries.
RoadCharacteristics(const double lw, const double dw)
: lane_width(lw), driveable_width(dw) {}
const double lane_width{4.};
const double driveable_width{8.};
const maliput::api::RBounds lane_bounds{-lane_width / 2., lane_width / 2.};
const maliput::api::RBounds driveable_bounds{-driveable_width / 2.,
driveable_width / 2.};
const maliput::api::HBounds elevation_bounds{0., 5.2};
};
/// MonolaneOnrampMerge contains an example lane-merge scenario expressed as a
/// maliput monolane road geometry. The intent of this class is to enable easy
/// creation and modification of road geometries for simulating/analyzing
/// such scenarios.
///
/// Implements the following onramp example, where each road section is composed
/// of sequences of linear and arc primitives:
///
/// <pre>
/// pre-merge post-merge
/// road road
/// |------>-------+------>-------|
/// /
/// /
/// onramp /
/// ^
/// |
/// |
/// _
/// </pre>
class MonolaneOnrampMerge {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(MonolaneOnrampMerge)
/// Constructor for the example. The user supplies @p rc, a
/// RoadCharacteristics structure that aggregates the road boundary data.
explicit MonolaneOnrampMerge(const RoadCharacteristics& rc) : rc_(rc) {}
/// Constructor for the example, using default RoadCharacteristics settings.
MonolaneOnrampMerge() : MonolaneOnrampMerge(RoadCharacteristics{}) {}
/// Implements the onramp example.
std::unique_ptr<const maliput::api::RoadGeometry> BuildOnramp();
private:
/// Tolerances for monolane's Builder.
const double linear_tolerance_ = 0.01;
const double angular_tolerance_ = 0.01 * M_PI;
const RoadCharacteristics rc_;
};
} // namespace automotive
} // namespace drake