Search code examples
pythonmyo

Receiving data from Myo stops after a while


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.


Solution

  • 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.