Creating a Solitary activity¶
Cannot be tested on a simulated robot.
This tutorial will show you how to create a Solitary Activity launched thanks to Trigger conditions.
Create the following solitary activity: when the robot does not detect anyone for 10 seconds, he says “Is anybody there? I feel lonely, hope someone will come soon!”.
Step 1: Create a Behavior¶
Step | Action |
---|---|
Create a new Project and save it as “my_first_solitary”. | |
Right click and rename “behavior_1” folder into “iamlonely”. | |
Drag and drop Speech > Creation > Animated Say box onto the Flow Diagram panel. | |
Connect its input to the main input of the Behavior and its output to the main output of the Behavior. | |
Double-click the Animated Say box and edit the Localized Text box content with: "Is anybody there? I feel lonely, hope someone will come soon!".
|
Test the Behavior
Step | Action |
---|---|
Click the Turn autonomous life off button. | |
Click the Play button. |
Result
Your robot says the sentence.
Step 2: Transform it into a Solitary Activity¶
Step | Action |
---|---|
Edit the Project Properties. | |
Set the Application description. For example, you could write: This application contains the following solitary activity: when the robot
does not detect anyone for 10 seconds, he says
"Is anybody there? I feel lonely, hope someone will come soon!".
|
|
Copy the auto-generated Application ID, you will need it to write the Trigger conditions. | |
In the Package content, select the Behavior “iamlonely” in order to display its properties. | |
Set:
|
Test the solitary Activity
Step | Action |
---|---|
Save the Project. | |
In the Robot Applications panel, click the Package and install the current project to the robot button. | |
Click the Turn autonomous life on button. | |
Remain out of reach of your robot for 10 seconds. |
Result
Your robot says the sentence only once, and will not repeat it until another Activity take place.
Understanding the Trigger conditions¶
We want our solitary activity to be autonomously started when no person has been detected for 10 seconds. Thus we are using the event Launchpad/PeopleNotSeen and the trigger condition looks like this:
('Launchpad/PeopleNotSeen' == 1) ~ 10)
However as we do not want our application to be started continuously if there is none around the robot, we added another condition:
('Launchpad/PreviousActivity' != "solitaryactivitysample/iamlonely")
This Condition makes sure that the activity will be started only once in a row. The activity will be able to be focused again if another activity has been focused in the meantime.
Thus the final launch trigger condition of our activity becomes:
Expression part ... | Means ... |
---|---|
(‘Launchpad/PeopleNotSeen’ == 1) ~ 10) | no people is seen during 10 seconds, |
&& | and |
(‘Launchpad/PreviousActivity’ !=”<my_application_id>/iamlonely”) | the last activity was not “iamlonely”, i.e. another Activity took place since the last loneliness complain. |
To go further¶
To discover all events and expressions you may use as Launch trigger condition, see: