0

One of the goal of the project I'm working with is making Pepper robot patrolling hospital wards "autonomously". So I downloaded some basic application to start with navigation (https://github.com/aldebaran/naoqi_navigation_samples). The "explore" application is critical since it is needed by the other two (places and patrol). I tried to launch "explore" on Choregraphe, but the robot does not move (so it does not explore neither creates a map, obviously) and the application ends by saying the final sentence. In particular the block "Get map" gives an error. So, the application starts correctly but it does not work properly.

I saved "explore" as a robot application and tried in both autonomous life and not autonomous life.

I can not understand where I'm wrong: could you help me please?

  • Can you post the error that you're getting from the get map block? And just a silly one but is Pepper's power flap up? If so it won't be able to move. – Dominic D Aug 28 '20 at 22:05
  • The error by launching "explore app" installed on the robot is the following: [INFO ] behavior.box :onInput_onStart:34 _Behavior__explorec8782bexplore_display1062972544:/Show App_2: Successfully set application: explore-c8782b [WARN ] behavior.box :onInput_onStart:44 _Behavior__explorec8782bexplore_display1062972544:/Get map_1: [WARN ] behavior.box :onInput_onStart:46 _Behavior__explorec8782bexplore_display1062972544:/Get map_1: data:image/png;base64, The power flap up is in the right position. – Giulio Amabili Sep 01 '20 at 07:12
  • That just looks to be warnings? Can you edit your question and add the full warning text in there? – Dominic D Sep 06 '20 at 15:57

1 Answers1

0

Make sure the charging flap is not open when you run. Also try this code, it will create a map

#! /usr/bin/env python
# -*- encoding: UTF-8 -*-

"""Example: Use explore method."""

import qi
import argparse
import sys
import numpy
from PIL import Image


def main(session):
    """
    This example uses the explore method.
    """
    # Get the services ALNavigation and ALMotion.
    navigation_service = session.service("ALNavigation")
    motion_service = session.service("ALMotion")

    # Wake up robot
    motion_service.wakeUp()

    # Explore the environement, in a radius of 2 m.
    radius = 5.0
    error_code = navigation_service.explore(radius)
    if error_code != 0:
        print ("Exploration failed.")
        return
    # Saves the exploration on disk
    path = navigation_service.saveExploration()
    print ("Exploration saved at path: \"" + path + "\"")
    # Start localization to navigate in map
    navigation_service.startLocalization()
    # Come back to initial position
    navigation_service.navigateToInMap([0., 0., 0.])
    # Stop localization
    navigation_service.stopLocalization()
    # Retrieve and display the map built by the robot
    result_map = navigation_service.getMetricalMap()
    map_width = result_map[1]
    map_height = result_map[2]
    img = numpy.array(result_map[4]).reshape(map_width, map_height)
    img = (100 - img) * 2.55 # from 0..100 to 255..0
    img = numpy.array(img, numpy.uint8)
    Image.frombuffer('L',  (map_width, map_height), img, 'raw', 'L', 0, 1).show()

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--ip", type=str, default="127.0.0.1",
                        help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
    parser.add_argument("--port", type=int, default=9559,
                        help="Naoqi port number")

    args = parser.parse_args()
    session = qi.Session()
    try:
        session.connect("tcp://" + args.ip + ":" + str(args.port))
    except RuntimeError:
        print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
            "Please check your script arguments. Run with -h option for help.")
        sys.exit(1)
    main(session)
Aleks4920
  • 82
  • 7