State machine management ¶
Activities are what you develop to extend the abilities and personality of the robot. In essence, you create his life! An Activity is a Behavior that is developed with Choregraphe , which has been given a Solitary or Interactive nature. This Nature registers it to function within ALAutonomousLife . The Choregraphe Activity documentation discusses how adjust these project properties.
How are Activities started? ¶
- By a user interacting with the robot, if they specifically ask the robot to start an activity.
- Autonomously by ALAutonomousLife , through the use of Launch trigger conditions .
- Programatically through ALAutonomousLife , by the switchFocus() API . Thus, your Activities can switch focus to other Activities.
Before an activity is focused, Autonomous Life will enforce a State change . This cleans up the robot’s State so that your Activity will always be started in the same predictable State. Likewise, you can do anything to the robot’s State during your activity, and Autonomous Life will clean it up after your activity exits.
Only one Activity can be running or “focused” at a time. The Autonomous prioritization determines how an Activity may be interrupted.
What are Solitary and Interactive Activities? ¶
Why don’t I have control of the robot during my Activity? ¶
Though the robot is acting autonomously, in fact you do have control! Autonomous Life will act during your Activity only in the following cases:
- Actions coming from running Autonomous Abilities . You can selectively parameterize or disable these to gain full control when you need to. The abilities will not be re-enabled until you tell them to. The Autonomous Abilities are low-priority; your own control of the robot will take priority. So under normal circumstances it is not necessary to disabled these services. Please keep these abilties running as much as possible to keep your robot continuously alive!
- Solitary Activities are interrupted in favor of Interactive Activities, see States and Autonomous prioritization .
- If something causes the robot to enter Safeguard State , which will stop your activity.
- If the Context of the robot is no longer compatible with your Activity, it will be stopped.
Using Context to start your activity ¶
Creating a Solitary activity tutorial shows how to autonomously start an Activity.
As previously mentioned, whenever an Activity is focused, ALAutonomousLife will enforce a State change to provide consistent runtime configuration appropriate for the current Context. This gives a deterministic setup to your Activities, and a consistent experience to users.
This is the default State of the robot when Autonomous Life starts, and when no Activity is running.
The main purpose of the Solitary State and Solitary Activities is to prepare the robot for future interaction with people. Thus, in this State the robot is optimally configured for finding them. This State consumes higher baseline CPU than Interactive.
Another purpose of Solitary is to prepare people to interact with the robot. The robot primarily does this by looking alive. For example responding to stimulus originating from the environment and people, or possibly doing things to attract people.
As the robot is not currently busy in a one-to-one interaction with a person, the Solitary State is an opportunity for the robot to do things “for himself”, such as exploring or learning passively. But ultimately this is done for the sake of better future interaction with people.
The robot’s main goal is to Interact with people, so Solitary State and Activities are interrupted in favor of the Interactive State and Activities, to better serve people. See Autonomous prioritization .
So, though the word “Solitary” is used, it does not necessarily mean that the robot is alone in the room. It means that the robot’s main concern is not currently a specific one-to-one Interaction.
The Solitary State can be thought of as self driven , the robot is making decisions by himself.
The Interactive State will be entered when an Interactive Activity is focused.
The main purpose of the Interactive state is to specifically serve people in a one-to-one interaction. This is ultimately the robot’s main goal in life.
In Interactive State, the robot assumes that he has found the humans who he should be interacting with, and they are in very close proximity. Thus he is no longer configured for finding them, but for interacting with them. The baseline CPU consumption is lower than Solitary State to provide an optimal ALDialog experience.
The Interactive State can be thought of as people driven , the robot is obeying commands from people.
If the robot’s hardware is having trouble, or if the environment is unsafe, this State will be entered and the current Activity stopped. After the trouble has passed, the Solitary State will be re-entered.
If your Activity is equipped to handle a specific Safeguard case, you may use the setSafeguardEnabled() API to tell ALAutonomousLife to not enter Safeguard State in this case. For example, if your Activity has implemented special handling for when the robot is pushed, it is not necessary for your Activity to be stopped.
From Disabled State, all Autonomous Abilities are stopped, and no Activities may be focused. Safeguard State may not be entered.
If you would prefer ALAutonomousLife to be in Disabled State upon bootup, this can be configured for NAO and Pepper . This may be useful for specific research or testing scenarios. but we encourage you to keep your robot alive because living robots are the future and provide a more enriching experience!
Autonomous prioritization ¶
- During a Solitary Activity, an Interactive Activity may interrupt it to take the focus.
- If a Solitary and Interactive Activity both have true conditions at the same time, the Interactive will get priority.
- A Solitary Activity will not interrupt another Solitary Activity.
- An Interactive Activity will not interrupt another Interactive Activity.
- When multiple Activities have true conditions at the same time, the one that was focused least recently will get priority.
- Safeguard State has the priority over all Activities.
- Programmatic calls to switchFocus() permit you to start an Interactive Activity from either Solitary/Interactive State, or a Solitary Activity from Solitary State. But you cannot start a Solitary Activity from Interactive State.