Receiving data from Myo stops after a while

529 Views Asked by At

I am using this (https://github.com/dzhu/myo-raw) project to connect Myo Armband to my PC (running on Windows) and receive raw EMG data. I have two problems related to this:

1) Data receiving is extremely slow, but the author had warned about this. It seems, that switching off everything except for EMG speeds up receiving the data, but is there a way to speed it up more? BTW, everything is fine on Linux;

2) Data receiving crashes after a while. I've noticed, that it usually crashes when I try to do "strong" gestures like making fist and moving my right hand to the right. I don`t have an explanation to this since everything works fine under Linux.

I am asking my question here because GitHub page seems to be dead.

2

There are 2 best solutions below

0
On BEST ANSWER

So, problem was so trivial than I have been blaming myself for hours. When adding n = self.ser.inWaiting() and print(n) to BT.recv_packet() I noticed that n grows exponentially until reaching 12 kilobytes and then the connection stops. Adding this:

        ret = self.proc_byte(ord(c))
        if ret:
            if n >= 100:
                self.ser.flushInput()

Solved the problem.

2
On

For #1, you could try to use the official Bluetooth protocol instead of myo-raw since that library pre-dates the release of the official header. Not sure if this will get you better results, but it is an option.

The only Myo-based reason for #2 could be the Myo going to sleep based on lack of movement, but given that you're doing gestures I assume that isn't the case. I would double check myo-raw (e.g. open PRs) and your code to see if there's something amiss.