Example of SubtreeJs

Can someone upload or show how to use SubtreeJs? What does the behavior want for the first parameter ‘getFilename:’

Tried
behaviorPath = ‘…/staries/threePigs/behaviors/ThreePigs.bt’;
and
callback(’…/staries/threePigs/behaviors/ThreePigs.bt’);
get error ‘Uncaught TypeError: this.options.getFileName is not a function’

mark_r80

Hi @mark_r80,

In the getFileName part of the behavior arguments pane for SubtreeJS you should be able to put code that looks like this:

(callback) => {
callback('idle');
}

An example of what this would look like in use you can also see the below screen from the SDK showing how to have the SubtreeJs behavior encapsulate one of our default included .bt files, idle.bt:

It is worth noting that the example in that screen would still work if you appended .bt onto the end of idle but adding the rest of the path in (like behaviors/idle.bt) would likely throw an error like the one you were receiving.

Finally, it may be helpful to note that (as seen in our API docs here) getFileName assumes the root of all .bt files is in ${project}/behaviors.

I hope that is helpful!

-John

Hi John W. Thanks for the answer. I tested and get the same error. I also tested it using Subtree and it worked. I am running jibo-skd 1.2.7 and atom is not asking to update. I see on github.com/jiborobot/jibo-sdk/releases 1.7.1 is the latest. I am running on Windows 7.

Do I need to do the disable, uninstall, reinstall, routine?

Mark_R80

Hi Mark,

Yes, I would recommend disabling and then uninstalling the jibo SDK package followed by reinstalling to get version 1.7.1.

When you are updated to that version I would recommend running npm install in the directory for your skill where you are using SubtreeJS.

If you continue to see this error I would recommend doing a test of using SubtreeJS in a project created after updating to 1.7.1. If it works there but not in your existing project there may be some steps I can recommend. I would also recommend making sure you meet all of the system requirements/decencies seen here.

Lastly, it is worth noting that there is a possibility that there is something about Windows 7 that might be causing the issue. We have seen some versions of the SDK work on that operating system but as noted in our requirements the SDK is not guaranteed to work on anything below Windows 8.

Let me know if the above clears up the error you are seeing and, if it does not, I will do everything I can to recommend further steps keeping in mind that that there may be a limit to what I can recommend with the SDK running on Windows 7.

Thank you again,
John

1 Like

Hi John W. I did the disable, uninstall, reinstall, routine for jibo-skd and how have 1.7.1, ran (as administator) npm install (GNU bash, version 4.3.42(5)-release (x86_64-pc-msys)
) in the folder of my project (skill) and still get the same error. I then created a new project (skill), then created a behavior like yours (subtreeJs, callback(‘idle’):wink: and got joy! (it worked). I reran (as administator) npm install on my stroy skill and get the same error ‘this.option.getfilename is not a funtion’. Yes I can recreate my story skill but would like to try your next ‘there may be some steps I can recommend’ suggestion.

Thanks for the help!

Mark_R80

John W., I tested SubtreeJs in my new skill with the path of ‘callback(’…/staries/threePigs/behaviors/ThreePigs’);’ and it worked. Would like more steps to fix my ‘jibo-story’ skill please.

Mark_R80

Hi Mark,

There are two things that may be going on and, in either case, I would like to take a more direct look at your skill.

The two things that may be happening are:

  1. After you ran npm install in your previously existing story skill did you replace the subtreeJS behavior with a new SubtreeJS behavior? I would recommend doing that. The error you are seeing may have to do with the way the subtreeJS behavior was being constructed in the 1.2.7 version of the SDK. If that is the case there would not be a need to recreate your skill, just to replace any subtreeJS behaviors with new, matching behaviors created in 1.7.1.

  2. It may have to do with the structure of your skill (for instance, if the .bt file you were trying to call in subtreeJS was not in the default behaviors folder) or if the new node modules didn’t get added as expected when you ran npm install on your story skill. I’d be more than happy to check this for you and see if there is anything else I can find. If that would be ok, I can take a look if you provide a github link I could use to download your skill.

Hi John W.
Just tried the remove SubtreeJs and add it back in, set parameters and get same error. Also deleted test.bt behavior tree and added it back in as test02.bt then added Subtreejs, set parameter and get same error. I am going to recreate / copy files my story skill as there are other things that need to be cleaned up.

I do not have a github account but plan to get one and upload this story skill to a link on discuss.jibo.com/c/jibo-sdk/skills-showcase.

Mark_R80

Hi Mark,

That sounds good. Again, there may only be so much I can recommend when the skill/SDK is running on a below Windows 8 machine but if you recreate/copy files for your story skill and post it either in this thread, to the skill showcase, or send a link to me via direct message here in the forum I would be very happy to take a direct look and see if there is anything else I can recommend. :slight_smile: