News:

VC = Vox = VoxCommando
EG = EventGhost
WMC = Windows Media Center
WSR = Windows Speech Recognition

Main Menu

Myo Armband & VC

Started by Mace, February 11, 2015, 03:03:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mace

Greetings all,

Would be great to have a little plugin to use gestures from Myo Armband.
From what i've read it seems pretty straight forward to have the standard 5 movements work with VC, but i'm not that smart to work out how to do it.

Mace

jitterjames

You're not fooling anyone Mace. I know you can figure it out.  Despite promises made a year ago the official SDK doesn't seem to include C# :(

...But... Why don't you check this out and see if you can get a sample working.

http://devleader.ca/2014/10/06/controlling-myo-armband-c/

After that I can help you with the next steps.

I recommend you start by installing visual studio express (fantastic and free) if you haven't already.

Mace

Haha, you give far more credit than is due.

Yeh everything Myo is .lua

I know bugger all about C++, I'm a python guy!  But I'll take a stab at it.
That link has some great info, I'll see what I can mash up.

You do know that when all said and done, I'll just end up donating to the VC fund for you to make it for me anyway.

jitterjames

The link I posted should be for a c# wrapper, so you won't need to deal with c++.  I also want nothing to do with c++ thank you very much. :)

jitterjames

Quote from: Mace on February 11, 2015, 06:48:01 PM
You do know that when all said and done, I'll just end up donating to the VC fund for you to make it for me anyway.
Unfortunately there's not much I can do without the device.  I'm a "hands-on" programmer.  Which means I need to keep whacking away at it until it works, and that means I need something to whack!

Mace

Guess I'll take a swing and see what I can wack!

Mace

Dropped some stuff in your DropBox to have a look at if you felt energetic one day.

jitterjames

I'm not sure if I'm looking in the right place but I don't see anything new in my dropbox.

Mace


jitterjames

Yes.  Is there something you would like me to do with those files?

Mace

If you could somehow make it talk to VC would be great.

Any ideas how to use the output 'word' to activate a command? Since it's not coming from voice.

jitterjames

Are you able to test this with an actual device and get it to show that it is reacting to movements correctly?

If so then it should not be difficult to send events (or actions) to VC.  The simplest method would be to send a UDP message to VoxCommando.

After that it could be adapted to be a plugin but that would be more difficult.

Here is a sample code to send an event to VC with UDP.  It's ridiculously simple.

In this example I am sending the event "Myo.Test" and attaching optional payloads.  Payload {1} is up and Payload {2} is 5.

Note that we are "broadcasting" to the whole LAN by using an IP of 255.255.255.255, but you could also enter the IP of the machine running VC if you want.  33000 is the default port that VC listens on, set in options.

You don't have to send an event.  You can trigger an VC action.  More info on that here:
http://voxcommando.com/mediawiki/index.php?title=API_Application_Programming_Interface

using System;
using System.Net.Sockets;
using System.Text;
using System.Windows.Forms;

namespace simpleUdpExample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            UdpClient udpClient = new UdpClient("255.255.255.255", 33000);
            Byte[] sendBytes = Encoding.ASCII.GetBytes("VC.TriggerEvent&&Myo.test&&up&&5");

            udpClient.Send(sendBytes, sendBytes.Length);

        }
    }
}

jitterjames

#12
actually I tested this using a form with a button on it, but here are the only lines you really need.


using System.Net.Sockets;


private void testUDP()
{
     UdpClient myClient= new UdpClient("255.255.255.255", 33000);
     Byte[] sendBytes = Encoding.ASCII.GetBytes("VC.TriggerEvent&&Myo.test&&up&&5");
     myClient.Send(sendBytes, sendBytes.Length);
}

Mace

Hey that's pretty cool.

Only issue is:
private static void Myo_PoseChanged(object sender, PoseEventArgs e)
        {
            UdpClient udpClient = new UdpClient("255.255.255.255", 33000);
            Byte[] sendBytes = Encoding.ASCII.GetBytes("VC.TriggerEvent&&Myo.test&&up&&5");
            udpClient.Send(sendBytes, sendBytes.Length);
        }

Which works great.

Needs to be more like:
private static void Myo_PoseChanged(object sender, PoseEventArgs e)
        {
            UdpClient udpClient = new UdpClient("255.255.255.255", 33000);
            Byte[] sendBytes = Encoding.ASCII.GetBytes("VC.TriggerEvent&&{0}&&up&&5", e.Pose);
            udpClient.Send(sendBytes, sendBytes.Length);
        }

Which breaks.

Ok, not that big of a deal, i'll work it out later. My knowledge of C# awful bad.
Thanks heaps for the UDP idea  ;D

jitterjames

something like:


String strToSend = "VC.TriggerEvent&&Myo.Pose&&"+e.pose.ToString();
Byte[] sendBytes = Encoding.ASCII.GetBytes(strToSend);


capitalization might be wrong, and I don't know what e.pose is actually so ToString() might not actually work but it gives you an idea.