# SoftBank Robotics documentation What's new in NAOqi 2.8?

# ALBasicAwareness API

NAOqi Interaction engines - Overview | API | Getting started

Namespace : AL

    #include <alproxies/albasicawareness>

## Method list

As any module, this module inherits methods from ALModule API. It also has the following specific methods:

class `ALBasicAwarenessProxy`

- `ALBasicAwarenessProxy::setEnabled`
- `ALBasicAwarenessProxy::isEnabled`
- `ALBasicAwarenessProxy::isRunning`
- `ALBasicAwarenessProxy::pauseAwareness`
- `ALBasicAwarenessProxy::resumeAwareness`
- `ALBasicAwarenessProxy::isAwarenessPaused`
- `ALBasicAwarenessProxy::isStimulusDetectionEnabled`
- `ALBasicAwarenessProxy::setStimulusDetectionEnabled`
- `ALBasicAwarenessProxy::setEngagementMode`
- `ALBasicAwarenessProxy::getEngagementMode`
- `ALBasicAwarenessProxy::engagePerson`
- `ALBasicAwarenessProxy::triggerStimulus`
- `ALBasicAwarenessProxy::setTrackingMode`
- `ALBasicAwarenessProxy::getTrackingMode`
- `ALBasicAwarenessProxy::setParameter`
- `ALBasicAwarenessProxy::getParameter`
- `ALBasicAwarenessProxy::resetAllParameters`
- `ALBasicAwarenessProxy::startAwareness` (deprecated)
- `ALBasicAwarenessProxy::stopAwareness` (deprecated)
- `ALBasicAwarenessProxy::isAwarenessRunning` (deprecated)

## Events lists

- `ALBasicAwareness/StimulusDetected()`
- `ALBasicAwareness/HumanTracked()`
- `ALBasicAwareness/HumanLost()`

## Methods

void `ALBasicAwarenessProxy::``setEnabled`(bool enabled)

  Enables or disables basic awareness.

  Parameters: | enabled – True to enable it, false to disable it.

bool `ALBasicAwarenessProxy::``isEnabled`()

  Returns whether basic awareness is enabled.

  Returns: | True if it is enabled, False otherwise.

bool `ALBasicAwarenessProxy::``isRunning`()

  Returns whether basic awareness is actually running, i.e. is started and not paused (neither manually nor automatically).

  Returns: | True if it is running, False otherwise.

void `ALBasicAwarenessProxy::``pauseAwareness`()

  Manually pauses ALBasicAwareness. For further details see: Pausing and Resuming.

void `ALBasicAwarenessProxy::``resumeAwareness`()

  Manually resumes ALBasicAwareness. For further details see: Pausing and Resuming.

bool `ALBasicAwarenessProxy::``isAwarenessPaused`()

  Gets the status (paused or not) of the module.

  Returns: | Boolean value: true if the module is paused, false otherwise.

void `ALBasicAwarenessProxy::``setStimulusDetectionEnabled`(const std::string stimType, const bool enable)

  Enables/disables detection of the specified type of stimulus.

  Parameters: | stimType – Type of stimulus. For further details, see: Types of stimulus. enable – true to enable, false to disable.

bool `ALBasicAwarenessProxy::``isStimulusDetectionEnabled`(const std::string stimType)

  Gets status enabled/disabled for the detection of the specified type of stimulus.

  Parameters: | stimType – Type of stimulus. For further details, see: Types of stimulus.
  Returns: | true if enabled, false if disabled

Note

Throws AL::ALError if setting fails.

void `ALBasicAwarenessProxy::``setEngagementMode`(const std::string& modeName)

  Sets the engagement mode.

  Parameters: | modeName – Name of the engagement mode to be set. For further details, see: Engagement Modes.

std::string `ALBasicAwarenessProxy::``getEngagementMode`()

  Gets the current engagement mode. For further details, see: Engagement Modes.

  Returns: | The engagement mode name.

