Robot Not a Dev? Buy Now
Not a Dev?

Misty Community Forum

Blockly Js + JSON files

Greetings Misty community,

Just received Misty, and very much looking forward to quickly ramping up my programming skills. I plan to work through the getting started tutorials over the next week, but had a quick question about Blockly, and uploading some basic code in the interim.

In Blockly I was able to create some basic code snippets that worked when I ran them within the Blockly UI. I’m having trouble figuring out how to upload the code to Misty through the Command Center. When I download the code from Blockly and try to install them via the Skill Runner it gives the error, “skill files must be accompanied by the JSON meta file”.

Would this be uploading 2 files? Or would I add the code to a JSON file so it’s one holistic code block (i.e. 1 file)?

I did download VS Code over the weekend - so if there’s a quick 1, 2, 3 step process on how to create the file(s) and upload to the command center, it would be much appreciated!

I’m also looking for code samples / tutorials on voice recognition prompts. Ex: I could say something like “Misty, go to sleep” and it would be the actuating mechanism for some preprogrammed code. If you happen to be able to point me in the right direction for this question, it would be very much appreciated.

Thanks so much.

1 Like

Hey there - good to see you again!

You do need a pair of files for each skill for Misty.

A couple things here - first and foremost - the file that get’s downloaded from Blockly when you Save Project isn’t what you need to use Skill Runner to upload the skill. What you should do instead is this:

  1. Build your actions in Blockly
  2. Select “Show JavaScript” and copy the code shown in the modal window
  3. Open a text editor, paste the code, and name the file something.js
  4. Go to Skill Runner and Generate a JSON file to pair with this. Name it something (same as above), choose download, and then click Generate JSON Meta Template
  5. Now take those two files (assuming you named them the same) and drag them on “Choose files or drag them here.” in the Install section
  6. The new skill should appear in the list in the Manage area.

Should be good to go then!

The docs are a great place to get started with many a Misty effort. Check out the docs for the VS Code Extension.

https://docs.mistyrobotics.com/tools-&-apps/plugins-&-extensions/misty-skills-extension/

The Misty Sample Skills Github repo is a good place to explore.

There are also a number of skills being shared in the Misty Skills category here in the forums. Here’s a conversation skill that may be useful.

Hi Ben, many thanks! This is exactly what I’m trying to do.

I went through the tutorial, and I feel like I’m 90% of the way there. I uploaded the js and JSON files - using the templates for the tutorials.

It appears to upload successfully, and when I say “hi misty” the LED changes green, and the whirp sound happens (i.e. she heard me). I can also see in the Cloud Functions console that the access token is getting pinged each time (no reported errors) so that appears to be working fine.

So, it seems there must be a disconnect with what I did in DialogFlow. That seems like the easiest part of the tutorial, so I can’t figure out what’s happening! Misty doesn’t relay or respond to any phrases. Either ones that I put in the training phrases, or just anything in general.

Not sure what I’m doing wrong. Thanks!

p.s. she does play other sound files that I’ve uploaded, so I don’t think it’s a speaker issue.

p.p.s. I’ve been trying to rerun this in VS Code, and looking at the output. It doesn’t really make sense to me, but at the end of the output is a lot of error messages with “permission denied”. (snippet copied here: agent’ denied.",“status”:“PERMISSION_DENIED”}}

Argh, I’m sorry. the code blocks work when I run them in Blockly, but produce this error when uploaded as a skill:
“message”:"‘highlightBlock’ is not defined"

I should probably start with the getting started tutorials :slight_smile:

Hi there, @Dillusionist!

We should point out that the JavaScript you generate with Blockly doesn’t translate 1:1 to the JavaScript methods that you need to call in an on-robot JavaScript skill. To code a JavaScript skill that you run on the robot (instead of in your browser), you actually need to use Misty’s separate JavaScript API, as Blockly generates code that calls on the REST API.

For example, this code (which I generated with Blockly) is runnable from the Blockly web page, but if you upload it to Misty, she won’t know what to do with it; the on-robot JavaScript API doesn’t have a “sendPostRequestToRobot()” method:

sendPostRequestToRobot("drive","",{"LinearVelocity":"50","AngularVelocity":"0"});

If you want to send that exact same command to Misty in an on-robot skill, you would need to call on the misty.Drive() method in your skill. It would look like this:

misty.Drive(50, 0);

The distinction between the REST API and the JavaScript API can be a bit confusing at first, but I promise that once you write your first on-robot skill you’ll have the hang of it :slight_smile: Aside from the Hello World tutorial series (a great place to get started with on-robot skills), another good resource with more information is the Introduction to Skills article in the developer docs, and please let us know if you have any additional questions!

1 Like

I’ve not run through this skill in some time, but it’s possible you’re running into this audio recording bug, which could be preventing Misty from recording your speech after you activate her with the wake word.