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


TABLE OF CONTENTS


CREATE A BEHAVIOR

  • 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.
  • 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

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

Result

Your robot says the sentence.


TRANSFORM IT INTO A SOLITARY ACTIVITY

  • 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:

    • the Name with “I am lonely”,
    • the Nature with “Solitary” and
    • the Launch trigger condition with
  • (('Launchpad/PeopleNotSeen' == 1) ~ 10) && ('Launchpad/PreviousActivity' !=
    "<my_application_id>/iamlonely")

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

    ../../../_images/tuto_solitary.png



Test the solitary 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 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: