maplibre-navigation-android icon indicating copy to clipboard operation
maplibre-navigation-android copied to clipboard

Current location heading resets when speed=0

Open imranMnts opened this issue 1 year ago • 7 comments

Hello,

that's an existing issue on Mapbox side but was fixed normally in 2017 so before the fork of Maplibre if I'm not wrong.

Mapbox ticket: https://github.com/mapbox/mapbox-navigation-android/issues/95

We're facing the same issue, when we stop to move, the camera is doing weird moves.

App configuration setup

  implementation 'com.github.maplibre:maplibre-navigation-android:2.0.0'
  implementation 'org.maplibre.gl:android-sdk:10.0.2'
  implementation 'org.maplibre.gl:android-plugin-annotation-v9:1.0.0'

Expected behaviour The camera should not move when the user stops to move

Actual behaviour The camera is doing weird moves

imranMnts avatar Jun 14 '23 08:06 imranMnts

Have you enabled snap on route? Have you changed the route snapping in your code?

Is this issue happening with the navigation sample in this repo?

boldtrn avatar Jun 14 '23 08:06 boldtrn

We also have the same behavior. Even with route snapping enabled.

Thanks for linking the Mapbox issue, this will really helps!

While we also need this fix, I will have a look on this problem after my other issue is finished. Assuming no one is faster 😜

Fabi755 avatar Jun 14 '23 11:06 Fabi755

I think the linked code should be indeed included in this code base here as well. Maybe there is an edge case in the code? Maybe there is a different issue at play here, as the heading is forced onto the route. We have seen issues like this when using the simulation.

boldtrn avatar Jun 14 '23 11:06 boldtrn

@boldtrn It looks like we already have the code present in the PR that I mentioned. Maybe an edge case yes.

I tried with the locationEngine but I didn't test with snapEngine, I'll test and give you my feedback on that.

imranMnts avatar Jul 03 '23 07:07 imranMnts

@boldtrn Same behaviour with snapEngine = SnapToRoute()

Don't know if we should set another thing to allow snapEngine to work as expected

imranMnts avatar Jul 03 '23 08:07 imranMnts

Don't know if we should set another thing to allow snapEngine to work as expected

Yes! I made the same mistake. You need to change the following things:

  1. snapToRoute(true)
  2. useDefaultLocationEngine(false)
  3. and call forceLocationUpdate(Location) in ProgressChangeListener

Fabi755 avatar Jul 03 '23 09:07 Fabi755

Thank you @Fabi755 I tried your suggestion but I have the same behaviour

Looks a bit reduced but the icon is still turning when the speed is reduced to 0km/h

imranMnts avatar Jul 03 '23 14:07 imranMnts