Home Community Blog Buy Now

Misty Community Forum

Help uploading JavaScript skills

This sound like the problem I am having. Could you please give a step buy step description of the solutions you mention and the method described in the “Uploading Skills with Skill Runner”. It involves mistySeesYou.js and mistySeesYou.jason files from GitHub and may have required Visual Studio Code to move the files correctly to a folder named mistySeesYou on the desktop. Is one of these files the meta file you write of?

Hi @steven.graham,

Thanks for posting your question here!

The file with the .json file type extension – in your case, mistySeesYou.json – is indeed the “meta” file for the skill. The meta file sets some important attributes that the system requires to run the skill – for example, it describes the UniqueID (a universally unique identifier, or “UUID”, that the system uses to identify the skill), it defines how the skill can start, what skills can access data that this skill saves, and more. You can read more about the .json meta file in the developer documentation.

There are detailed instructions about how to upload a JavaScript skill with the Skill Runner in the developer documentation, as well. When those instructions refer to your “skill files”, that means the .js and and .json files (which, in this case, you downloaded from GitHub). Please let us know if those instructions do not provide the information you need, or if you have additional questions about the process!

Hi Johnathan, Thanks for that. I tried out the “Hello World Tutorial” for head movement. It seemed to work O.K. I found that the Visual Studio Code did not have the Misty bit added. But I sorted that out and it all seemed to program as it should. I had one nick up in that the file name on the “json” file, at some time became “HellowWorld” It made it a bit difficult to find where the file had been created. Any way I (put that right) or thought I had. It all went right except that Misty did not move her head, instead the chest light went green, but only once. I think that may have been a skill that was installed by my friend. I will give it another try, and keep a closer eye on the file names.

Hi @steven.graham, glad you were able to make some progress! As for the green light, when you’re using the Skill Runner, that’s typically an indication that “the skill has been successfully uploaded to Misty”. I’d suggest checking in the “Manage” section to see if your Hello World skill appears there. If it does, you should be able to run it! :slight_smile:

Hi johnathan, I just got back to it today, Spent yesterday getting to grips with V.S. Code. It seems like I was trying to load all the code for the Hello world Tutorial series in one go with some extra bit added. No wonder it did not like loading. Any way it is still not working and it is still probably because I am doing something wrong. I tried several times today and I now have the first JavaScript file in V.S.Code O.K. When I try to Generate Meta File, I noticed It appears just above the Taskbar. Is this where I should find it? Is opening it with Notepad, then saving it to the desktop “HelloWorld” folder O.K.? At least one time Notepad changed it into a .tat file not a .json file. Even when it looked like it was working and I tryed to Install it I got a mesage saying “An error occured when trying to upload. See consel for details.” One time the second file did not get to the “HelloWorld” folder. How does the second file get to the “HelloWorld” folder? when it works.

Hi @steven.graham,

You’ll need to move the .json meta file to the same folder as the .js code file manually. You can open it with a text editor and re-save it, or you can open the file system on your device and move the files to the same folder before you upload them to Misty. If the .json file has been given a new file type extension somewhere along the way — .txt, for example — you will need to change the extension back to .json before you can upload the file to Misty.

HI Johnathan, I gave it another go. VS Code had lost the HelloWorld file I had there before. Item 5 on the Generating the Meta File, the “CleanupOnCancel” was True where as the text editor example they show has it as false. The Tutorial does not tell us to close the text editor page?While we are on the subject of checking achievements, What does the first line “misty.Debug (“The HelloWorld skill is starting!”)” do? Is the a way of checking what I have hand entered in VS Code before working with it? There is just too much assuming that we all know this, but some of us don’t. Thanks for all your help.

Hi @steven.graham,

Visual Studio Code is a tool for editing code files and plain .txt files, but it works in a similar way to most word processing applications in that each time you open the application, you start with a blank slate (or an empty ‘page’). If you saved your Hello World code file to your computer, then you can open it again in Visual Studio Code by using the toolbar menu to select the option to browse for files that are saved on your local computer (the exact wording and menu options differ from one operating system to another).

The misty.Debug() command will broadcast any message that you give it – in this case, “The HelloWorld skill is starting!” – to SkillData event listeners. The Skill Runner web page connects to Misty’s WebSocket server to stream SkillData event messages, so that you can see the misty.Debug() messages in your web browser. Debugging your code by inserting commands to print strings of text is a common way to make sure your program is behaving as you expect it to while you test it during development; it helps you understand what part of the program is currently executing (because, in the case of Misty’s JavaScript skills, you can’t actually “see” what line of code is currently running.)

It’s true that the Hello, World tutorial series assumes some familiarity with common programming tools and terminologies, and I can understand that it may be frustrating for those who are new to programming (and, especially, JavaScript) to work through without having a strong understanding of some of the more foundational things involved in writing code (for example, setting up a development environment, working with code files, debugging programs, etc.). However, because those foundational elements of coding are not the focus of the Misty developer documentation, I do recommend checking out some other resources for learning JavaScript (FreeCodeCamp may be a good starting point – I have heard good things – or TreeHouse, or CodeAcademy).

