mapbox-navigation-ios icon indicating copy to clipboard operation
mapbox-navigation-ios copied to clipboard

[Bug]: When simulation starts under `inTunnels` mode the `NavigationService` failed to send out notification

Open ShanMa1991 opened this issue 4 years ago • 7 comments

Mapbox Navigation SDK version

v2.1.1

Steps to reproduce

  1. Open Example, set the navigationViewController.navigationMapView?.userLocationStyle = .puck2D()
  2. Set the location to a still customer location, build the app.
  3. Unselect the simulationButton, to choose the inTunnels simulation mode.
  4. start navigation and wait till the simulation start

Expected behavior

The map puck will move because the NavigationService.simulate(intent:) is called to send out notification of simulation starts, and the NavigationViewController could set up simulated location provider for map puck.

Actual behavior

The map puck is stale because NavigationService.simulate(intent:) is not called.

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

repeatable

ShanMa1991 avatar Jan 11 '22 00:01 ShanMa1991

Hi @1ec5 @Udumft , I noticed that there's an edge case. When the simulationMode is .inTunnels, and the poorGPS time elapsed is over the threshold, but the user location is not in tunnel, the NavigationService.simulate(intent:) is not called. And the NavNative starts simulation mode and sends Navigator the simulated location. And Router will still send the RouteProgress update to NavigationService and ignore the SimulatedLocationManager.

My questions is in this case, should we use our own SimulatedLocationManager in this case? If not, should we add the notification about the simulated location from Navigator and the RouteProgress? Otherwise, the result is that if the custom map puck would keep still while the route line and camera updated, they'll be out of synced.

ShanMa1991 avatar Jan 18 '22 21:01 ShanMa1991

Hey! Simulation does not kick in because inTunnels requires not only missing GPS data, but also user to be in a tunnel. There is currently an effort to unify simulation logic and move it from platforms to NN side, to avoid misleading and strange simulation behavior in some cases.

Udumft avatar Jan 19 '22 07:01 Udumft

Yes, the simulation in our side shouldn't start, which is as expected. But the core Navigator receives the simulated location update from NavNative when the GPS is poor, and form the RouteProgress update. It's like in this case. But our UI side cannot identify it's the simulated one. So my question is, should we also stop the simulated location update from Nav Navigator? Or when it sends out the simulated location, our SDK should be notified.

ShanMa1991 avatar Jan 19 '22 19:01 ShanMa1991

Sorry, I might not understand the issue. Ticket description says that it is expected that simulation will kick in and puck will move when inTunnels simulation mode is selected. But I believe it should not because there are no conditions for poor GPS signal and tunnel road segment.

Udumft avatar Jan 20 '22 07:01 Udumft

Yes. So right now the camera and route line is updated with the RouteProgress due to the simulation status provided by the NavNativeStatus. And this is not expected.

ShanMa1991 avatar Jan 20 '22 16:01 ShanMa1991

I see. I think this is related to planned NN's useIMU setting which interferes with simulation.

Udumft avatar Jan 21 '22 07:01 Udumft

https://github.com/mapbox/mapbox-navigation-ios/issues/3881 is another case where the simulating will automatically start.

ShanMa1991 avatar May 13 '22 17:05 ShanMa1991