Goal - Make Pepper focus on a specific human.
// Get a human.
val human: Human = ...
// Build the action.
val engageHuman: EngageHuman = EngageHumanBuilder.with(qiContext)
.withHuman(human)
.build()
// Run the action asynchronously.
engageHuman.async().run()
// Get a human.
Human human = ...;
// Build the action.
EngageHuman engageHuman = EngageHumanBuilder.with(qiContext)
.withHuman(human)
.build();
// Run the action asynchronously.
engageHuman.async().run();
Typical usage - Thanks to the default BasicAwareness, Pepper is already acknowledging humans around him.
However, you should use EngageHuman action to:
Human-robot interaction can be divided in three main phases:
The main interactive content of the app, like verbal exchange and/or content display on the screen, should only occur during the interaction phase.
To engage a Human, Pepper needs to know which human is the best target to interact with.
HumanAwareness
gives a suggestion via getRecommendedHumanToEngage
method:
val humanAwareness: HumanAwareness = qiContext.humanAwareness
val recommendedHuman: Human = humanAwareness.recommendedHumanToEngage
HumanAwareness humanAwareness = qiContext.getHumanAwareness();
Human recommendedHuman = humanAwareness.getRecommendedHumanToEngage();
Warning
getRecommendedHumanToEngage
returns null
if there is no recommended human to engage.
This engagement strategy is based on engagement intention state of a human, as well as his distance to the optimal interaction position (0.6 meters in front of the current robot position). Moreover, preference is given to humans who did not already interact with the robot.
If there are no humans who show willingness to interact with the robot, Pepper can try to approach humans and invite them to interact with him, as described in ApproachHuman.
After finding a human to engage, the interaction phase starts by building the EngageHuman
action:
val engageHuman: EngageHuman = EngageHumanBuilder.with(qiContext)
.withHuman(recommendedHuman)
.build()
engageHuman.async().run()
EngageHuman engageHuman = EngageHumanBuilder.with(qiContext)
.withHuman(recommendedHuman)
.build();
engageHuman.async().run();
Recognizing the disengagement cues via OnHumanIsDisengagingListener
listener can be useful to either provide
new content in order to re-engage the human or to execute necessary actions (e.g. request an email address) and
close the interaction properly by saying goodbye, before stopping the EngageHuman
action.
val engageHuman: EngageHuman = EngageHumanBuilder.with(qiContext)
.withHuman(recommendedHuman)
.build()
val say: Say = SayBuilder.with(qiContext)
.withText("Goodbye!")
.build()
engageHuman.addOnHumanIsDisengagingListener {
say.run()
engagement?.requestCancellation()
}
engagement = engageHuman.async().run()
EngageHuman engageHuman = EngageHumanBuilder.with(qiContext)
.withHuman(recommendedHuman)
.build();
Say say = SayBuilder.with(qiContext)
.withText("Goodbye!")
.build();
engageHuman.addOnHumanIsDisengagingListener(() -> {
say.run();
engagement.requestCancellation();
});
engagement = engageHuman.async().run();
Apart from human’s nonverbal behavior (e.g. shift of attention, moving away from the robot), some common goodbye phrases are also considered as disengagement cues. However, this option is only available if the robot is in listening state when using Chat action.
You might want Pepper to focus on a specific human when performing an action. For example, this is the case when you want Pepper to talk to a human.
val human: Human = ...
val engageHuman: EngageHuman = EngageHumanBuilder.with(qiContext)
.withHuman(human)
.build()
val say: Say = SayBuilder.with(qiContext)
.withText("Hello!")
.build()
engageHuman.addOnHumanIsEngagedListener { say.run() }
engageHuman.async().run()
Human human = ...;
EngageHuman engageHuman = EngageHumanBuilder.with(qiContext)
.withHuman(human)
.build();
Say say = SayBuilder.with(qiContext)
.withText("Hello!")
.build();
engageHuman.addOnHumanIsEngagedListener(() -> say.run()});
engageHuman.async().run();
Because engagement represents a bond with a specific human, Pepper can only engage one human at a time.
Pepper can lose the engagement bond if he does not see the engaged human anymore. In this case, the engagement action finishes. For better performance, multimodal human detection based on cameras and laser/sonar measurements, it is advised to map the environment and localize the robot, as explained in LocalizeAndMap.
EngageHuman
uses all means to keep tracking the engaged human, including moving the mobile base.
However, there are two options that allow you to define constraints to restrict movements during tracking:
DegreeOfFreedom.ROBOT_FRAME_ROTATION
.LookAt
to track a specific human and set its movement policy to LookAtMovementPolicy.HEAD_ONLY
.