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

Changing the route with simulated locations #1922

Closed
KaterGreg opened this issue Jan 7, 2019 · 1 comment
Closed

Changing the route with simulated locations #1922

KaterGreg opened this issue Jan 7, 2019 · 1 comment

Comments

@KaterGreg
Copy link

Mapbox Navigation SDK version:

Mapbox-iOS-SDK (4.6.0)
MapboxCoreNavigation (0.26.0):
MapboxDirections.swift (0.25.2):
MapboxMobileEvents (0.6.0)
MapboxNavigation (0.26.0):
MapboxNavigationNative (3.4.11)

On our driver app, we're using two separate routes for the driver in a navigation session. The driver uses a route to go from his current location to the customer's pickup location, then we swap out the route to go from Pickup location to the destination.

For testing purposes, we're using the SimulatedLocationManager, which works well until we arrive at the pickup location. Once we arrive, I want to stop the simulation, switch routes, and continue moving once the driver selects "Start Trip".

This worked on the previous version before NavigationService was implemented, but now it no longer starts moving again once the NavigationService has been replaced.

I did manage to switch only the route in the NavigationViewController, but switching the route doesn't reset the distanceTraveled, so the driver jumps forward the distance previously travelled on the old route. This fix also doesn't stop moving when stopUpdatingLocation() is called either.

Last fix I applied appears to have the NavigationService continue moving, but the map doesn't seems disconnected and no longer updates (I heard the voice commands come through and my delegate triggered didArriveAtWaypoint).

Is there a way for the NavigationView's NavigationService to receive a route, stop moving, change routes, and then continue moving on the new route?

@samfader
Copy link

samfader commented Jan 10, 2019

@KaterGreg We're still investigating the root cause of what you're seeing here, but in terms of a workaround, can you try the following after setting navigationService.router.route = <new>?

if navigationService.simulationMode == .always, let simulator = navigationService.locationManager as? SimulatedLocationManager {
    simulator.route = <new route>
}

If that doesn't have the desired effect you may need to call .navigationService.start() after setting the simulated location manager route (which is detailed above). Let me know if that works!

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

No branches or pull requests

2 participants