forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Express characteristic scale length concept in api::RoadGeometry (Rob…
…otLocomotion#9306) * Express characteristic scale length concept in api::RoadGeometry
- Loading branch information
Matt Marjanović
authored
Sep 21, 2018
1 parent
4e555ca
commit be184ed
Showing
13 changed files
with
93 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,12 @@ class RoadGeometry { | |
return do_angular_tolerance(); | ||
} | ||
|
||
// TODO([email protected]) Needs a precise mathematical definition. | ||
/// Returns the characteristic scale length expressed by this RoadGeometry. | ||
double scale_length() const { | ||
return do_scale_length(); | ||
} | ||
|
||
/// Verifies certain invariants guaranteed by the API. | ||
/// | ||
/// Returns a vector of strings describing violations of invariants. | ||
|
@@ -160,6 +166,8 @@ class RoadGeometry { | |
virtual double do_linear_tolerance() const = 0; | ||
|
||
virtual double do_angular_tolerance() const = 0; | ||
|
||
virtual double do_scale_length() const = 0; | ||
///@} | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,13 @@ RoadGeometry::RoadGeometry(const api::RoadGeometryId& id, | |
: id_(id), | ||
linear_tolerance_(linear_tolerance), | ||
angular_tolerance_(angular_tolerance), | ||
// Dragway is completely flat and featureless, so the scale-length might | ||
// as well be any value that characterizes its overall size. | ||
// TODO([email protected]) If this code is ever re-arranged in a way that | ||
// makes it possible to query the segment for its | ||
// `road_width`, then use the max of length and | ||
// width. | ||
scale_length_(length), | ||
junction_(this, num_lanes, length, | ||
lane_width, shoulder_width, maximum_height) { | ||
DRAKE_DEMAND(length > 0); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,12 @@ class RoadGeometry : public api::RoadGeometry { | |
|
||
double do_angular_tolerance() const override { return angular_tolerance_; } | ||
|
||
// TODO([email protected]) monolane is not scale_length aware in any way, | ||
// and really this property should be consistent | ||
// with the geometry of the curves themselves. | ||
// This value of 1 has been picked arbitrarily. | ||
double do_scale_length() const override { return 1.; } | ||
|
||
api::RoadGeometryId id_; | ||
double linear_tolerance_{}; | ||
double angular_tolerance_{}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,13 +22,16 @@ class RoadGeometry : public api::RoadGeometry { | |
public: | ||
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(RoadGeometry) | ||
|
||
/// Constructs an empty RoadGeometry with the specified tolerances. | ||
/// Constructs an empty RoadGeometry with the specified tolerances and | ||
/// scale-length. | ||
RoadGeometry(const api::RoadGeometryId& id, | ||
const double linear_tolerance, | ||
const double angular_tolerance) | ||
double linear_tolerance, | ||
double angular_tolerance, | ||
double scale_length) | ||
: id_(id), | ||
linear_tolerance_(linear_tolerance), | ||
angular_tolerance_(angular_tolerance) {} | ||
angular_tolerance_(angular_tolerance), | ||
scale_length_(scale_length) {} | ||
|
||
/// Creates and adds a new Junction with the specified @p id. | ||
Junction* NewJunction(api::JunctionId id); | ||
|
@@ -69,9 +72,15 @@ class RoadGeometry : public api::RoadGeometry { | |
|
||
double do_angular_tolerance() const override { return angular_tolerance_; } | ||
|
||
// TODO([email protected]) scale_length should really be kept consistent | ||
// with the geometry of the curves themselves, | ||
// perhaps even derived from the curves directly. | ||
double do_scale_length() const override { return scale_length_; } | ||
|
||
api::RoadGeometryId id_; | ||
double linear_tolerance_{}; | ||
double angular_tolerance_{}; | ||
double scale_length_{}; | ||
std::vector<std::unique_ptr<Junction>> junctions_; | ||
std::vector<std::unique_ptr<BranchPoint>> branch_points_; | ||
api::BasicIdIndex id_index_; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,12 @@ class RoadGeometry : public api::RoadGeometry { | |
api::GeoPosition* nearest_position, | ||
double* distance) const override; | ||
|
||
// TODO([email protected]) rndf backend is not scale_length aware in any way, | ||
// and really this property should be consistent | ||
// with the geometry of the curves themselves. | ||
// This value of 1 has been picked arbitrarily. | ||
double do_scale_length() const override { return 1.; } | ||
|
||
double do_linear_tolerance() const override { return linear_tolerance_; } | ||
|
||
double do_angular_tolerance() const override { return angular_tolerance_; } | ||
|