fix guidance issues / improve tests

This commit is contained in:
Moritz Kobitzsch 2016-04-21 22:51:38 +02:00
parent e59a7926a2
commit 3ac061c546
4 changed files with 10 additions and 30 deletions

View File

@ -245,7 +245,6 @@ Feature: Fork Instructions
| a,c | abd,bc,bc | depart,turn slight left,arrive | | a,c | abd,bc,bc | depart,turn slight left,arrive |
| a,d | abd,abd | depart,arrive | | a,d | abd,abd | depart,arrive |
@pr2275 @bug
Scenario: Tripple fork Scenario: Tripple fork
Given the node map Given the node map
| | | | | | | | | c | | | | | | | | | | c |

View File

@ -726,7 +726,6 @@ Feature: Simple Turns
| a,e | abc,eb,eb | depart,turn right,arrive | | a,e | abc,eb,eb | depart,turn right,arrive |
| a,f | abc,fb,fb | depart,turn slight right,arrive | | a,f | abc,fb,fb | depart,turn slight right,arrive |
@bug @pr2275
Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 2 Scenario: Right Turn Assignment Three Conflicting Turns with invalid - 2
Given the node map Given the node map
| | | g | | | | | | g | | |
@ -787,7 +786,6 @@ Feature: Simple Turns
| a,e | abc,be,be | depart,turn right,arrive | | a,e | abc,be,be | depart,turn right,arrive |
| a,f | abc,bf,bf | depart,turn sharp right,arrive | | a,f | abc,bf,bf | depart,turn sharp right,arrive |
@bug @pr2275
Scenario: Conflicting Turns with well distinguished turn (back) Scenario: Conflicting Turns with well distinguished turn (back)
Given the node map Given the node map
| a | | | b | | | c | | a | | | b | | | c |

View File

@ -16,9 +16,9 @@ const double constexpr STRAIGHT_ANGLE = 180.;
const double constexpr MAXIMAL_ALLOWED_NO_TURN_DEVIATION = 3.; const double constexpr MAXIMAL_ALLOWED_NO_TURN_DEVIATION = 3.;
// angle that lies between two nearly indistinguishable roads // angle that lies between two nearly indistinguishable roads
const double constexpr NARROW_TURN_ANGLE = 40.; const double constexpr NARROW_TURN_ANGLE = 40.;
const double constexpr GROUP_ANGLE = 90; const double constexpr GROUP_ANGLE = 60;
// angle difference that can be classified as straight, if its the only narrow turn // angle difference that can be classified as straight, if its the only narrow turn
const double constexpr FUZZY_ANGLE_DIFFERENCE = 15.; const double constexpr FUZZY_ANGLE_DIFFERENCE = 20.;
const double constexpr DISTINCTION_RATIO = 2; const double constexpr DISTINCTION_RATIO = 2;
const unsigned constexpr INVALID_NAME_ID = 0; const unsigned constexpr INVALID_NAME_ID = 0;

View File

@ -18,19 +18,6 @@ namespace extractor
{ {
namespace guidance namespace guidance
{ {
namespace detail
{
inline FunctionalRoadClass roadClass(const ConnectedRoad &road,
const util::NodeBasedDynamicGraph &graph)
{
return graph.GetEdgeData(road.turn.eid).road_classification.road_class;
}
inline bool isRampClass(EdgeID eid, const util::NodeBasedDynamicGraph &node_based_graph)
{
return isRampClass(node_based_graph.GetEdgeData(eid).road_classification.road_class);
}
}
TurnHandler::TurnHandler(const util::NodeBasedDynamicGraph &node_based_graph, TurnHandler::TurnHandler(const util::NodeBasedDynamicGraph &node_based_graph,
const std::vector<QueryNode> &node_info_list, const std::vector<QueryNode> &node_info_list,
@ -282,7 +269,7 @@ Intersection TurnHandler::handleComplexTurn(const EdgeID via_edge, Intersection
DirectionModifier::SlightRight}; DirectionModifier::SlightRight};
} }
} }
else if (fork_range.second - fork_range.second == 2) else if (fork_range.second - fork_range.first == 2)
{ {
assignFork(via_edge, intersection[fork_range.second], assignFork(via_edge, intersection[fork_range.second],
intersection[fork_range.first + 1], intersection[fork_range.first]); intersection[fork_range.first + 1], intersection[fork_range.first]);
@ -373,12 +360,6 @@ std::size_t TurnHandler::findObviousTurn(const EdgeID via_edge,
if (best_deviation >= 2 * NARROW_TURN_ANGLE) if (best_deviation >= 2 * NARROW_TURN_ANGLE)
return 0; return 0;
// TODO incorporate road class in decision
if (best != 0 && best_deviation < MAXIMAL_ALLOWED_NO_TURN_DEVIATION)
{
return best;
}
// has no obvious continued road // has no obvious continued road
if (best_continue == 0 || true) if (best_continue == 0 || true)
{ {
@ -534,7 +515,6 @@ Intersection TurnHandler::assignRightTurns(const EdgeID via_edge,
angularDeviation(intersection[1].turn.angle, intersection[2].turn.angle) < angularDeviation(intersection[1].turn.angle, intersection[2].turn.angle) <
GROUP_ANGLE))) GROUP_ANGLE)))
{ {
BOOST_ASSERT(intersection[1].entry_allowed && intersection[2].entry_allowed && BOOST_ASSERT(intersection[1].entry_allowed && intersection[2].entry_allowed &&
intersection[3].entry_allowed); intersection[3].entry_allowed);
// count backwards from the slightest turn // count backwards from the slightest turn
@ -624,19 +604,22 @@ std::pair<std::size_t, std::size_t> TurnHandler::findFork(const Intersection &in
} }
while (left + 1 < intersection.size() && while (left + 1 < intersection.size() &&
angularDeviation(intersection[left].turn.angle, intersection[left + 1].turn.angle) < angularDeviation(intersection[left].turn.angle, intersection[left + 1].turn.angle) <
NARROW_TURN_ANGLE) NARROW_TURN_ANGLE &&
angularDeviation(intersection[left].turn.angle, STRAIGHT_ANGLE) <= GROUP_ANGLE)
++left; ++left;
while (right > 1 && while (right > 1 &&
angularDeviation(intersection[right].turn.angle, angularDeviation(intersection[right].turn.angle,
intersection[right - 1].turn.angle) < NARROW_TURN_ANGLE) intersection[right - 1].turn.angle) < NARROW_TURN_ANGLE &&
angularDeviation(intersection[right - 1].turn.angle, STRAIGHT_ANGLE) <= GROUP_ANGLE)
--right; --right;
// TODO check whether 2*NARROW_TURN is too large // TODO check whether 2*NARROW_TURN is too large
if (0 < right && right < left && if (0 < right && right < left &&
angularDeviation(intersection[left].turn.angle, angularDeviation(intersection[left].turn.angle,
intersection[(left + 1) % intersection.size()].turn.angle) >= 60 && intersection[(left + 1) % intersection.size()].turn.angle) >=
GROUP_ANGLE &&
angularDeviation(intersection[right].turn.angle, intersection[right - 1].turn.angle) >= angularDeviation(intersection[right].turn.angle, intersection[right - 1].turn.angle) >=
60) GROUP_ANGLE)
return std::make_pair(right, left); return std::make_pair(right, left);
} }
return std::make_pair(std::size_t{0}, std::size_t{0}); return std::make_pair(std::size_t{0}, std::size_t{0});