Check out my new course Learn you some Lambda best practice for great good! and learn the best practices for performance, cost, security, resilience, observability and scalability.
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.
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.
- SDK reference
- Getting started with Myo Scripts part 1, 2, 3, 4, 5, 6
- Myo user experience design guidelines
I specialise in rapidly transitioning teams to serverless and building production-ready services on AWS.
Are you struggling with serverless or need guidance on best practices? Do you want someone to review your architecture and help you avoid costly mistakes down the line? Whatever the case, I’m here to help.
Check out my new course, Learn you some Lambda best practice for great good! In this course, you will learn best practices for working with AWS Lambda in terms of performance, cost, security, scalability, resilience and observability. Enrol now and enjoy a special preorder price of £9.99 (~$13).
Are you working with Serverless and looking for expert training to level-up your skills? Or are you looking for a solid foundation to start from? Look no further, register for my Production-Ready Serverless workshop to learn how to build production-grade Serverless applications!
Here is a complete list of all my posts on serverless and AWS Lambda. In the meantime, here are a few of my most popular blog posts.
- Lambda optimization tip – enable HTTP keep-alive
- You are thinking about serverless costs all wrong
- Many faced threats to Serverless security
- We can do better than percentile latencies
- I’m afraid you’re thinking about AWS Lambda cold starts all wrong
- Yubl’s road to Serverless
- AWS Lambda – should you have few monolithic functions or many single-purposed functions?
- AWS Lambda – compare coldstart time with different languages, memory and code sizes
- Guys, we’re doing pagination wrong