Search code examples
pythonpepper

Pepper - .bmp to .explo


"Hello World!"

Basically I'm doing a mapping of a location with my Pepper Robot. However, to prove this, I always need it to analyze the space it is in. The problem is that I can not go to the place for him to do it.

What I did was an image that is in .bmp and I want to move on to what it can read .explo. Unfortunately I can not do this, but just the opposite. I share here the inverse code I want to do:

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()

# name of this map
name_map = "2019-03-25T213532.632Z.explo"

# load the map
navigation_service.loadExploration("/home/nao/.local/share/Explorer/" + name_map)
# name of the image
name_image = name_map + ".bmp"
# Retrieve and display the map built by the robot
loaded_map = navigation_service.getMetricalMap()
map_width = loaded_map[1]
map_height = loaded_map[2]
img = numpy.array(loaded_map[4]).reshape(map_width, map_height)
img = (100 - img) * 2.55 # from 0..100 to 255..0
img = numpy.array(img, numpy.uint8)
output_image = Image.frombuffer('L',  (map_width, map_height), img, 'raw', 'L', 0, 1)
output_image.save(name_image, format=None)
#output_image.show()

Anyone have any advice or anything you can share to help me?

Thanks in advance


Solution

  • It's not possible to turn an image into an exploration map (at least, not without some serious revererse-engineering of the format in a way that may not work in future versions), because the actual .explo map encodes more information than just the top-down view of walls. Depending of the version, there can be some 3D information etc.