Goal - Make Pepper look at a specific location with his head and his mobile base.
// Get the target frame to look at. Frame targetFrame = ...; // Build the action. LookAt lookAt = LookAtBuilder.with(qiContext) .withFrame(targetFrame) .build(); // Run the action asynchronously. lookAt.async().run();
Typical usage - You want Pepper to look at something/someone and track it.
How it works¶
Looking at a location¶
To configure where Pepper should look at, use a Frame.
Frame and build the
LookAt action with it:
Frame targetFrame = ...; LookAt lookAt = LookAtBuilder.with(qiContext) .withFrame(targetFrame) .build();
You can refer to the Frame reference page to see how to get a
Pepper will track the target frame while the action is running.
For example, if the target frame is a
Human head frame, and the
human moves with respect to the robot, Pepper will automatically
update his posture to keep looking at the human.
Setting the movement policy¶
When Pepper looks at a location, you can choose if he should use only his head
or also move his mobile base by setting the
By default, the
LookAtMovementPolicy is set to
HEAD_AND_BASE, but it can be
If you choose
HEAD_ONLY, Pepper will only turn his head to look at the
However, if you use
HEAD_AND_BASE, Pepper will be able to also turn his
LookAt lookAt = ...; lookAt.setPolicy(LookAtMovementPolicy.HEAD_AND_BASE); lookAt.async().run();
See also javadoc: LookAtMovementPolicy.
Managing base availability¶
If you run a
LookAt action with the movement policy set to
while the robot base is not available, the action execution will fail and throw
In that case, you can try to set the movement policy to
HEAD_ONLY and rerun