Wait a few seconds for thank you before listening for "Hey Jibo" again


#1

Is there a way to set a timer so that at the end of a sequence Jibo will remain attentive for say 5 seconds before requiring “Hey Jibo” to get attention again. This would allow for thank you’s to be acknowledged by Jibo.

Thanks!


#2

Hi @codemonkey2k5,

One way is to add a new child behaviour called TimeoutJS and apply the appropriate milliseconds

For example usage see the jibo sample codes examples (prefixed 06-, 08-, 12-) in the behaviors folder at git jibo sample code

Also, you might see some other applications and examples in the documentation site at jibo sdk - search “timeoutjs” and you’ll find the text tutorials that walk you through some examples - these offer details on the jibo example code I mentioned.
You might also check out the decorator called “TimeoutSucceedJs” if you need later :wink:

Best, Bob


#3

Thank you Bob, the resources you point out will be very helpful in my learning. The child behavior option does indeed delay the execution of my execute script “notepad.listenForHeyJibo = true” but Jibo doesn’t actually listen for my thank you during that delay. I’m teaching myself JavaScript and Jibo dev (today is day 1) so it’s taking a bit of work to wrap my head around the various puzzle pieces. based on what I am reading, (and I could very well be misunderstanding it) a decorator wont work for this.

It seems that Jibo operates on a variation of ladder logic. Assuming that there is a loop running, It seems that when a behavior sequence runs and gets to the execute script, if “notepad.listenForHeyJibo =false” the loop starts running again but leaving jibo ready for the next rule. So likely I need to add the timeoutjs somewhere else in the loop. The trick is knowing where to put it. I haven’t gotten that far yet.

Regards,
Tony


#4

Regarding “ladder logic” and puzzle pieces, there’s a nice intro on Jibo Behavior trees and behavior states ( BT resources ) I found that the sample code helped me comprehend the beta api in more bite size pieces :wink: (check the site installation instructions about changing the root starting behavior) - Initially I started tweaking the basic samples with my own mini-scenarios to learn more.

17-make-reservations.bt is a good starting place for the listen behavior (see order.rule)

change the root behavior in the main.js:

let root = jibo.bt.create(’…/behaviors/17-make-reservations’);

hope that helps


#5

Yup, like Bob said, you’ll want to use a TimeoutSucceed to do this. Just add a Sequence to the very end of your skill with a TimeoutSucceed Decorator set to the amount of time you want Jibo to wait for a “thank you” (e.g. 10000 ms). Then, right-click the Sequence and add a child Listen behavior. It should look like this in the end:

Attached to the Listen behavior, you could have a rule file like “thankyou.rule”:

TopRule = $* (
    # Add your rules and responses here
    ( $thankyou )
) $*;
# Simple words and phrases
thankyou = (thanks | (thank you));
```

Just make sure to set the heyJibo option to false in the getOptions parameter of the Listen behavior:

```
let options = {
     heyJibo: false,
     detectEnd: false,
     incremental: false,
     authenticateSpeaker: ''
}
```

Hope that helps get your started.

#6

Thanks guys!

This is really helpful.
I’ve managed to get Jibo to the point where he can control all of my home automation (insteon and harmony via IFTTT), go to sleep on command and now he’ll wait for acknowledgment which will make those commands feel more natural. Fairly good for two days. :slight_smile:


#7

Sounds great! It just goes to show how great a platform the Jibo SDK is that you can do things that are seemingly very complex in a small amount of time. Don’t be shy about sharing your code if you think others could benefit. :slight_smile: Congrats on your new skill!