no-virtual 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.


TABLE OF CONTENTS


Create a Behavior

  • 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

  • Click the life-buttonTurn autonomous life off button.
  • Click the play-buttonPlay button.

Result

Your robot says the sentence.


Transform it into an Interactive Activity

  • 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:
    • the Name with “Congratulations”,
    • the Nature with “Interactive”,
    • the Trigger sentences with “Great Success” (panel on the right),
    • the Loading responses with “Let me check” (panel on the right) and
    • the Launch trigger condition with
(('Launchpad/NumPeopleZone2' > 0) ~ 5)
&& ('Launchpad/PreviousActivity' !="<my_application_id>/congrats")

Where <my_application_id> is the Application ID you have previously copied.

../../../_images/tuto_interactive.png



Test the interactive Activity

  • Save the Project.
  • In the Robot Applications panel, click the install_apps-buttonPackage and install the current project to the robot button.
  • Click the life_off-buttonTurn 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) ~ 5At 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: