mapbox / mapbox/mapbox-navigation-ios

[Bug]: mapboxNavigation.navigation().switchLeg(newLegIndex:) breaks navigator

Open
#4,740 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Swift
Stars
918
Forks
326
Avg merge
1h 16m
Merged PRs (30d)
3

Description

Mapbox Navigation SDK version

3.6.0-beta.1

Steps to reproduce

Create a navigation session with a waypoint that requires a short detour (something like turning right, driving for 100 meters, then turning around because you reached the waypoint, head back to the intersection and turn right again. Then, before doing the right turn towards the waypoint, use navigationViewController.mapboxNavigation.navigation().switchLeg(newLegIndex: routeProgress.legIndex+1) to make the navigator skip the waypoint. Look at how the route is now displayed.

Expected behavior

When skipping a waypoint, I would expect the navigator to handle it like any other situation: If the driver is on the correct road, just continue the instructions. If he is not, trigger a reroute because he went off route.

Actual behavior

The navigator does skip the waypoint, but the step description stays outdated and the route is completely broken. Either the route is not being displayed at all, or it is displayed in a very broken manner, as can be seen in the two screenshots.
The two examples happened on the same spot, but are two different occasions and are the view the driver was seeing after the waypoint had been skipped using switchLeg. Note that on the one where the route completely disappeared, I kept the instruction to go right even though I should have gone left from there if I had skipped the waypoint correctly. Also, the navigation location puck was not moving anymore, even when I drove pretty far after the incident.

photo_2024-12-10_15-09-17
photo_2024-12-10_15-09-16

Is this a one-time issue or a repeatable issue?

repeatable

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue on Mapbox Navigation SDK 3.6.0-beta.1 using a waypoint that requires a short detour, then call switchLeg(newLegIndex: routeProgress.legIndex+1) before the turn toward the waypoint. Compare the displayed route, step instruction, and location puck with the expected behavior: continue correctly on route or reroute when off route.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.