Home Community Blog Buy Now
Blog

Misty Community Forum

Using Blockly with Misty

We are attempting to code Misty in a group setting using Blockly. Is there anyway to code her bumper sensors or utilize known faces currently on her system (ex. similar to the hello world tutorial have her recognize and respond differently to different known faces)?

Hi @rwines! At this point in time, we do not have the ability to interact with the bump sensors with the Blockly interface.

The easiest way to interact with these sensors is through a JavaScript Skill, here is some sample code on how to use the Bump Sensors and another one for using Face Recognition.

Let me know if that helps!

Thanks for your question, @rwines!

Coding Misty to do something in response to bump sensor input or face recognition messages requires first subscribing to those websocket streams, then parsing the data returned to look for an IsBumped value equaling true or PersonName value not equaling “unknown person”, and finally specifying what should be done when those conditions are met.

It is not possible to do this using Blockly because Blockly is not capable of handling websocket subscription at this time.

1 Like

Do you know if this is something that maybe added in the future? I’m going to be working with a similar group of teens in the spring and it will help with developing a program plan for the team.

At this time, we do not have plans in place to enhance the current functionality of Blockly :slightly_frowning_face:

If this is something that would be highly valuable for your use case, please submit it to our wishlist page! Misty’s Product Managers regularly monitor these requests and prioritize new features and functionality.

We also are considering simply sharing the Blockly code with the community and allowing them to run with it (though you can already largely do this since it is a webpage). If that is something you would be interested in, please also add that to the wishlist. Our team looks at that at least every week.

1 Like

@rwines While discussing your questions with folks here yesterday, I realized that the version of Blockly that was active on the website was actually outdated. That has now been fixed. The updated version is more robust with many more commands and a slightly different categorization scheme for the command toolbar. Wanted to alert you to that, since it sounds like you are working on some kind of lesson plan.

1 Like

With a link

http://sdk.mistyrobotics.com/blockly/

We are having issues getting some of the code previously created using Blockly to run. Does the old code not translate to the new version?

@rwines,

Yes, I think you will have to generate some new code using new block configurations. Let us know how it goes.

We’ve noticed one additional thing with Blockly. The blocks change depending on whether you are connected to Misty and the blocks that you see when you are not connected to Misty will not work. I know that it can be troublesome to multiple computers connected to her. Thoughts about this?

@rwines,

Do you mean that if you save a blockly.txt file of code created when not connected to Misty and then try to load that file and run it when you are connected to Misty, it will not work?

1 Like

Yes. Also the layout and appearance of the blocks changes as well.

This shows the layout and appearance of a portion of the blocks when not connected to Misty.

This is the appearance of the blocks when you are connected to Misty.

Thanks, that helps.

The difference in which commands you see is caused by the fact that, when you connect to Misty, Blockly polls the robot to get the commands available. As the software updates (which happens bi-weekly), new commands may be added. When not connected, there is a static version of that command information that is used to populate the toolbar. There may be fewer commands but they should still work.

Looking at your screenshots, I can identify one issue. The categories in which commands are grouped were revised a couple months ago. I believe that change was in the 10/08 software release. Prior to that, there was a Locomotion category but now everything locomotion-related is in Movement. That would affect how the toolbar looks but it should not affect how the commands run.

You can verify your software version by connecting to Misty via the Command Center and clicking on the Get All Device Info button.

I haven’t seen a software update to load in sometime. I’m wondering if this may be due to the fact that we are running on an older model while we are waiting for the newest version to ship?

When I attempt to run the block code that was created it says that it is “Ignoring a non-existent field” followed by the following type error.

blockly_compressed.js:1416 Uncaught TypeError: Cannot read property ‘call’ of undefined
at Blockly.Generator.blockToCode (blockly_compressed.js:1416)
at Blockly.Generator.workspaceToCode (blockly_compressed.js:1414)
at HTMLAnchorElement.runJavaScript (misty_index_setup.js:367)
at HTMLAnchorElement.dispatch (jquery-3.1.1.min.js:3)
at HTMLAnchorElement.q.handle (jquery-3.1.1.min.js:3)

That could be possible. If you are using a Misty II prototype from this summer, do you happen to know whether it is an EP2 or an FEP model? When you connect Misty to the Command Center, what version number displays in the System Update section?

Robot Version: 2.0.7.0
Sensory Services Version: 2.0.7.1
Windows OS Version: 10.0.17134.1

Those are indeed a bit off from what I expected. It looks like you may be using an EP2 prototype, which unfortunately have not received any updates since the end of August. I expect that you will have a smoother experience with Blockly (and the rest of Misty’s tools, and her hardware itself!) once your non-prototype robot arrives :slight_smile:

Okay! I can’t wait to get the final version!