mapbox / mapbox/mapbox-navigation-android

Navigation SDK 1.5 breaks off-route detection and voice instructions for first leg with >2 waypoints

Aperta
#4,150 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Kotlin
Stelle
651
Fork
321
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I've just upgraded my app from Navigation SDK 1.4.0 to 1.5.0 and have observed an issue.

If I create a route with >2 waypoints, and start navigation with the user located right at the first waypoint, then the navigation SDK reports that the user is off-route. I also noticed that the voice instructions that are read out are for the first step of the second leg (not the first leg).

The issue does not occur if:

  1. I downgrade to 1.4.0
  2. I use only two waypoints.

I can reliably reproduce this on 1.5.0 on both the simulator and a real phone. And it reliably does not appear on 1.4.0.

I'm using the simple Navigation UI component, and I have intentionally disabled rerouting (as I want the user to stick to the original route). Enabling re-routing does not make a difference - the user is still reported as being off-route (but then it re-routes them quite quickly afterwards).

Android API: 30
Mapbox Navigation SDK version: 1.5.0 (issue does NOT occur with 1.4.0)

Minimal code example
@Override
public void onNavigationReady(boolean isRunning) {
    if (!isRunning && navigationMapboxMap == null) {
        if (navigationView.retrieveNavigationMapboxMap() != null) {
            this.navigationMapboxMap = navigationView.retrieveNavigationMapboxMap();

            CameraPosition position = new CameraPosition.Builder()
                    .target(new LatLng(51.48296,0.01291))
                    .zoom(15)
                    .build();

            this.navigationMapboxMap.retrieveMap().setCameraPosition(position);

            List<Point> coords = new LinkedList<>();
            coords.add(Point.fromLngLat(0.012140957165058808, 51.4828513728437));
            coords.add(Point.fromLngLat(0.0014954641793281098, 51.48814394775522));
            coords.add(Point.fromLngLat(-0.002110267315146075, 51.50086499824096));

            MapboxDirections dir = MapboxDirections.builder()
                    .waypoints(coords)
                    .overview(DirectionsCriteria.OVERVIEW_FULL)
                    .profile("walking")
                    .bannerInstructions(true)
                    .voiceInstructions(true)
                    .steps(true)
                    .voiceUnits("metric")
                    .accessToken(getString(R.string.mapbox_access_token))
                    .build();
            dir.enqueueCall(new Callback<DirectionsResponse>() {
                @Override
                public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) {
                    DirectionsRoute route = response.body().routes().get(0);
                    doNav(route);
                }

                @Override
                public void onFailure(Call<DirectionsResponse> call, Throwable t) {

                }
            });
        }
    }
}

private void doNav(DirectionsRoute route) {
    NavigationOptions.Builder nb = new NavigationOptions.Builder(this).isDebugLoggingEnabled(true);

    NavigationViewOptions.Builder builder = NavigationViewOptions.builder(this)
            .navigationListener(this)
            .directionsRoute(route)
            .navigationOptions(nb.build())
            .shouldSimulateRoute(false);
    NavigationViewOptions navigationViewOptions = builder.build();

    navigationView.startNavigation(navigationViewOptions);

    // Do not re-route
    navigationView.retrieveMapboxNavigation().setRerouteController(null);

    this.offRouteObserver = b -> {
        if (b) {
            System.out.println("OFF ROUTE");
        }
    };
    navigationView.retrieveMapboxNavigation().registerOffRouteObserver(this.offRouteObserver);
}
Steps to trigger behavior
  1. Start the Android simulator and set your current location to match the first waypoint (0.012140957165058808, 51.4828513728437)
  2. Execute the sample code above, wait for navigation to begin
  3. Observe that you're immediately reported off route. Also observe that the voice instruction that's read out is "Walk north east for 900 feet". This is the first voice instruction for leg=1, not leg=0
Expected behavior

Routing should not report the user is off-route, and should read out the correct voice instruction.

Actual behavior

User is reported as being off-route, and the incorrect voice instruction is read out.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con NavigationView.startNavigation e la gestione delle tratte del percorso utilizzata da registerOffRouteObserver e dalle istruzioni vocali. Riproduci l’esempio fornito con tre waypoint su SDK 1.5.0 al primo waypoint, quindi confronta il comportamento con 1.4.0; il lavoro è completato quando non viene prodotto alcun report immediato di uscita dal percorso e la prima istruzione vocale proviene da leg 0.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, java
Ambito
mobile
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.