EngageHuman


level_2


Goal - Make Pepper focus on a particular human.

// 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 - EngageHuman is automatically launched and controlled by BasicAwareness. In most of the cases, you should rely on this standard behavior.

However, you should use EngageHuman to:

  • manually control which human must be engaged (based on your own engagement strategy),
  • know when the engaged human is lost by the robot,
  • implement a multi-engagement functionality (switch the engaged human).

How it works

Engagement strategy

Pepper can engage a Human: it means that he will look at him and keep his focus on him. To achieve that, Pepper needs to know which human should be engaged.

A suggestion is given via getRecommendedHumanToEngage method:

HumanAwareness humanAwareness = qiContext.getHumanAwareness();
try {
    Human recommendedHuman = humanAwareness.getRecommendedHumanToEngage();
    // There is a recommended human to engage.
} catch (Exception e) {
    // 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.

Engage a Human

After finding a human to engage, build the EngageHuman action:

EngageHuman engageHuman = EngageHumanBuilder.with(qiContext)
                                            .withHuman(recommendedHuman)
                                            .build();

engageHuman.async().run();

Disengagement cues

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.

EngageHuman engageHuman = EngageHumanBuilder.with(qiContext)
        .withHuman(recommendedHuman)
        .build();

engageHuman.addOnHumanIsDisengagingListener(new EngageHuman.OnHumanIsDisengagingListener() {
    @Override
    public void onHumanIsDisengaging() {
        Say say = SayBuilder.with(qiContext)
                            .withText("Goodbye!")
                            .build();
        say.run();
        engagement.requestCancellation();
    }
});

engagement = engageHuman.async().run();

Apart from human’s nonverbal behavior, 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.

Use cases

Stay focused during an 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.

Human human = ...;

EngageHuman engageHuman = EngageHumanBuilder.with(qiContext)
                                            .withHuman(human)
                                            .build();

engageHuman.addOnHumanIsEngagedListener(new EngageHuman.OnHumanIsEngagedListener() {
    @Override
    public void onHumanIsEngaged() {
        Say say = SayBuilder.with(qiContext)
                            .withText("Hello!")
                            .build();

        say.run();
    }
});

engageHuman.async().run();

Performance & Limitations

Engaged human exclusivity

Because engagement represents a bond with a specific human, Pepper can only engage one human at a time.

Disengagement cases

Pepper can lose the engagement bond if he does not see the engaged human anymore. In this case, the engagement action finishes.

See also