I know there are a few others on these forums who are learning to code with Misty, too; I think that Misty is a challenging platform to start with, and learning may be slow at first, but it’s certainly not impossible. It would be cool to see a few members of the community form a “beginner’s group” for those who would like to learn together :slight_smile:

Hi Johnathan,
Macking some progress, The “Generating the Meta File” part of the “Hello World Tutorial Series” has one instruction line that is between Wrong and Misleading. It is instruction 4. It reads “Locate the downloaded HelloWorld.json file save it to the HelloWorld directory you created for this skill earlier.” The word “save” is wrong. You are being asked to “move” or “shift” the file from a place (you are asked to locate) to the HelloWorld directory you created on the desktop. Why are you asked to locate the file when the json generator is instructed to put it in the download folder? The instruction should read:
4. Select the HelloWorld.json file in your downloaded folder and move it to HelloWorld directory you created on the desktop. Can this get changed in the documents?
am still getting the the “An error occurred when trying to upload” message and the led turns red at least the first time I try.

Thanks for this feedback. We can certainly look into it.

Have you already tried opening the developer console in your web browser to read the message that Misty returns when the skill fails to upload?

To see the message:

  1. Connect Misty to the Skill Runner web page
  2. Open the developer console. If you are using chrome, use Ctrl + Shift + J (Windows/Linux) or Cmd + Option + J (Mac).
  3. Try to upload your skill to Misty.
  4. Check the developer console for error messages.

For troubleshooting help, you can take a screenshot of what you see in the console and post that screenshot in a response to this thread. You can also copy and paste the contents of your JavaScript and JSON files into this thread so that other community members can take a look and help you debug the code.

1 Like

HI Johnathan,
I had found the how to open the console in the "Skill Runner’ Documentation. There was a lot there for a start so I cleared it and tried to download one more time. I then checked the console and noted down this : DevTools failed to parse Source Map: Not found dependence/popper/popper.min.js.map. I may have missed the spelling on some of that but hopefully there is enough of it right to give you some idea what it is trying to tell me. Two other points. The text editor view of the HelloWorld file is O.K. except that the “CleamupCancel” is True on mine, Not the False as shown in the Doc. Second, The “Generating the Meta File” section starts with (1. Open the Skill Runner web page in a new browser window and find the Generate section.) Am I doing it wrong if I drive misty to my work area with the Command center, then select Skill Runner to do the file Generate and Install? I am not,(Open the Skill Runner web page in a new browser window), could that be why it is not downloading correctly?

Thanks, @steven.graham. Please see my replies below :slight_smile:

This is related to a dependency that the Skill Runner web page has on an external library. This message isn’t from your robot, and as far as I am aware it does not prevent any of the site’s functionality from working. You can safely ignore this message :slight_smile:

The default value for CleanupOnCancel was changed in the meta file generation tool at some point, and the example in the documentation has not been updated to match. However, the CleanUpOnCancel value can be either true or false and it does not affect whether Misty is able to install the skill. This value only indicates to Misty whether the system should “clean up” any running processes when a skill ends or is cancelled. If true, you can’t start the skill again right away, because it takes a few seconds for the system to end those processes. If false, those processes may continue after the skill finishes. These processes can interfere with the functionality of other running skills, but choosing not to “clean up on cancel” means you can start the skill again right away. Just some tradeoffs to be aware of depending on your use case, but not particularly important for the Hello World tutorial series.

Navigating to the Skill Runner page from the Command Center page is fine.

Did you try uploading your skill files with the developer console open? If so, what did you see in that console when Misty’s light turned red?

Hi Johnathan,
I have just completed what you sugested and have copyied the new console contents
;Uploading to Misty…
skillrunner.js:663 POST 400 (Couldn’t save skill - you must include a code file with a matching skill name for a skill’s first upload.)
sendFile @ skillrunner.js:663
(anonymous) @ skillrunner.js:649
Promise.then (async)
startFileUpload @ skillrunner.js:648
uploadFilesToRobot @ skillrunner.js:578
(anonymous) @ skillrunner.js:561
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2
trigger @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
each @ jquery.min.js:2
each @ jquery.min.js:2
trigger @ jquery.min.js:2
(anonymous) @ skillrunner.js:545
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2
skillrunner.js:613 Skill command response: {error: “Couldn’t save skill - you must include a code fil…a matching skill name for a skill’s first upload.”, status: “Failed”}
skillrunner.js:1149 Error occurred while attempting to upload skill files. See console for details.
skillrunner.js:632 Couldn’t save skill - you must include a code file with a matching skill name for a skill’s first upload.
I don’t see any mention of HelloWorld files? The LED on Misty did turn Red. What does it all mean? Two side issues that are not related. The email of your replies goes to my work computer steven.graham@canterbury.ac.nz but because I am having to work from home I now know of a way to bring those emails to my other accounts. I opened Misty in skills and have nothing else running over the WiFi on the computer. I appreciate your help.

