Fix invalid roundabout instructions for different driving modes, #4129

This commit is contained in:
Michael Krasnyk 2017-06-07 09:43:17 +02:00 committed by Patrick Niklaus
parent 9315dc1c73
commit 03e83ec6a0
2 changed files with 12 additions and 7 deletions

View File

@ -61,7 +61,7 @@ Feature: Basic Roundabout
| waypoints | route | turns | | waypoints | route | turns |
| a,d | ab,cd,cd | depart,roundabout turn left exit-1,arrive | | a,d | ab,cd,cd | depart,roundabout turn left exit-1,arrive |
| a,f | ab,ef,ef,ef | depart,roundabout turn left exit-1,notification right,arrive | | a,f | ab,ef,ef,ef | depart,roundabout turn left exit-1,notification right,arrive |
| a,h | ab,bgecb,gh,gh | depart,invalid right,notification right,arrive | | a,h | ab,bgecb,gh,gh | depart,roundabout turn right exit-1,notification right,arrive |
| d,f | cd,ef,ef,ef | depart,roundabout turn sharp left exit-2,notification right,arrive | | d,f | cd,ef,ef,ef | depart,roundabout turn sharp left exit-2,notification right,arrive |
| d,h | cd,gh,gh,gh | depart,roundabout turn left exit-2,notification right,arrive | | d,h | cd,gh,gh,gh | depart,roundabout turn left exit-2,notification right,arrive |
| d,a | cd,ab,ab | depart,roundabout turn right exit-1,arrive | | d,a | cd,ab,ab | depart,roundabout turn right exit-1,arrive |
@ -70,4 +70,4 @@ Feature: Basic Roundabout
| f,d | ef,cd,cd | depart,roundabout turn right exit-1,arrive | | f,d | ef,cd,cd | depart,roundabout turn right exit-1,arrive |
| h,a | gh,ab,ab | depart,roundabout turn left exit-2,arrive | | h,a | gh,ab,ab | depart,roundabout turn left exit-2,arrive |
| h,d | gh,cd,cd | depart,roundabout turn straight exit-1,arrive | | h,d | gh,cd,cd | depart,roundabout turn straight exit-1,arrive |
| h,f | gh,bgecb,ef,ef | depart,invalid right,notification right,arrive | | h,f | gh,bgecb,ef,ef | depart,roundabout turn right exit-1,notification right,arrive |

View File

@ -171,9 +171,11 @@ void closeOffRoundabout(const bool on_roundabout,
if (!guidance::haveSameMode(exit_step, prev_step)) if (!guidance::haveSameMode(exit_step, prev_step))
{ {
BOOST_ASSERT(leavesRoundabout(exit_step.maneuver.instruction)); BOOST_ASSERT(leavesRoundabout(exit_step.maneuver.instruction));
prev_step.maneuver.instruction = exit_step.maneuver.instruction;
if (!entersRoundabout(prev_step.maneuver.instruction)) if (!entersRoundabout(prev_step.maneuver.instruction))
prev_step.maneuver.exit = exit_step.maneuver.exit; {
prev_step.maneuver.instruction = exit_step.maneuver.instruction;
}
prev_step.maneuver.exit = exit_step.maneuver.exit;
exit_step.maneuver.instruction.type = TurnType::Notification; exit_step.maneuver.instruction.type = TurnType::Notification;
step_index--; step_index--;
} }
@ -198,9 +200,12 @@ void closeOffRoundabout(const bool on_roundabout,
{ {
auto &propagation_step = steps[propagation_index]; auto &propagation_step = steps[propagation_index];
auto &next_step = steps[propagation_index + 1]; auto &next_step = steps[propagation_index + 1];
propagation_step.ElongateBy(next_step); if (guidance::haveSameMode(propagation_step, next_step))
propagation_step.maneuver.exit = next_step.maneuver.exit; {
next_step.Invalidate(); propagation_step.ElongateBy(next_step);
propagation_step.maneuver.exit = next_step.maneuver.exit;
next_step.Invalidate();
}
if (entersRoundabout(propagation_step.maneuver.instruction)) if (entersRoundabout(propagation_step.maneuver.instruction))
{ {