Autonomous Abilities¶
What are Autonomous Abilities¶
Autonomous Abilities exist to keep the robot alive at all times.
For example, they may cause the robot to move, or may animate his LEDs.
List of Autonomous Abilities¶
Autonomous Ability | Description | For further details see ... |
---|---|---|
AutonomousBlinking | Enables the robot to make its eye LEDs blink when it sees someone and when it is interacting. | ALAutonomousBlinking |
BackgroundMovement | Defines which slight movements the robot does autonomously when its limbs are not moving. | ALBackgroundMovement |
BasicAwareness | Allows the robot to react to the environment to establish and keep eye contact with people. | ALBasicAwareness |
ListeningMovement | Enables some slight movements showing that the robot is listening. | ALListeningMovement |
SpeakingMovement | Enables to start autonomously movements during the speech of the robot. | ALSpeakingMovement |
How it works¶
Autonomous Life states modify Autonomous Abilities configurations¶
Each time ALAutonomousLife enters into a new State or reinforce the current one (when an Activity starts or stops), the Autonomous abilities are set into a specific configuration.
Autonomous Abilities configurations are set depending on Autonomous Life states, as shown in the following table:
Autonomous Life state | |||
---|---|---|---|
Disabled | Solitary | Interactive | |
AutonomousBlinking | Disabled | Disabled | Enabled |
BackgroundMovement | Disabled | Enabled | Enabled |
BasicAwareness | Disabled | Enabled | Enabled |
Types of stimulus Sound, Movement, People and Touch |
Types of stimulus Sound, Movement, People and Touch |
||
Engagement Mode Unengaged |
Engagement Mode FullyEngaged |
||
Tracking Mode
|
Tracking Mode
|
||
ListeningMovement | Disabled | Enabled | Enabled |
SpeakingMovement | Enabled | Enabled | Enabled |
Mode contextual |
Mode contextual |
Mode contextual |
Priority between the Autonomous Abilities¶
Each Autonomous Ability has an enabled and a running boolean value:
- enabled value means the Autonomous Ability has right to move the robot.
- running value means the Autonomous Ability is currently running.
There is some priority between the Autonomous Abilities, that causes constraints in the running boolean values:
- BackgroundMovement will not be running when ListeningMovement or SpeakingMovement is running.
- ListeningMovement will not be running when SpeakingMovement is running.
- SpeakingMovement has the highest autonomous ability priority.
Note
AutonomousBlinking and BasicAwareness don’t deal with the priorities between the autonomous abilities because they can run in parallel.
Customizing Autonomous Abilities¶
In some cases, you may want to disable all or part of the Autonomous Abilities or at least customize the configuration of the underlying feature.
Note
Best practice: do not disable unduly
If you have the need to sometimes stop an Autonomous Ability, you should still keep it running as much as possible, or provide equivalent customized functionality in your Activity in order to keep your robot continuously alive.
How to enable/disable Autonomous Ability¶
- Methods:
Example in python
alautonomouslife_setautonomousabilityenabled.py
#! /usr/bin/env python
# -*- encoding: UTF-8 -*-
"""Example: Use setAutonomousAbilityEnabled Method"""
import qi
import argparse
import sys
def main(session):
"""
This example uses the setAutonomousAbilityEnabled method.
"""
# Get the service ALAutonomousLife.
life_service = session.service("ALAutonomousLife")
life_service.setAutonomousAbilityEnabled("BasicAwareness", True)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
parser.add_argument("--port", type=int, default=9559,
help="Naoqi port number")
args = parser.parse_args()
session = qi.Session()
try:
session.connect("tcp://" + args.ip + ":" + str(args.port))
except RuntimeError:
print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
"Please check your script arguments. Run with -h option for help.")
sys.exit(1)
main(session)
How to modify Autonomous Ability parameters¶
To customize Autonomous Ability parameters, use the API of the corresponding service, see: