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!
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:
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++.
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):
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.
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:
- the scriptId variable specifies a unique ID for your script
- 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.
- 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
- SDK reference
- Getting started with Myo Scripts part 1, 2, 3, 4, 5, 6
- Myo user experience design guidelines
Whenever you’re ready, here are 3 ways I can help you:
- Production-Ready Serverless: Join 20+ AWS Heroes & Community Builders and 1000+ other students in levelling up your serverless game. This is your one-stop shop for quickly levelling up your serverless skills.
- I help clients launch product ideas, improve their development processes and upskill their teams. If you’d like to work together, then let’s get in touch.
- Join my community on Discord, ask questions, and join the discussion on all things AWS and Serverless.
Pingback: Elm and Myo playing together | theburningmonk.com