Open xiaoxin3838438 opened 1 year ago
Hi @xiaoxin3838438! Thank you for submitting this report. To make sure I understand the issue you're seeing: when you start navigating and the user goes off-route, the Nav SDK automatically reroutes them; however, when you cancel that session, start a new navigation session, and the user goes off-route, the Nav SDK is not automatically rerouting them? Is this correct?
Is there no reroute at all? Or there is a reroute, but the route line and camera jumped to the route origin instead of the current location?
Hi @xiaoxin3838438! Thank you for submitting this report. To make sure I understand the issue you're seeing: when you start navigating and the user goes off-route, the Nav SDK automatically reroutes them; however, when you cancel that session, start a new navigation session, and the user goes off-route, the Nav SDK is not automatically rerouting them? Is this correct?
Yes, when I finish the previous navigation and start again, the route is not automatically planned, and the camera view changes position as I move, but no new route is planned
Is there no reroute at all? Or there is a reroute, but the route line and camera jumped to the route origin instead of the current location?
No, the camera position will change with my position, and it will be updated to the new position, but no new route will be planned
@xiaoxin3838438 Could you attach a video to this ticket? Your link is not working unfortunately.
@xiaoxin3838438 Could you attach a video to this ticket? Your link is not working unfortunately.
I was just able to upload the video so you can check it out Video Address:
Thanks @xiaoxin3838438! I'll take a look.
Hi @xiaoxin3838438! Is navigationService(_:, didFailToRerouteWith:)
ever called? I see the alerts that say that it did reroute, but no route pops up. With your startNavigationController
conforming to the NavigationViewControllerDelegate
, it looks like you are overriding the methods related to rerouting.
Hi @xiaoxin3838438! Is
navigationService(_:, didFailToRerouteWith:)
ever called? I see the alerts that say that it did reroute, but no route pops up. With yourstartNavigationController
conforming to theNavigationViewControllerDelegate
, it looks like you are overriding the methods related to rerouting.
Yes, because my previous code would not automatically plan the path from new, so I rewrote the agent method and turned off the system default automatic route planning. If I judged the user's current position in the map callback agent and the route was not planned, I planned a new route from new to avoid this problem. After I modified it, Is there a potential impact on mapbox's other navigation features? It would be best if you can solve it later. If not, I will temporarily use this method to avoid this problem
hi, @xiaoxin3838438! I have few more questions about your setup:
MapboxRoutingProvider
for requests directly and instantiate your MapboxNavigationService
with customRoutingProvider: nil
for the default behavior instead.And a side note: SDK allows some deviation between user actual position and route's origin point when starting the route before triggering a re-route. This is done for cases when navigation is started in surrounding territory, to allow user some gap to get to the route before attempting to "fix" it. So, to be sure that re-routing does not actually work, please make sure that user puck was connected to the route line in the first place OR that user has travelled more or less significant distance (>500m will do) after starting a session to let the engine know that user is somewhere unexpected.
Mapbox Navigation SDK version
2.5.1
Steps to reproduce
Hello, I now use mapBox navigation SDK2.5.1 met weird bugs, starting for the first time in my APP, and began to navigation for the first time, if I go the wrong route, navigation will help me to switch to the new navigation route automatically, if I quit the current navigation, again start navigation, takes the wrong course, won't help me planning path automatically, No matter how many times I navigate, it won't help me automatically plan a new path, unless I kill the APP and go to the navigation again for the first time.
Here is my MapBox integration code
Gets the navigation address path: `func calculateRoute(_ options: NavigationRouteOptions) { guard let startPoint = self.startPoint, let endPoint = self.endPoint else{ return }
customRoutingProvider implementation code inside: ` import UIKit import MapboxCoreNavigation import MapboxDirections import MapboxNavigation
class CustomProvider: RoutingProvider { // This can encapsulate any route building engine we need. For simplicity let's use
MapboxRoutingProvider
. // 这可以封装我们需要的任何路由构建引擎。为了简单起见,让我们使用' MapboxRoutingProvider '。 let routeCalculator = MapboxRoutingProvider()} `
` func startNav(simulationMode: SimulationMode) { guard let route = self.currentRoute, let routeOptions = self.routeOptions, let routeResponse = self.routeResponse else { return } var routeIndex = 0 for (idx,temp) in routeModels.enumerated() { if temp.selected == true { routeIndex = idx } }
`
We mainly to achieve in this class (StartNavigationController) `
static func createStartNavigationController(mapNavController: NavigationViewController) -> StartNavigationController { let nv = StartNavigationController() nv.k_navigationViewController = mapNavController return nv }
override func viewDidLoad() { super.viewDidLoad() setupSubViews() }
func setupSubViews() { view.addSubview(naviControlView) if let nav = self.k_navigationViewController { self.naviControlView.addSubview(nav.view) nav.delegate = self nav.routeLineTracksTraversal = true // 关闭意见反馈 nav.showsReportFeedback = false // 到达最终目的地时,显示“End of route Feedback”界面 nav.showsEndOfRouteFeedback = false // 在后台时,切换UILocalNotification的发送 nav.sendsNotifications = false // 移动地图的回调 let navigationViewportDataSource = NavigationViewportDataSource(nav.navigationMapView!.mapView, viewportDataSourceType: .active) navigationViewportDataSource.options.followingCameraOptions.zoomUpdatesAllowed = true navigationViewportDataSource.options.followingCameraOptions.bearingSmoothing.maximumBearingSmoothingAngle = 30.0 navigationViewportDataSource.followingMobileCamera.zoom = 14.0 navigationViewportDataSource.options.followingCameraOptions.paddingUpdatesAllowed = true nav.navigationMapView?.navigationCamera.viewportDataSource = navigationViewportDataSource
`
The extension implementation
`extension StartNavigationController: NavigationViewControllerDelegate {
}`
Major in (TRCustomNavViewController) map navigation:
`class TRCustomNavViewController: ContainerViewController {
} ` These are all the steps we took to implement the navigation code.
Below is our test effect:
https://thinkerride.oss-cn-zhangjiakou.aliyuncs.com/10001/20221021/normal%20video.mp4
Temporary solution Now that we have a temporary solution, we don't know how this solution will affect the performance of the map, and what unpredictability will be the problem, so let's explain the logic of the solution:
The main changes in (StartNavigationController)
func navigationViewController(_ navigationViewController: NavigationViewController, shouldRerouteFrom location: CLLocation) -> Bool { return false }
` // 当用户移动更新路由进程模型时调用 func navigationViewController(_ navigationViewController: NavigationViewController, didUpdate progress: RouteProgress, with location: CLLocation, rawLocation: CLLocation) {
I hope the official answer, thank you
Expected behavior
Expect the navigation to be normal, and automatically plan the latest route when you take a wrong route
Actual behavior
During the navigation, a wrong route is taken and a new navigation route cannot be planned
Is this a one-time issue or a repeatable issue?
repeatable