Supplemental to previous. I was about to pack misty away for the evening when I notices that there were some upgrades pending. I completed them. Seeing I had made that changer I thought I would give it one more go at instslling.I was about to do that when I noticed that the (js) file was now HelloWorld(1).js It most have renamed it to this when I checked the file for a start. I renamed it back to HelloWorld.js I instaled sucsesfally or so it seems. The console is:Uploading to Misty…
skillrunner.js:613 Skill command response: {result: “d77bf9f3-3527-4263-a6d1-1acc6b889fa6”, status: “Success”}
skillrunner.js:1149 Files successfully uploaded. The led has turned Green. The question I have is was it the upgrade, or was it the matching file names? I am off to run it, wish me luck.

Hi @steven.graham,

This line:

skillrunner.js:663 POST 400 (Couldn’t save skill - you must include a code file with a matching skill name for a skill’s first upload.)

Has the relevant message :slight_smile:

When you upload a skill, your code file (that is, the file with your JavaScript code) must have exactly the same name as your meta file (or, the JSON file with the rules about how the skill should run). Having a code file with the name HelloWorld(1).js, and a meta file with the name HelloWorld.json, would definitely prevent the system from being able to install the skill correctly.

I’m glad to hear that you discovered the fix. Let us know how things went after you started the skill!

1 Like

Hi Johnathan,
It still did not seem to work, Misty did not seem to move her head as she should. Thinking about it, the change to HelloWorld.js must have happened after I created HelloWorld.json was created or else it would have become HelloWorld(1).json. Does the Folder and file.js and file.json all have to match?
You said there was a mistake in the HelloWorld.json file “CleanupOnCancel”: false or true, I am hand typing in the HelloWorld.js file from the same Hello World Tutorial Series document. Is it correct?
I have not installed the improve slam performance patch, it just looks to frightening for someone like me bubbling round in the dark. I take it that it would have no effect on my problem. I will give it another go, thanks for your help.

Hi Jonathan,
Tried it again. I down loaded the HelloWorld coder and replaced what I have typed in, with it. It was trying to make the .json file a (2) as I already had an earlier HelloWorld file. I tried Instaling it twise and here is the console content from that. Uploading to Misty… Failed to load resource: net::ERR_CONNECTION_RESET
skillrunner.js:1149 Uploading to Misty…
skillrunner.js:613 Skill command response: Object
skillrunner.js:1149 Files successfully uploaded.
DevTools failed to load SourceMap: Could not load content for http://sdk.mistyrobotics.com/dependencies/popper/popper.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
I noted that on previous attempts I had got the file in the Manage area. I didn’t seem to get that this time. I have not checked the code, but the beginning and end look the same as in the tutorial. Any idea why it still will not work?

Sorry Jonathan, I put you wrong, There are four (Start) file in the Manage area, all with the same name. Which is the most resent? I will get rid of them all and give it another go.

Sorry if this seems like I am talking to myself, but I feel I am so close to finally getting to the point where I cam program Misty. From the above it occurred to me that it is the communication between my laptop computer and Misty, via WiFi that is causing the problem. sure I have seen docks and forum discussions about " Make sure the robot and your computer are connected on the same WiFi network." I was inclined to think all was O.K. because Command Center was working and it was all going through my home modem/hub. This may be the problem, when I set Misty up I put here on the NAME-5 SSID. I had forgot that my Sony laptop bought in 2014 (last of the non touch screen) does not have WiFi 5gHz capability. So my computer and Misty are no strictly on the same network. Could this be the problem? Why does it not stop Command Center?

Hi Jonathan again, As I now have a cellphone with Bluetooth and I found how to, I changed Misty onto the 2.4GHz band (Same as the laptop.) Does the drive function on the cell App work without WiFi coverage? If so I will now be able to demonstrate Misty doing something at the Robot Club. I checked throue the V.S. Code file I had downloaded to see if it looked O.K. I found that it had this line; null, //Velocity Nullable, (We use duration here, instead 1) I’m no expert on this code but it look like its making all the head moment speeds null! Changed the code back to what I had used previously 30): //Head movement velocity. Can – Cleared every thing out re Generated Meta file and Installed, and it still did not work! here is the consel for it all. Generating meta template for ‘HelloWorld’…
skillrunner.js:1149 Uploading to Misty…
skillrunner.js:613 Skill command response: {result: “bc0d85cd-f0fa-46cb-9599-891577950474”, status: “Success”}
skillrunner.js:1149 Files successfully uploaded.
skillrunner.js:511 “Calling command ‘Debug’” “2020-04-27T03:46:56.0393421Z”
skillrunner.js:518 {data: “The HelloWorld skill is starting!”}
skillrunner.js:1149 Running skill ‘HelloWorld’. Open the web console to see misty.Debug() messages and other skill data.
skillrunner.js:511 "‘HelloWorld’ Debug => " “2020-04-27T03:46:56.055Z”
skillrunner.js:518 The HelloWorld skill is starting!
skillrunner.js:518 {message: “Skill ‘HelloWorld’ completed or cancelled - UniqueId ‘bc0d85cd-f0fa-46cb-9599-891577950474’”, timestamp: “2020-04-27T03:46:56.055Z”, truncated: false} Why is it still not working?