Creating an Interactive activity¶
Cannot be tested on a simulated robot.
This tutorial will show you how to create an Interactive Activity launched thanks to Trigger conditions or Trigger sentences
Create the following interactive activity: when somebody’s in zone 2 or when saying Great Success, the robot congratulates the user on the successful launch of the activity.
Step 1: Create a Behavior¶
Step | Action |
---|---|
Create a new Project and save it as “my_first_interactive”. | |
Right click and rename “behavior_1” folder into “congrats”. | |
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: Hello, congratulations on your first interactive application!
Let's hope you will do a lot of them so we can do more and more things together.
|
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 an Interactive Activity¶
Step | Action |
---|---|
Edit the Project Properties. | |
Set the Application description. For example, you could write: This application contains the following interactive activity: when
somebody's in zone 2, or when the interacting user says "Great Success",
it congratulate the user on its first interactive activity.
|
|
Copy the auto-generated Application ID, you will need it to write the Trigger conditions. | |
In the Package content, select the Behavior “congrats” in order to display its properties. | |
Set:
|
Test the interactive 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 at 2~3 meters in front of your robot. | |
Go close until dialog/speech recognition triggers, say “Great Success”. |
Result
Your robot says the congratulation sentence only once, and will not repeat it until another Activity take place, or you say “Great success” again.
Understanding the Trigger conditions¶
We want our interactive activity to be autonomously started when there is someone detected at some distance for 5 seconds. Thus we are using the event Launchpad/NumPeopleZone2 and the trigger condition looks like this:
('Launchpad/NumPeopleZone2' > 0) ~ 5
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' != "<my_application_id>/congrats")
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/NumPeopleZone2’ > 0) ~ 5 | At least one person seen in Zone 2 during 5 seconds. |
&& | and |
(‘Launchpad/PreviousActivity’ !=”<my_application_id>/congrats ”) | the last activity was not “congrats”, 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: