-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NoRoute for waypoints with low reachability edges #2914
Changes from 13 commits
6d35ea4
93047fb
da921a1
fa38583
409f89b
9604f6b
984c2b9
c05038c
2b7d88a
5f9702b
19bac23
9bbf322
2831573
bc63782
d42235a
efbae2f
ab2cb8a
ae50e3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -407,7 +407,7 @@ struct bin_handler_t { | |
auto opposing_edge_id = reader.GetOpposingEdgeId(candidate.edge_id, other_edge, other_tile); | ||
|
||
if (other_edge && costing->Allowed(other_edge, other_tile)) { | ||
auto reach = get_reach(opposing_edge_id, other_edge); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hahaha oops! thanks for removing the shadowing! |
||
reach = get_reach(opposing_edge_id, other_edge); | ||
PathLocation::PathEdge other_path_edge{opposing_edge_id, 1 - length_ratio, candidate.point, | ||
distance, flip_side(side), reach.outbound, | ||
reach.inbound}; | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "gurka.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: there is already a |
||
#include <gtest/gtest.h> | ||
|
||
using namespace valhalla; | ||
|
||
TEST(Reachability, dont_snap_waypoints_to_deadends) { | ||
const std::string ascii_map = R"( | ||
A--1-B-2--C | ||
/ \ | ||
D E)"; | ||
|
||
// BD and BE are oneways that lead away, and toward the main road A-B-C | ||
const gurka::ways ways = {{"AB", {{"highway", "primary"}}}, | ||
{"BC", {{"highway", "primary"}}}, | ||
{"BD", {{"highway", "secondary"}, {"oneway", "yes"}}}, | ||
{"BE", {{"highway", "secondary"}, {"oneway", "yes"}}}}; | ||
const auto layout = gurka::detail::map_to_coordinates(ascii_map, 25); | ||
|
||
std::unordered_map<std::string, std::string> config_opts = { | ||
{"mjolnir.concurrency", "1"}, | ||
{"loki.service_defaults.minimum_reachability", "3"}, | ||
}; | ||
|
||
auto map = gurka::buildtiles(layout, ways, {}, {}, "test/data/reachability", config_opts); | ||
|
||
{ | ||
// Verify simple waypoint routing works | ||
auto result1 = gurka::do_action(valhalla::Options::route, map, {"A", "1", "C"}, "auto", {}, {}, | ||
nullptr, "break_through"); | ||
gurka::assert::raw::expect_path(result1, {"AB", "AB", "AB", "BC"}); | ||
auto result2 = gurka::do_action(valhalla::Options::route, map, {"A", "2", "C"}, "auto", {}, {}, | ||
nullptr, "break_through"); | ||
gurka::assert::raw::expect_path(result2, {"AB", "BC", "BC"}); | ||
} | ||
{ | ||
// BD is a oneway leading away from ABC with no escape | ||
// input coordinate at D should get snapped to the ABC way | ||
// Should give the same result as A->1->C | ||
auto result = gurka::do_action(valhalla::Options::route, map, {"A", "D", "C"}, "auto", {}, {}, | ||
nullptr, "break_through"); | ||
gurka::assert::raw::expect_path(result, {"AB", "AB", "AB", "BC"}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are there three AB edges? im sure there is some detail i just cant remember at the moment... i get why there is one from A to the snap point at or near 1 and that then there is another for the next leg from that point to B but i cant figure out where the 3rd one is coming from at the moment. can you jog my memory? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ha, great question!) actually, the first
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think, this should be fixed in another PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interesting, we have a bit of code that is supposed to do this if i can remember where it is. it should say somethign like if its node snapped and its an origin no point in using the edge that is snapped to its end node... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the purpose is to ignore end node snaps for origins of the route unless that is all we have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/valhalla/valhalla/blob/master/src/thor/timedep_forward.cc#L432 - we also use this condition that just checks that origin and destination on the same edge. so , probably it's needless |
||
} | ||
{ | ||
// BE is a oneway leading towards ABC with no way in | ||
// input coordinate at E should get snapped to the ABC way | ||
// Should give the same result as A->2->C | ||
auto result = gurka::do_action(valhalla::Options::route, map, {"A", "E", "C"}, "auto", {}, {}, | ||
nullptr, "break_through"); | ||
gurka::assert::raw::expect_path(result, {"AB", "BC", "BC"}); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ | |
-j '{"costing":"pedestrian","locations":[{"lon":-122.42256,"heading":81,"lat":37.75679,"type":"break"},{"lat":37.75863,"lon":-122.41907,"heading":175,"type":"through"},{"lat":37.75543,"lon":-122.41877,"type":"break"}]}' | ||
-j '{"costing":"auto","locations":[{"lon":-122.42256,"heading":81,"lat":37.75679,"type":"break"},{"lat":37.75863,"lon":-122.41907,"heading":175,"type":"through"},{"lat":37.75543,"lon":-122.41877,"type":"break"}]}' | ||
-j '{"costing":"auto","locations":[{"lon":-122.42256,"heading":81,"lat":37.75679,"type":"break"},{"lat":37.75863,"lon":-122.41907,"heading":174,"heading_tolerance":60,"type":"through"},{"lat":37.75543,"lon":-122.41877,"type":"break"}]}' | ||
-j '{"costing":"auto","locations":[{"lat":38.245509,"lon":-85.75095,"type":"break"},{"lat":38.251,"lon":-85.763,"type":"through"},{"lat":38.258075,"lon":-85.744407,"type":"break"}]}' | ||
-j '{"costing":"auto","locations":[{"lat":52.027886,"lon":5.077448,"type":"break"},{"lat":52.030559,"lon":5.078592,"type":"through"},{"lat":52.030178,"lon":5.080847,"type":"through"},{"lat":52.025977,"lon":5.08614,"type":"break"}]}' | ||
-j '{"costing":"auto","locations":[{"lat":39.821226,"lon":-84.317642,"type":"break"},{"lat":39.828069,"lon":-84.314242,"type":"through"},{"lat":39.832658,"lon":-84.318762,"type":"through"},{"lat":39.828843,"lon":-84.323137,"type":"break"}]} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test routes that fail right now |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,13 @@ struct PathLocation : public Location { | |
*/ | ||
bool shares_edges(const PathLocation& other) const; | ||
|
||
/** | ||
* Check if path edge has high reachability for this location. | ||
* @param edge PathEdge that should be checked | ||
* @return true if the edge is high reachable | ||
*/ | ||
bool is_high_reachable(const PathEdge& edge) const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems this method is actually unused. we instead use the free function inside thor route_action There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will remove, thanks |
||
|
||
static void toPBF(const PathLocation& pl, valhalla::Location* l, baldr::GraphReader& reader) { | ||
l->mutable_ll()->set_lng(pl.latlng_.first); | ||
l->mutable_ll()->set_lat(pl.latlng_.second); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should be
is_highly_reachable
orhas_high_reach