Step 5: Make Your Robot to Ask Question to You
This step shows you how you can add a question from the robot to the user.
1. Open the file created in step 4 (Step1.dlgxml).
2. Add a new input sentence.
Add a new input sentence to Dialogue 3. First, select Dialogue 3 in the dialog list.
Then, add the sentence 'Please move' to the input sentence list.
Note that when the user says 'Please move', the robot does not know whether
it should move fast or slow, therefore, the robot needs to ask the user.
3. Add a condition
When you say, for example, 'Move fast', the motor action is executed with
the speed variable set to 100 (as explained in step 4).
However, when you say 'Please move', the speed variable is undefined.
Therefore, the motor action should not be executed in this case.
That means you will have to add a condition that executes the actions
only if the speed variable is defined.
This is done by selecting the 'Defined' operation from the data menu in the
command box.
Set the operation to 'Defined' and the variable to 'Speed':
You will see that as a result of this action, a new condition has been added
to the condition list in the dialog box.
This means that the actions associated with this dialog (in this case, to start the motor)
are only executed if the variable 'Speed' is defined.
If the user says 'Move fast' or 'Move slow', the variable 'Speed' is set to 100, or 50,
respectively; therefore, the actions are executed.
However, if the user simply says 'Please move', then the variable 'Speed' is undefined,
and the actions are not executed.
You can try this for yourself by clicking one of the Connect to Robot buttons now.
Say 'Move fast' and then 'Please move'.
4. Create a question from Robot to You
When the user says 'Please move', we want the robot to ask how fast it should move.
To do so, we need to create a question.
You can create a question by clicking the 'Create' button in the question list.
As a result, a question named 'Question' is created and added to the question list.
Also, background color of the dialog box changes from yellow to green to indicate
that you are now working on a question from the robot to the user.
The result of creating a question looks like this:
5. Specify the form of the question to You
Click the sentence 'Question from robot to user' in the Action box to specify
what the robot should ask the user.
Then, type the questions the robot should ask.
If you add more than one question, the system will pick one question randomly.
The result should look similar to this.
6. Add a condition
We want the robot to ask for the speed only if it does not yet know the speed.
Therefore, we need to add a condition to this question, making sure that the
question is only asked if the variable 'Speed' is undefined.
To do so, we select the 'Undefined' operation from the data menu in
the command box:
and set the operation to 'Undefined' and the variable to 'Speed'.
The result should look like this:
7. Specify Your Answers to the Question
We need to add the possible answers from the user to the question
in the right sentence list:
For each answer from the user, we need to define the variable value for the speed
variable. For example, we want the speed set to 50, 75 and 100,
respectively, for the user's answers 'slow', 'fast' and 'very fast'.
To define the values, click on one of the sentences and add the
corresponding equation in the equation box as explained in
Step4.
8. Test
You can now test by clicking one of the Connect to Robot buttons.
When saying 'Please move', you should hear a question from the robot,
such as 'How fast would you like me to move?'.
When answering 'Slow', the motor will start turning.
Through the five steps, you have learned basics of how to use GoTalk.
Now please enjoy creating your original interactions and
send your movies to our Community Pages.
Tutorial Top
|