bool `ALBasicAwarenessProxy::``engagePerson`(const int idPersonToEngage)

  Forces the robot to engage a person identified by its PeoplePerception ID.

  Parameters: | idPersonToEngage – ID of the person to engage, as it can be found in `PeoplePerception/PeopleList()`.
  Returns: | true if the robot succeeded to engage the person, else false.

int `ALBasicAwarenessProxy::``triggerStimulus`(const std::vector<float>& positionFrameWorld)

  Triggers a custom stimulus that will be processed as other stimuli, but with a higher priority.

  Parameters: | positionFrameWorld – position of the custom stimulus in Frame World.
  Returns: | The ID of the found human if any, as referenced in `PeoplePerception/PeopleList()`, or -1, if no human has been found.

void `ALBasicAwarenessProxy::``setTrackingMode`(const std::string& trackingMode)

  Sets the current tracking Mode.

  Parameters: | trackingMode – name of the tracking mode. For further details, see: Tracking Modes.

std::string `ALBasicAwarenessProxy::``getTrackingMode`()

  Gets the current tracking mode.

  Returns: | the tracking mode name. For further details, see: Tracking Modes.

void `ALBasicAwarenessProxy::``setParameter`(const std::string& paramName, const AL::ALValue& paramValue)

  Sets parameters related to basic awareness features.

  Parameters: | paramName – name of the parameter, among the following:

  - “LookStimulusSpeed”: speed of head moves when looking at a stimulus (float in ]0;1]),
  - “LookBackSpeed”: speed of head moves when looking back to previous position after false alarm (float in ]0;1]).

  Parameters: | paramValue – value of the parameter to be set (ALValue).

AL::ALValue `ALBasicAwarenessProxy::``getParameter`(const std::string& paramName)

  Gets parameters related to basic awareness features.

  Parameters: | paramName – name of the parameter, among: “LookStimulusSpeed”, “LookBackSpeed”.
  Returns: | value of the parameter (ALValue).

void `ALBasicAwarenessProxy::``resetAllParameters`()

  Resets all parameters to their default values.

void `ALBasicAwarenessProxy::``startAwareness`()

  Deprecated since version 2.4: use `ALBasicAwarenessProxy::setEnabled` instead.

  Starts basic awareness.

void `ALBasicAwarenessProxy::``stopAwareness`()

  Deprecated since version 2.4: use `ALBasicAwarenessProxy::setEnabled` instead.

  Stops basic awareness.

bool `ALBasicAwarenessProxy::``isAwarenessRunning`()

  Deprecated since version 2.4: use `ALBasicAwarenessProxy::isRunning` instead.

  Gets the status (started or not) of the module.

  Returns: | Boolean value: true if the module is started, false if it’s stopped or paused.

## Events

Event: `"ALBasicAwareness/StimulusDetected"`
callback(std::string eventName, std::string stimulusName, std::string subscriberIdentifier)

  Raised when a stimulus is detected.

  Parameters: | eventName (std::string) – “ALBasicAwareness/StimulusDetected” stimulusName – Name of the stimulus detected. See the names of the available stimuli in section Stimuli Types. subscriberIdentifier (std::string) –

Note

To know if a person is detected in the general case, use the event HumanTracked rather than the event StimulusDetected with the value People. For example, if the robot detects a person thanks to a sound stimulus, the robot will raise the event StimulusDetected with the value Sound, then recognize the person and raise the event HumanTracked with a positive ID, but the event StimulusDetected won’t be raised with the value People.

Event: `"ALBasicAwareness/HumanTracked"`
callback(std::string eventName, int humanID, std::string subscriberIdentifier)

  Raised when the robot begins to track a person, when the tracked person is lost, or when the tracked person’s ID is updated.

  Parameters: | eventName (std::string) – “ALBasicAwareness/HumanTracked” humanID – The ID of the currently tracked person. If no person is tracked, the value is -1. subscriberIdentifier (std::string) –

Event: `"ALBasicAwareness/HumanLost"`
callback(std::string eventName, std::string subscriberIdentifier)

  Raised when the person tracked can no longer be found for some time.

Glossary Site map Index Support Contact Legal Notices