Mastering Emotion detection ¶
In this tutorial, we will use the
PleasureState characteristics to interpret the basic emotion of the
human in front of Pepper.
Before stepping in this tutorial, you should:
- Know how to use the HumanAwareness service. For further details, see: Human.
Let’s start a new project
- Start a new project, let’s call it BasicEmotionPepper.
- Robotify it and make sure it implements the QiSDK & the Robot Life Cycle.
For further details, see: Creating a robot application.
Observing basic emotions¶
BasicEmotion enumeration to represent the human basic emotion:
And a listener to react to a basic emotion change:
We need a class to observe the basic emotion of the human in front of Pepper.
This class observes the
PleasureState of the first
human seen by using the
HumanAwareness service, transforms them into a
BasicEmotion and notifies its listener when this emotion changes.
Here is the transformation matrix we used, based on James Russel’s work:
This transformation is done in the
Subscribe to the observer¶
MainActivity implement the
And override the
BasicEmotionObserver in the
Create it in and subscribe to it the
And unsubscribe from it in the
onRobotFocusGained callback, start the emotion observation:
And stop it in the
Let’s try it¶
The sources for this tutorial are available on GitHub.
Install and run the application.
For further details, see: Running an application.
|Choose “Detect human emotions”.|
Stay in front of Pepper, try to express an emotion with your smile, your voice or by touching Pepper’s sensors.
You should see some log information displaying your emotion when it changes.