NiklasRosenstein / myo-python

Python bindings for the Myo SDK
Other
259 stars 102 forks source link

Error in on_pose() when myo is unsynced #100

Open jmw182 opened 2 years ago

jmw182 commented 2 years ago

When I unsync the myo (by removing it from my arm), on_pose() is triggered in my DeviceListener class prior to on_arm_unsynced(). This results in a ValueError when I try to access the pose event data in my callback: ValueError: 65535 is not a valid Pose.

As a workaround, I have added a try/except block to my on_pose() callback. After handling the error with the try/except, I see that that the on_arm_unsynced() callback is triggered immediately after the on_pose() callback. But I am not sure why on_pose() was called in the first place and with an invalid pose value.

NiklasRosenstein commented 2 years ago

Hey @jmw182 , that sounds like an issue coming from the driver. I would be surprised if that invalid value was somehow introduced by a bug in the wrapper. Is this something that happens consistently or only under particular circumstances?

Unfortunately I don't have a Myo anymore to test.

jmw182 commented 2 years ago

Hi @NiklasRosenstein, thanks for responding. When I was testing this it appeared to happen consistently any time the myo was removed from the arm. I also don't have a myo with me at the moment to test (the lab I work at has one myo that I have handed off to a student for testing with the app I wrote).

The workaround of catching the exception is working fine for us, but for other users it would be good to find a way to intercept the invalid pose the driver sends and ignore it, rather than triggering the callback and and exception.

If I get my hands on the myo again I can try to investigate further. Or maybe this issue can be labeled "help needed" to try to get help from other users?

Sad to hear that you don't have a myo anymore, this is a great library and the myo is still a nice device that I hope will get revived eventually (I think "Meta" reality labs has the IP and is doing something with it).