Goal -
Make Pepper localize himself inside an ExplorationMap
,
previously built by a LocalizeAndMap
action.
// Get an exploration map.
val explorationMap: ExplorationMap = ...
// Build the action.
val localize: Localize = LocalizeBuilder.with(qiContext)
.withMap(explorationMap)
.build()
// Run the action asynchronously.
localize.async().run()
// Get an exploration map.
ExplorationMap explorationMap = ...;
// Build the action.
Localize localize = LocalizeBuilder.with(qiContext)
.withMap(explorationMap)
.build();
// Run the action asynchronously.
localize.async().run();
Typical usage - You want Pepper to localize himself and move around his environment, without drifting or losing track of his position relatively to his surroundings.
To enable Pepper to keep track of his location in his environment, you should first
map this environment by using a LocalizeAndMap
action. The result ExplorationMap
can be used to build a Localize
action.
// Get an exploration map.
val explorationMap: ExplorationMap = ...
// Build the action.
val localize: Localize = LocalizeBuilder.with(qiContext)
.withMap(explorationMap)
.build()
// Run the action asynchronously.
localize.async().run()
// Get an exploration map.
ExplorationMap explorationMap = ...;
// Build the action.
Localize localize = LocalizeBuilder.with(qiContext)
.withMap(explorationMap)
.build();
// Run the action asynchronously.
localize.async().run();
To create an ExplorationMap
, refer to LocalizeAndMap and ExplorationMap.
As long as the Localize
is running, Pepper keeps track of his position relatively
to his environment. This means the user can call, for example,
robotFrame.computeTransform(mapFrame)
to know the robot position relatively to
the map frame, which is where the robot was when he started the LocalizeAndMap
action
that was used to generate his ExplorationMap
.
If no Localize
or LocalizeAndMap
action is running, the robot does not keep
track of his position relatively to his environment, and only uses proprioceptive
information when moving.
This means that while moving, Pepper accumulates odometry drift. If Pepper were to move back and forth for a long time, it would drift and no longer be at the place he would be supposed to be.
The localization process uses exteroceptive information to compute Pepper’s location in his environment. It mainly uses laser sensors information, and those only see obstacles up to a few meters. In an open environment, Pepper will get little information and the localization process might give inconsistent results.
Unified walls and floor are also a challenging environment, think about adding posters.
When starting a Localize
action, the robot will look around to try to relocalize himself
inside his ExplorationMap
. If the Localize
is unable to perform this scanning animation,
for example because of another already running action, the Localize
run will throw an
“Animation failed” error.