Skip to content
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

Discrepancy between advancing step and advancing Waypoint #285

Open
michaelkirk opened this issue Oct 4, 2024 · 1 comment
Open

Discrepancy between advancing step and advancing Waypoint #285

michaelkirk opened this issue Oct 4, 2024 · 1 comment

Comments

@michaelkirk
Copy link
Contributor

michaelkirk commented Oct 4, 2024

Trip completion is predicated on completing each of the trip steps, while completing Waypoints is a separate consideration, contingent only on your proximity to that waypoint.

In the happy path, this is fine, because typically you'll complete your steps one after the other, and completing your last step brings you to the waypoint.

However, a contradiction can arise if you take an off-route shortcut to your waypoint.

e.g. sometimes I am given a dumb route like this:

Screenshot 2024-10-04 at 14 26 21

I'll commonly go "off trail" (labeled "shortcut") for a bit to get directly to the destination rather than do a 200 meter circuit like the route suggests.

In that case I was hitting some unexpected code in my own application, and ultimately traced it down to this discrepancy between when we've "completed a step" vs "arrived at a waypoint".

I was seeing the puck still on track where I left the route at the shortcut. Ferrostar was calling reroute because, even though I'm already at the waypoint I strayed from what ferrostar was told my "next step" should be.

And the really surprising thing was, because separate logic had removed the waypoint (because I'd arrived), reroute was called with zero waypoints, which is unfulfillable — I cannot get a route without a destination.

I haven't thought through all the ramifications, but my first guess at a solution would be to change common/navigation_controller: upon arriving at the final waypoint, the trip should be considered complete, regardless of any remaining steps.

@ianthetechie
Copy link
Contributor

Good call-out.

I was seeing the puck still on track where I left the route at the shortcut.

Tracked in #209. It shouldn't be too complicated to make this behavior configurable on iOS. See the issue + PR that added this for Android recently.

And the really surprising thing was, because separate logic had removed the waypoint (because I'd arrived), reroute was called with zero waypoints, which is unfulfillable — I cannot get a route without a destination.

Heh 😂 I completely understand what happened... and yeah, that is extremely confusing.

I haven't thought through all the ramifications, but my first guess at a solution would be to change common/navigation_controller: upon arriving at the final waypoint, the trip should be considered complete, regardless of any remaining steps.

I think that, at a minimum, your suggestion is valid. I'd merge a PR that adds this behavior.

Zooming out one level, we probably haven't fully solved what it means to arrive at/"complete" a waypoint. For the moment, we're just using proximity. But if you jump "past" a waypoint in a more complicated route where you are skipping multiple steps (this should work today), but are NOT triggering the waypoint proximity check, you really should have "completed" all intermediate waypoints. So the end of the route example is one thing, but there are also probably other edge cases.

I think the route geometry is guaranteed to include the matched waypoint, at least in Valhalla. But That feels slightly shaky. So maybe the heuristic should be "when completing a step, check if its geometry passes close enough to trigger any waypoint completions." Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants