Search code examples
pepper

Localise And Map errors with "Animation failed."


Running LocalizeAndMap i got the following error. There are no other animation events implemented (all commented out). I have also deleted previous app from Pepper and re-installed.

I have just updated to API 6.

public void startMapping() {
        // Create a LocalizeAndMap action.
        localizeAndMap = LocalizeAndMapBuilder.with(qiContext).build();

        // Add an on status changed listener on the LocalizeAndMap action to know when the robot has mapped his environment.
        localizeAndMap.addOnStatusChangedListener(status -> {
            switch (status) {
                case LOCALIZED:
                    Log.i(TAG, "Robot has mapped his environment.");
                    say( "Mapping done");
                    // Dump the ExplorationMap.
                    explorationMap = localizeAndMap.dumpMap();
                    // Cancel the LocalizeAndMap action.
                    localizationAndMapping.requestCancellation();
                    break;
            }
        });

        Log.i(TAG, "Mapping...");
        //say( "Boopity doop");
        // Execute the LocalizeAndMap action asynchronously.
        localizationAndMapping = localizeAndMap.async().run();

        // Add a lambda to the action execution.
        localizationAndMapping.thenConsume(future -> {
            if (future.hasError()) {
                Log.e(TAG, "LocalizeAndMap action finished with error.", future.getError());
                localisationListener.localisationFailed();
            } else if (future.isCancelled()) {
                // The LocalizeAndMap action has been cancelled.
                startLocalizing(qiContext);
            }
        });

    }
12-18 16:59:38.150 9330-9373/com.akqa.peppertest E/LocaliseManager: LocalizeAndMap action finished with error.
    com.aldebaran.qi.QiException: Animation failed.
        at com.aldebaran.qi.Future.qiFutureCallGet(Native Method)
        at com.aldebaran.qi.Future.get(Future.java:238)
        at com.aldebaran.qi.Future.get(Future.java:273)
        at com.aldebaran.qi.Future.getError(Future.java:308)
        at com.akqa.peppertest.LocaliseManager.lambda$startMapping$1(LocaliseManager.java:79)
        at com.akqa.peppertest.-$$Lambda$LocaliseManager$v5-1peqSlVfNY0haEaORatFr7rU.consume(lambda)

Solution

  • Since API 6 and Naoqi 2.9.4, you can check the charging flap status (opened or closed)

    public boolean getFlapState() {
        boolean flapState = chargingFlap.async().getState().getValue().getOpen();
        Log.d(TAG, "getFlapState: Is opened ? :" + flapState);
        return flapState;
    }
    

    Are you aware of this complete Navigation tutorial for Pepper?

    The charging flap status is checked before every action.