pythonnao-robotpepperchoregraphe

How to launch a NAO's behaviour by using dialog?


I found a way to start a behaviour by creating a dialog in Choregraphe, but it does not work.

The script of the dialog is the following:

u(keyword / key sentence): robot_response (optional) 
^start(applicationID/behaviour_1) 
^wait(applicationID/behaviour_1)

The robot (NAO, version 2.8.6.23) catches my keyword, says the expected response, but the behaviour does not start: the robot goes into stand-by and I have often to restart it. Anyway, the application seems to be running (by looking at active content). I tried to run manually the behaviour and it works well, so I don't understand what I'm doing wrong...

PS: Both the application and the dialog are installed on robot applications, of course.


Solution

  • Does your other behavior use dialogue? What could be happening is that applicationID/behaviour_1 tries to start listening / activate dialogue, and fails right away because there is already a dialogue running (the one you showed us).

    ^start is intended for simple behaviors like animations, if you want to actually launch another activity with it's own logic etc. you should use ^switchFocus instead of ^start - what that will do is stop your current behavior that has this dialogue (so, no need for the ^wait), and start a new one. This will only work if Autonomous Life is active - Autonomous Life's job is to orchestrate activities so that only one is active at a given time, to prevent bugs caused by a bit of background code in one behavior causing problems in another.

    ("activities" are basically behaviors that are intended to be "top level", like applications or games, as opposed to little things like animations that are fine to run in the background)