ExplorationMap


level_3


What is it

An ExplorationMap represents a description of Pepper’s environment, used by Pepper to localize himself relatively to his surroundings.

How to use it

Dumping an ExplorationMap

An ExplorationMap is obtained by dumping a representation of the environment Pepper has explored during the run of a LocalizeAndMap action.

// Build a LocalizeAndMap action.
LocalizeAndMap localizeAndMap = ...;

// Run it.
localizeAndMap.async().run();

// When localized, dump the current description of the explored environment.
ExplorationMap explorationMap = localizeAndMap.dumpMap();

Localizing inside an ExplorationMap

The ExplorationMap can then be used by a Localize action, so that Pepper keeps track of his position relatively to where he was when he started the LocalizeAndMap action.

// Get an exploration map.
ExplorationMap explorationMap = ...;

// Build a Localize action.
Localize localize = LocalizeBuilder.with(qiContext)
                                   .withMap(explorationMap)
                                   .build();

Saving ExplorationMap content for future use

An ExplorationMap can be serialized to text, for example to save it to a file and store it persistently.

// Get an exploration map.
ExplorationMap explorationMap = ...;

// Serialize the ExplorationMap data.
String mapData = explorationMap.serialize();

Loading an ExplorationMap from its content

To re-use the content of a serialized ExplorationMap, one can build a new ExplorationMap object from the content.

// Retrieve a serialized ExplorationMap.
String mapData = ...;

// Build a new ExplorationMap.
ExplorationMap explorationMap = ExplorationMapBuilder.with(qiContext)
                                                     .withMapString(mapData)
                                                     .build();

See also