Pepper Tutorial

From Control Systems Technology Group
Revision as of 11:13, 9 March 2018 by S142803 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Adding dialogue boxes

Dialogue boxes can be added by accessing box libraries and to click speech > creation. Select Dialog and drag the box into the root screen.

Script

To change the dialogue box script, access Project Files and doubleclick the .top file to modify the script.

Questions can be noted by [ u: ]. Between the brackets, words or sentences can be written that the robot will recognise. The robot will answer with the words or sentences behind the brackets, and with every try, the robot will select the next answer in the written order. Example;

u: (Word1 Word2 “Sentence1”) Answer1 Answer2 “Sentence2”

Concepts

Concepts can be written as [ concept: ] with the name between brackets. After this, the words that match the concept (that the robot will recognise if used in that way) should be written down in curly brackets. Example, where the robot gives a random greeting back when a greeting is given;

Concept: (greeting) {Hello Hi Hey “Hi there”} 
u: (~greeting) ^rand ~greeting

^rand can be used, so the robot selects a “random" answer from the concept, otherwise the robot will follow the given order.

Motions

Add a certain animation to the screen (many can be found in box libraries). Rightclick the corresponding dialogue box and edit the dialogue box (rightclick, edit box). Add a new output with a corresponding name (outputnew). Connect the output to the animation box. It might be smart to add a “wait” box too. Add the following code to access the motion;

u: (Hello) Howdy $outputnew=1

Animations

In the script editor, to start a certain motion, write;

^start(animations/Stand/Gestures/Enthusiastic_5)

The robot will do the motion until the spoken sentence is over. To make the robot finish its animation (if the spoken sentence is shorter than the animation), write;

^wait(animations/Stand/Gestures/Enthusiastic_5)

Different topics

When editing the dialogue box (rightclick, edit box), you can change the topic. Add a new dialogue box with a different topic and connect this box with the initial state (for example, a box that selects the language). The robot can recognise questions in any topic. When hearing a question from a certain topic, the robot will switch to that topic and answer the question.

Questions can be made private. This means that the robot will ‘’only’’ recognise this question if the robot is talking about the according topic. So if a private question from another topic is asked, the robot will simply not respond. This can be done by writing ^private before a question.

Proposals

The robot can give a proposal when no specific input is given. Proposals can be labeled by using the % sign, and going to a labelled proposal can be done by using ^goto. Example;

Proposal: %AskFeeling How are you feeling? 
u1: (_*) Ohh, so you are feeling $1 right now! $feeling=$1
u: (How am I feeling now?) I don’t know, ^goto(AskFeeling)

As shown, given answers can be saved by using $storedvalue=$1, where $1 represents the word you used. It also possible to switch between proposals;

^nextproposal, the robot will move to next proposal in the list. ^previousproposal saves the one-but last proposal that is made/said, and repeats that proposal (note that this is not the same as going back 1 step in the list!).

Possible symbols in questions

^repeat: robot recognises any combination of the given words (can be one of the words, all of them or just some in a random order). Example;

u: (^repeat[Hi hello hey])

Curly brackets; the word(s) between the curly brackets are optional. Example;

u: (hey {robot} how are you)

Squared brackets with curly brackets; any word/sentence between the brackets are recognised. Example;

u: hey {[robot you there]}

Asterisk; the user can say ‘any word’ here, and the robot will recognise this. Keep in mind that using this asterisk too much, can make the dialogue system weaker. Example;

u: (hey * how are you)

The underscore can be used when any of the “following” words can be used. $1 can be used to store the given answer (and you can also save this, as mentioned before). To clear this answer somewhere, ^clear can be used. Example;

u: (I like _[cheese chocolate]) Yes, $1 sounds delicious $food=$1

SubQuestions

When the answer a person gives depends on what the robot will ask/proposed next, subquestions can be used. An example is shown below. When answering “bad”, the robot will not recognise the input “good” anymore, because the robot is in the branch of the “bad”. But when in any branch, the robot will recognise any other question (that’s not a subquestion of a different branch) and switch to that if asked.

u: (what’s up) Hi, how are you? 
u1: (good) glad!
u1: (bad) sad.. Chocolate?
u2: (yes) Okey!
u2: (no) No problem!

(Temporary) knowledge robot

If an answer of an input contains a stored value that is not known yet, the robot will not respond to the asked question. To fix this, ^first can be used in the following way:

u:(what is my name?) ^first[“your names is $name” “I dont know ^goto(askName)”] 
Proposal: %askName What’s your name?
u1: (_*) Nice to meet you, $1! $name=$1.

The robot always prefers the first answer (Your name is $name), but if $name isn't known, then the robot will go to the second answer, which asks the name.

Some very useful links

  • A very handy cheat sheet can be found here: [1]
  • A lot of information about syntaxes in dialogue boxes can be found here: [2]

References