Myo – First day of happy hacking!

Yan Cui

I help clients go faster for less using serverless technologies.

It’s been a long wait but I have finally got my hands on a Myo armband this week!

2014-10-24 20.35.09

 

To start, you need to download and install Myo Connect from here. You need to go through the set up guide, which includes teaching the Myo armband how to classify the EMG readings from your arm to one of five recognized posture patterns:

image

It works well out of the box. Despite being a SDK unit, it’s able to interface with some applications such as PowerPoint and iTunes. Its scripting capability makes it easy to add support for other applications (more on this later).

The pattern detection can feel laggy – only by a fraction of a second but noticeable when you’re trying to play a game for instance. The accuracy of the pattern detection is not quite there yet either.

But both issues will improve over time as better firmware becomes available. The guys at Thalmic Labs will also fine tunes their math model with more data from real world usages.

So don’t let these temporary shortcoming hold you back from buying a Myo armband. (You might want to keep it out of the reach of your pets though, as mine tried to attack and take a bite out of it as soon as I took it off)

 

Programming your Myo

Once everything’s setup and running you will no doubt be itching to program against this wonderful piece of device.

The SDK allows you to write application to take full advantage of the Myo’s capabilities using C or C++.

sdk-stack.png

Or, you can write Lua scripts to control applications using Myo. This allows you to map postures to keyboard or mouse signals (key up/down/press, mouse click, mouse movement, etc.). This approach has limitations – for instance, you can’t pass rotation information into a flight simulation program via keyboard and mouse signals alone. That said, there’s still plenty you can do with Lua scripts.

 

Lua Scripts

To run Lua scripts, you need to make sure Myo Connect is running (you’ll see it on your taskbar in Windows):

Image

Right-clicking on the Myo Connect icon gives you the option to open the Myo Script Manager where you are able to load your Lua scripts.

image

This is how the Canvas blank.lua script you see above look in its full glory.

There are couple of things to note about this script:

  1. the scriptId variable specifies a unique ID for your script
  2. the onForegroundWindowChange function defines a callback function. Myo Connect will call this function when the active application changes. Our function specifies that the script should become active when you load the Canvas Blank mini game. It also allows the Myo to control mouse movement when that happens so that we can aim with our arm.
  3. the onPoseEdge function also defines a callback function. Myo Connect will call this function when a posture pattern turns on or off. Here we specify that a fist posture maps to a mouse left-click, and a fingersSpread posture maps to moving the mouse to the centre of the primary display.

 

It was straight forward to get the Myo armband working with Canvas Blank. But the playing experience is far from satisfactory due to the following reasons:

  • the lag and imprecise posture recognition
  • Myo’s mouse movement control is not smooth enough. Coupled with an occasional lag it breaks the sense of immersion (and makes me miss an awful lot!)
  • Posturing causes small movements in your arm. It is often enough to cause the mouse to move, another reason for my many misses…

 

Based on what I’ve seen so far, I’d say that Myo is not ready for applications that need good precision control yet. FPS games are probably out of the question for now.

Again, this is an area where I expect things to improve soon. Perhaps even by the time you see the final commercial unit (they’re shipping the first batches of SDK units right now).

What shouldn’t be underestimated, is how easy it was for me to integrate with the Myo via Lua scripts. In fact, it’s so easy that you don’t even have to be an experienced programmer to make it work.

To unlock the full potential of the Myo you need to fall back to the SDK. For now, it means developing your application in C/C++, but other language bindings should become available soon.

 

Useful Links


 

Whenever you’re ready, here are 4 ways I can help you:

  1. If you want a one-stop shop to help you quickly level up your serverless skills, you should check out my Production-Ready Serverless workshop. Over 20 AWS Heroes & Community Builders have passed through this workshop, plus 1000+ students from the likes of AWS, LEGO, Booking, HBO and Siemens.
  2. If you want to learn how to test serverless applications without all the pain and hassle, you should check out my latest course, Testing Serverless Architectures.
  3. If you’re a manager or founder and want to help your team move faster and build better software, then check out my consulting services.
  4. If you just want to hang out, talk serverless, or ask for help, then you should join my FREE Community.

 


1 thought on “Myo – First day of happy hacking!”

  1. Pingback: Elm and Myo playing together | theburningmonk.com

Leave a Comment

Your email address will not be published. Required fields are marked *