SoftBank Robotics documentation What's new in NAOqi 2.5?

ALMood API

NAOqi Core - Overview | API | Tutorials


Methods

PersonState ALMood::currentPersonState()

Gets the emotional state of the current focused user through a PersonState struct.

Returns:A struct containing the values of each emotional descriptor of a person.

This is organized as follows:

PersonData =
{
   "valence" : { value, confidence },
   "attention" : { value, confidence },
   "bodyLanguageState" :
   {
     "ease" : { level, confidence }
   },
   "smile" : { value, confidence },
   "expressions" :
   {
    "calm" : { value, confidence },
    "anger" : { value, confidence },
    "joy" : { value, confidence },
    "sorrow" : { value, confidence },
    "laughter" : { value, confidence },
    "excitement" : { value, confidence },
    "surprise" : { value, confidence }
   }
}

The valence field contains a value with a value from -1 (negative) to 1 (positive), with a confidence from 0 to 1. All other fields contain a value with its confidence, both ranging from 0 to 1.

PersonState ALMood::personStateFromPeoplePerception(unsigned int ID)

Get the emotional state of the user with the identifier ID from PeoplePerception through a PersonState struct.

Parameters:
Returns:

A struct containing the values of each emotional descriptor of a person. See above.

PersonState ALMood::personStateFromUserSession(unsigned int ID)

Get the emotional state of the user with the identifier ID from UserSession through a PersonState struct.

Parameters:
Returns:

A struct containing the values of each emotional descriptor of a person. See above.

std::list<Person> ALMood::persons()

Get a list containing all the person present in the memory of the module through a Person struct.

Returns:A struct containing the persons detected by ALMood with their ID and emotional state.

This is organized as follows:

Person =
{
   "userSessionID" : usid,
   "personState" :
   {
     ...
     *See above*
     ...
   }
}

A person is created in this module each time UserSession creates a new user, and is forgotten by the time UserSession deletes this user.

AmbianceState ALMood::ambianceState()

Get the state of the ambient environement through a AmbianceState struct.

Returns:A struct containing the values of each emotional descriptor of an ambiance.

This is organized as follows:

AmbianceData =
{
   "agitationLevel" : value,
   "calmLevel" : value
}

Each field contains a value ranged from 0 to 1.

std::string ALMood::getEmotionalReaction()

Get the emotional reaction of the focused user.

This function looks for the first emotional reaction of the user, and returns when:

  • a positive or negative reaction is found, or
  • The timeout is reached.
Returns:The detected reaction.

For further details, see: Basic Emotions.

bool ALMood::subscribe(const string& subscribedName, const string& operatingMode)

Deprecated since version 2.5: ALMood is now managed by ALAutonomousLife. Subscribing in “Active” or “Passive” mode will have no effect.

Parameters:
  • subscribedName – Name of the subscriber.
  • operatingMode – Operating mode for ALMood.
Returns:

True if the subscription succeeded, False otherwise.

bool ALMood::unsubscribe(const string& subscribedName)

Deprecated since version 2.5: ALMood is now managed by ALAutonomousLife.

Unsubscribes the given subscriber from ALMood.

Parameters:
  • subscribedName – Name of the subscriber.
Returns:

True if the unsubscription succeeded, False otherwise.

map<string, string> ALMood::getSubscribersInfo()

Deprecated since version 2.5: ALMood is now managed by ALAutonomousLife.

Gets the list of parameters for all the current subscribers (name and operating mode).

Returns:A struct containing all the subscriber’s information.

This is organized as follows:

subscribers =
{
   "subscriber_1" : "Active",
   "subscriber_2" : "Passive"
}

Signals

std::string ALMood::valenceChanged()
Triggered:When the valence of the focused user changes, e.g. from neutral to positive.
Returns:The valence to which the emotion changed, one of “positive”, “neutral” or “negative”.
std::string ALMood::attentionChanged()
Triggered:When the attention of the human in front of the robot changes, e.g. from “unengaged” to “fullyEngaged”.
Returns:The state to which human’s attention changed, one of “unengaged”, “semiEngaged”, or “fullyEngaged”.
std::string ALMood::ambianceChanged()
Triggered:When the emotional ambiance around the robot changes, e.g. from “calm” to “excited”.
Returns:The ambiance to which the emotion changed, either “calm” or “excited”.
std::string ALMood::currentFocusedUserMood()

Deprecated since version 2.5: This signal has been replaced by the ALMood::valence() property.

Triggered:At each ALMood time period, every 1s by default.
Returns:The mood of the focused user.

For further details, see: Basic Emotions.

Properties

std::string ALMood::valence()
Triggered:At each ALMood time period, every 1s by default.
Returns:The valence of the focused user, when confidence is > 0.4. One of “positive”, “neutral” or “negative”.
std::string ALMood::attention()
Triggered:At each ALMood time period, every 1s by default.
Returns:The attention of the human in front of the robot, when confidence is > 0.4. One of:
  • “unengaged”: attentionLevel < 0.6
  • “semiEngaged” : 0.6 <= attentionLevel < 0.9
  • “fullyEngaged”: attentionLevel >= 0.9
std::string ALMood::ambiance()
Triggered:At each ALMood time period, every 1s by default.
Returns:The ambiance around the robot. Either “calm” or “excited”.
ValueConfidence<Float> ALMood::valenceLevel()
Triggered:At each ALMood time period, every 1s by default.
Returns:A structure with the valence and confidence of the focused user. Valence ranges from -1 (negative) to 1 (positive). Confidence ranges from 0 (unconfident) to 1 (confident).

Example:

float valence = ALMood.valenceLevel.value
float confidence = ALMood.valenceLevel.confidence
ValueConfidence<Float> ALMood::attentionLevel()
Triggered:At each ALMood time period, every 1s by default.
Returns:A structure with the attention and confidence of the focused user. Attention ranges from 0 when the user is not looking at all at the robot, to 1 when the robot is looking directly at the robot. Confidence ranges from 0 (unconfident) to 1 (confident).

Example:

float attention = ALMood.attentionLevel.value
float confidence = ALMood.attentionLevel.confidence
std::float ALMood::ambianceLevel()
Triggered:At each ALMood time period, every 1s by default.
Returns:The ambiance around the robot. It ranges from 0 (calm) to 1 (excited).