reduce number of end-of-road instructions in unnecessary cases
This commit is contained in:
parent
8693e68271
commit
2a05b70dfc
@ -525,9 +525,9 @@ Feature: Collapse
|
|||||||
| cf | secondary | bottom |
|
| cf | secondary | bottom |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | turns | route |
|
| waypoints | turns | route |
|
||||||
| a,d | depart,continue right,end of road right,arrive | road,road,road,road |
|
| a,d | depart,continue right,turn right,arrive | road,road,road,road |
|
||||||
| d,a | depart,continue left,end of road left,arrive | road,road,road,road |
|
| d,a | depart,continue left,turn left,arrive | road,road,road,road |
|
||||||
|
|
||||||
Scenario: Forking before a turn
|
Scenario: Forking before a turn
|
||||||
Given the node map
|
Given the node map
|
||||||
|
@ -8,116 +8,123 @@ Feature: End Of Road Instructions
|
|||||||
Scenario: End of Road with through street
|
Scenario: End of Road with through street
|
||||||
Given the node map
|
Given the node map
|
||||||
| | | c |
|
| | | c |
|
||||||
| a | | b |
|
| a | e | b |
|
||||||
| | | d |
|
| | f | d |
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | highway |
|
| nodes | highway |
|
||||||
| ab | primary |
|
| aeb | primary |
|
||||||
| cbd | primary |
|
| cbd | primary |
|
||||||
|
| ef | primary |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,c | ab,cbd,cbd | depart,end of road left,arrive |
|
| a,c | aeb,cbd,cbd | depart,end of road left,arrive |
|
||||||
| a,d | ab,cbd,cbd | depart,end of road right,arrive |
|
| a,d | aeb,cbd,cbd | depart,end of road right,arrive |
|
||||||
|
|
||||||
Scenario: End of Road with three streets
|
Scenario: End of Road with three streets
|
||||||
Given the node map
|
Given the node map
|
||||||
| | | c |
|
| | | c |
|
||||||
| a | | b |
|
| a | e | b |
|
||||||
| | | d |
|
| | f | d |
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | highway |
|
| nodes | highway |
|
||||||
| ab | primary |
|
| aeb | primary |
|
||||||
| cb | primary |
|
| cb | primary |
|
||||||
| bd | primary |
|
| bd | primary |
|
||||||
|
| ef | primary |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,c | ab,cb,cb | depart,end of road left,arrive |
|
| a,c | aeb,cb,cb | depart,end of road left,arrive |
|
||||||
| a,d | ab,bd,bd | depart,end of road right,arrive |
|
| a,d | aeb,bd,bd | depart,end of road right,arrive |
|
||||||
|
|
||||||
Scenario: End of Road with three streets, slightly angled
|
Scenario: End of Road with three streets, slightly angled
|
||||||
Given the node map
|
Given the node map
|
||||||
| a | | | | | c |
|
| a | e | | | | c |
|
||||||
| | | | | | b |
|
| | f | | | | b |
|
||||||
| | | | | | d |
|
| | | | | | d |
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | highway |
|
| nodes | highway |
|
||||||
| ab | primary |
|
| aeb | primary |
|
||||||
| cb | primary |
|
| cb | primary |
|
||||||
| bd | primary |
|
| bd | primary |
|
||||||
|
| ef | primary |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,c | ab,cb,cb | depart,end of road left,arrive |
|
| a,c | aeb,cb,cb | depart,end of road left,arrive |
|
||||||
| a,d | ab,bd,bd | depart,end of road right,arrive |
|
| a,d | aeb,bd,bd | depart,end of road right,arrive |
|
||||||
|
|
||||||
Scenario: End of Road with three streets, slightly angled
|
Scenario: End of Road with three streets, slightly angled
|
||||||
Given the node map
|
Given the node map
|
||||||
| | | | | | c |
|
| | | | | | c |
|
||||||
| | | | | | b |
|
| | f | | | | b |
|
||||||
| a | | | | | d |
|
| a | e | | | | d |
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | highway |
|
| nodes | highway |
|
||||||
| ab | primary |
|
| aeb | primary |
|
||||||
|
| ef | primary |
|
||||||
| cb | primary |
|
| cb | primary |
|
||||||
| bd | primary |
|
| bd | primary |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,c | ab,cb,cb | depart,end of road left,arrive |
|
| a,c | aeb,cb,cb | depart,end of road left,arrive |
|
||||||
| a,d | ab,bd,bd | depart,end of road right,arrive |
|
| a,d | aeb,bd,bd | depart,end of road right,arrive |
|
||||||
|
|
||||||
Scenario: End of Road with through street, slightly angled
|
Scenario: End of Road with through street, slightly angled
|
||||||
Given the node map
|
Given the node map
|
||||||
| a | | | | | c |
|
| a | e | | | | c |
|
||||||
| | | | | | b |
|
| | f | | | | b |
|
||||||
| | | | | | d |
|
| | | | | | d |
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | highway |
|
| nodes | highway |
|
||||||
| ab | primary |
|
| aeb | primary |
|
||||||
|
| ef | primary |
|
||||||
| cbd | primary |
|
| cbd | primary |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,c | ab,cbd,cbd | depart,end of road left,arrive |
|
| a,c | aeb,cbd,cbd | depart,end of road left,arrive |
|
||||||
| a,d | ab,cbd,cbd | depart,end of road right,arrive |
|
| a,d | aeb,cbd,cbd | depart,end of road right,arrive |
|
||||||
|
|
||||||
Scenario: End of Road with through street, slightly angled
|
Scenario: End of Road with through street, slightly angled
|
||||||
Given the node map
|
Given the node map
|
||||||
| | | | | | c |
|
| | | | | | c |
|
||||||
| | | | | | b |
|
| | f | | | | b |
|
||||||
| a | | | | | d |
|
| a | e | | | | d |
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | highway |
|
| nodes | highway |
|
||||||
| ab | primary |
|
| aeb | primary |
|
||||||
|
| ef | primary |
|
||||||
| cbd | primary |
|
| cbd | primary |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,c | ab,cbd,cbd | depart,end of road left,arrive |
|
| a,c | aeb,cbd,cbd | depart,end of road left,arrive |
|
||||||
| a,d | ab,cbd,cbd | depart,end of road right,arrive |
|
| a,d | aeb,cbd,cbd | depart,end of road right,arrive |
|
||||||
|
|
||||||
Scenario: End of Road with two ramps - prefer ramp over end of road
|
Scenario: End of Road with two ramps - prefer ramp over end of road
|
||||||
Given the node map
|
Given the node map
|
||||||
| | | c |
|
| | | c |
|
||||||
| a | | b |
|
| a | e | b |
|
||||||
| | | d |
|
| | f | d |
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | highway |
|
| nodes | highway |
|
||||||
| ab | primary |
|
| aeb | primary |
|
||||||
|
| ef | primary |
|
||||||
| bc | motorway_link |
|
| bc | motorway_link |
|
||||||
| bd | motorway_link |
|
| bd | motorway_link |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| a,c | ab,bc,bc | depart,on ramp left,arrive |
|
| a,c | aeb,bc,bc | depart,on ramp left,arrive |
|
||||||
| a,d | ab,bd,bd | depart,on ramp right,arrive |
|
| a,d | aeb,bd,bd | depart,on ramp right,arrive |
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ Feature: Intersections Data
|
|||||||
| bd | corner |
|
| bd | corner |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | intersections |
|
| waypoints | route | intersections |
|
||||||
| a,c | through,through | depart,arrive | true:90,true:90 true:180 false:270;true:270 |
|
| a,c | through,through | true:90,true:90 true:180 false:270;true:270 |
|
||||||
|
|
||||||
Scenario: Passing Three Way North
|
Scenario: Passing Three Way North
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -32,8 +32,8 @@ Feature: Intersections Data
|
|||||||
| bd | corner |
|
| bd | corner |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | intersections |
|
| waypoints | route | intersections |
|
||||||
| a,c | through,through | depart,arrive | true:90,true:0 true:90 false:270;true:270 |
|
| a,c | through,through | true:90,true:0 true:90 false:270;true:270 |
|
||||||
|
|
||||||
Scenario: Passing Oneway Street In
|
Scenario: Passing Oneway Street In
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -47,8 +47,8 @@ Feature: Intersections Data
|
|||||||
| db | corner | yes |
|
| db | corner | yes |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | intersections |
|
| waypoints | route | intersections |
|
||||||
| a,c | through,through | depart,arrive | true:90,false:0 true:90 false:270;true:270 |
|
| a,c | through,through | true:90,false:0 true:90 false:270;true:270 |
|
||||||
|
|
||||||
Scenario: Passing Oneway Street Out
|
Scenario: Passing Oneway Street Out
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -62,8 +62,8 @@ Feature: Intersections Data
|
|||||||
| bd | corner | yes |
|
| bd | corner | yes |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | intersections |
|
| waypoints | route | intersections |
|
||||||
| a,c | through,through | depart,arrive | true:90,true:0 true:90 false:270;true:270 |
|
| a,c | through,through | true:90,true:0 true:90 false:270;true:270 |
|
||||||
|
|
||||||
Scenario: Passing Two Intersections
|
Scenario: Passing Two Intersections
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -80,27 +80,8 @@ Feature: Intersections Data
|
|||||||
| cf | corner |
|
| cf | corner |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | intersections |
|
| waypoints | route | intersections |
|
||||||
| a,d | through,through | depart,arrive | true:90,true:0 true:90 false:270,true:90 true:180 false:270;true:270 |
|
| a,d | through,through | true:90,true:0 true:90 false:270,true:90 true:180 false:270;true:270 |
|
||||||
|
|
||||||
Scenario: Regression test #2424
|
|
||||||
Given the node map
|
|
||||||
| | | e | | | | | | i | | | | |
|
|
||||||
| a | | b | | c | | d | | h | | k | | m |
|
|
||||||
| | | | | f | | | | | | l | | |
|
|
||||||
|
|
||||||
And the ways
|
|
||||||
| nodes | name |
|
|
||||||
| abcd | Fritz-Elsas-Straße |
|
|
||||||
| hkm | Fritz-Elsas-Straße |
|
|
||||||
| dhi | Martin-Luther-Straße |
|
|
||||||
| be | corner |
|
|
||||||
| kl | corner |
|
|
||||||
| cf | corner |
|
|
||||||
|
|
||||||
When I route I should get
|
|
||||||
| waypoints | route | turns |
|
|
||||||
| a,m | Fritz-Elsas-Straße,Fritz-Elsas-Straße| depart,arrive |
|
|
||||||
|
|
||||||
Scenario: Passing Two Intersections, Collapsing
|
Scenario: Passing Two Intersections, Collapsing
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -117,9 +98,9 @@ Feature: Intersections Data
|
|||||||
| cf | corner |
|
| cf | corner |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | intersections |
|
| waypoints | route | intersections |
|
||||||
| a,d | through,through | depart,arrive | true:90,true:0 true:90 false:270,true:90 true:180 false:270;true:270 |
|
| a,d | through,through | true:90,true:0 true:90 false:270,true:90 true:180 false:270;true:270 |
|
||||||
| f,a | corner,through,through | depart,end of road left,arrive | true:0;true:90 false:180 true:270,true:0 false:90 true:270;true:90 |
|
| f,a | corner,through,through | true:0;true:90 false:180 true:270,true:0 false:90 true:270;true:90 |
|
||||||
|
|
||||||
Scenario: Roundabouts
|
Scenario: Roundabouts
|
||||||
Given the node map
|
Given the node map
|
||||||
@ -144,10 +125,10 @@ Feature: Intersections Data
|
|||||||
| hd | |
|
| hd | |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | intersections |
|
| waypoints | route | intersections |
|
||||||
| e,f | ea,fb,fb | depart,abcda-exit-1,arrive | true:180;false:0 false:150 true:210,false:30 true:150 true:270;true:90 |
|
| e,f | ea,fb,fb | true:180;false:0 false:150 true:210,false:30 true:150 true:270;true:90 |
|
||||||
| e,g | ea,gc,gc | depart,abcda-exit-2,arrive | true:180;false:0 false:150 true:210,false:30 true:150 true:270,true:30 true:180 false:330;true:0 |
|
| e,g | ea,gc,gc | true:180;false:0 false:150 true:210,false:30 true:150 true:270,true:30 true:180 false:330;true:0 |
|
||||||
| e,h | ea,hd,hd | depart,abcda-exit-3,arrive | true:180;false:0 false:150 true:210,false:30 true:150 true:270,true:30 true:180 false:330,true:90 false:210 true:330;true:270 |
|
| e,h | ea,hd,hd | true:180;false:0 false:150 true:210,false:30 true:150 true:270,true:30 true:180 false:330,true:90 false:210 true:330;true:270 |
|
||||||
| e,2 | ea,abcda,abcda | depart,abcda-exit-undefined,arrive | true:180;false:0 false:150 true:210,false:30 true:150 true:270;true:327 +-1 |
|
| e,2 | ea,abcda,abcda | true:180;false:0 false:150 true:210,false:30 true:150 true:270;true:327 +-1 |
|
||||||
| 1,g | abcda,gc,gc | depart,abcda-exit-2,arrive | true:214;false:30 true:150 true:270,true:30 true:180 false:330;true:0 |
|
| 1,g | abcda,gc,gc | true:214;false:30 true:150 true:270,true:30 true:180 false:330;true:0 |
|
||||||
| 1,3 | abcda,abcda | depart,arrive | true:214,false:30 true:150 true:270,true:30 true:180 false:330;true:214 |
|
| 1,3 | abcda,abcda | true:214,false:30 true:150 true:270,true:30 true:180 false:330;true:214 |
|
||||||
|
22
features/guidance/post-processing.feature
Normal file
22
features/guidance/post-processing.feature
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
@routing @guidance @post-processing
|
||||||
|
Feature: General Post-Processing related features
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the profile "car"
|
||||||
|
Given a grid size of 10 meters
|
||||||
|
|
||||||
|
# this testcase used to crash geometry generation (at that time handled during intersection generation)
|
||||||
|
Scenario: Regression test #2424
|
||||||
|
Given the node map
|
||||||
|
| | | e | | | | | | i | | | | |
|
||||||
|
| a | | b | | c | | d | | h | | k | | m |
|
||||||
|
| | | | | f | | | | | | l | | |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | name |
|
||||||
|
| abcd | Fritz-Elsas-Straße |
|
||||||
|
| hkm | Fritz-Elsas-Straße |
|
||||||
|
| dhi | Martin-Luther-Straße |
|
||||||
|
| be | corner |
|
||||||
|
| kl | corner |
|
||||||
|
| cf | corner |
|
@ -1,5 +1,5 @@
|
|||||||
#include "engine/guidance/post_processing.hpp"
|
|
||||||
#include "extractor/guidance/turn_instruction.hpp"
|
#include "extractor/guidance/turn_instruction.hpp"
|
||||||
|
#include "engine/guidance/post_processing.hpp"
|
||||||
|
|
||||||
#include "engine/guidance/assemble_steps.hpp"
|
#include "engine/guidance/assemble_steps.hpp"
|
||||||
#include "engine/guidance/toolkit.hpp"
|
#include "engine/guidance/toolkit.hpp"
|
||||||
@ -32,6 +32,7 @@ namespace guidance
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const constexpr double MAX_COLLAPSE_DISTANCE = 25;
|
const constexpr double MAX_COLLAPSE_DISTANCE = 25;
|
||||||
|
const constexpr std::size_t MIN_END_OF_ROAD_INTERSECTIONS = std::size_t{2};
|
||||||
|
|
||||||
inline bool choiceless(const RouteStep &step, const RouteStep &previous)
|
inline bool choiceless(const RouteStep &step, const RouteStep &previous)
|
||||||
{
|
{
|
||||||
@ -420,8 +421,7 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
|
|||||||
{
|
{
|
||||||
steps[one_back_index].maneuver.instruction.type = TurnType::Continue;
|
steps[one_back_index].maneuver.instruction.type = TurnType::Continue;
|
||||||
|
|
||||||
const auto getBearing = [](bool in, const RouteStep &step)
|
const auto getBearing = [](bool in, const RouteStep &step) {
|
||||||
{
|
|
||||||
const auto index =
|
const auto index =
|
||||||
in ? step.intersections.front().in : step.intersections.front().out;
|
in ? step.intersections.front().in : step.intersections.front().out;
|
||||||
return step.intersections.front().bearings[index];
|
return step.intersections.front().bearings[index];
|
||||||
@ -1064,6 +1064,22 @@ std::vector<RouteStep> buildIntersections(std::vector<RouteStep> steps)
|
|||||||
}
|
}
|
||||||
else if (!isSilent(instruction))
|
else if (!isSilent(instruction))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// End of road is a turn that helps to identify the location of a turn. If the turn does
|
||||||
|
// not pass by any oter intersections, the end-of-road characteristic does not improve
|
||||||
|
// the instructions.
|
||||||
|
// Here we reduce the verbosity of our output by reducing end-of-road emissions in cases
|
||||||
|
// where no intersections have been passed in between.
|
||||||
|
// Since the instruction is located at the beginning of a step, we need to check the
|
||||||
|
// previous instruction.
|
||||||
|
if (instruction.type == TurnType::EndOfRoad)
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(step_index > 0 && step_index < step_index + 1 < steps.size());
|
||||||
|
const auto &previous_step = steps[last_valid_instruction];
|
||||||
|
if (previous_step.intersections.size() < MIN_END_OF_ROAD_INTERSECTIONS)
|
||||||
|
step.maneuver.instruction.type = TurnType::Turn;
|
||||||
|
}
|
||||||
|
|
||||||
// Remember the last non silent instruction
|
// Remember the last non silent instruction
|
||||||
last_valid_instruction = step_index;
|
last_valid_instruction = step_index;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user