PerlinWarp / pyomyo

PyoMyo - Python Opensource Myo armband library
MIT License
130 stars 29 forks source link

Serial Read leaves program hanging on Raspberry Pi #12

Closed Marcus1818787 closed 2 years ago

Marcus1818787 commented 2 years ago

Hi, I am running a project that uses the Myo armband to control several servos. I have noticed that sometimes the Serial read on line 124 of the pyomyo.py file does not complete or timeout and therefore the program hangs.

Perhaps setting a timeout on the Serial may help avoid this?

Marcus1818787 commented 2 years ago

So adding a timeout did not solve the issue. In fact I believe the issue has something to do with the fact that PyoMyo is freezing while I am moving my servos.

Is there a way to temporarily stop PyoMyo from collecting data while I move my servos? Without completely disconnecting and reconnecting the armband every time?

Marcus1818787 commented 2 years ago

It seems as if I only have the issue when running the program on a Raspberry Pi. The exact same program runs well on a desktop machine (Windows to be specific). There is something to do with the Raspberry Pi that stops the Myo.run function from being run more than once (even if the original call had been terminated in a process).

Marcus1818787 commented 2 years ago

It appears there is no way to temporarily stop Myo from collecting data. As PerlinWarp has shown in one of the example files, the solution to this is to use multiprocessing, store the myo data in a queue and access this queue when you need to view the data.

Unfortunatley for someone who is not familiar with multiprocessing this can be confusing, perhaps more documentation can be written to explain some of the examples?