mapbox / mapbox-navigation-ios

Turn-by-turn navigation logic and UI in Swift on iOS
https://docs.mapbox.com/ios/navigation/
Other
861 stars 310 forks source link

Rationalize freeway alert level thresholds #427

Closed 1ec5 closed 6 years ago

1ec5 commented 7 years ago

This is a proposal to overhaul the logic that determines the current alert level to make voice announcements more straightforward and predictable for off-ramp steps, potentially as a first step to overhauling the rest of the alert level logic.

Essentially, the medium and high alert levels would occur at specific distances ahead of the maneuver, with time thresholds still in place as fallbacks. Hopefully this approach will make the SDK feel more predictable to the user, so that they can better intuit the level of urgency of a particular voice announcement.

Current behavior

RouteController.monitorStepProgress(_:) tracks the expected time until the user reaches the maneuver point and the distance to the maneuver point. Whichever threshold is reached first determines when the alert level changes to medium then high. The time threshold gives us the flexibility to handle diverse speeds and traffic conditions, while the distance threshold serves as a failsafe for the time threshold.

Unfortunately, we arrived at the current thresholds by trial and error, making them difficult to explain in a coherent manner. We’ve had to put lots of band-aids on top of this logic just to make it work. Some of these thresholds actually assume that the user is traveling in a parking lot, even if they’re on a freeway:

Alert level Time remaining Distance remaining Effective distance remaining
(65 mph / 100 km/h)
Speeds triggering distance threshold
low
medium 70 s 400 m 1¼ mi
1.9 km
<13 mph
<21 km/h
high 15 s 100 m ¼ mi
417 m
<15 mph
<24 km/h

Proposed rationale

Even though both time and distance thresholds are ultimately necessary, one as a backup for the other, we should consider deemphasizing the time threshold in favor of the distance threshold while driving on a freeway. Drivers have learned to receive instructions at specific distances on freeways, based on where advance guide signage is placed.

Here are some relevant passages from the MUTCD, which is the standard for road signage in the United States:

Proposed behavior

Based on the MUTCD guidelines, I propose the following set of heuristics as a starting point for discussion. On a freeway (where the road classes include motorway), we’d continue to change to low alert level when completing a maneuver. Otherwise:

Alert level At distance ahead (U.S./UK) At distance ahead (metric) Effective time remaining (60 mph) Effective time remaining (100 km/h)
low
medium 1 mi 1 km 55 s 36 s
high ½ mi 500 km 28 s 18 s

The thresholds should vary based on the measurement system associated with the current system region: miles for the U.S. and UK, meters everywhere else. The values in the “effective time remaining” columns would inform the time thresholds we use as backup, but we can be flexible in order to accommodate a wider range of typical speeds. According to this survey of traffic engineering studies, the high threshold would comfortably allow for a couple lane changes.

I’m uncertain about a few aspects of this proposal:

/cc @mapbox/navigation @mapbox/directions

1ec5 commented 7 years ago

448 implements thresholds at ½ mile and 2 miles for freeways.

ericrwolfe commented 7 years ago

Noting here that the timing for the proposed distances of 1mi, 0.5mi, 1km, and 500m are inconsistent with our existing heuristics and can lead to premature announcements.

At 0.5mi, highway announcements are too early (28s) compared to our typical 15s announcement timing (https://github.com/mapbox/voyage-ios/issues/860).

The initial announcement should also be further out than 1mi and 1km on the highway, to allow sufficient time for switching across multiple lanes of traffic, exiting HOV lanes, etc.

Here's a refined set of highway timing heuristics based on some initial feedback until we can test more extensively:

1ec5 commented 7 years ago

I’d be interested in finding out whether the following approach could mitigate the concerns about lane switching time:

In some cases, these new thresholds would cause announcements to be delivered later than before. If this is a concern, we should investigate timing the announcement to end at the threshold rather than beginning at it, since we know how long a Polly-powered speech utterance will take to play.

bsudekum commented 6 years ago

These distances have been moved to the server.