OpenMATB
OpenMATB copied to clipboard
Have problem while using joystick in linux
I tried to run the program in Ubuntu 22.04. But I found that joystick could not work well. Here is the log, maybe someone knows how to fix it
(.venv) mme@mme-MINIPC-PN64:~/Documents/OpenMATB$ python main.py
Screen 0 selected
Traceback (most recent call last):
File "/home/mme/Documents/OpenMATB/main.py", line 45, in <module>
app = OpenMATB()
File "/home/mme/Documents/OpenMATB/main.py", line 35, in __init__
content = Scenario()
File "/home/mme/Documents/OpenMATB/core/scenario.py", line 101, in __init__
self.plugins = {name: getattr(globals()['plugins'], name.capitalize())()
File "/home/mme/Documents/OpenMATB/core/scenario.py", line 101, in <dictcomp>
self.plugins = {name: getattr(globals()['plugins'], name.capitalize())()
File "/home/mme/Documents/OpenMATB/plugins/track.py", line 40, in __init__
self.joystick.open()
File "/home/mme/Documents/OpenMATB/.venv/lib/python3.9/site-packages/pyglet/input/base.py", line 462, in open
self.device.open(window, exclusive)
File "/home/mme/Documents/OpenMATB/.venv/lib/python3.9/site-packages/pyglet/input/evdev.py", line 313, in open
super(EvdevDevice, self).open(window, exclusive)
File "/home/mme/Documents/OpenMATB/.venv/lib/python3.9/site-packages/pyglet/input/base.py", line 98, in open
raise DeviceOpenException('Device is already open.')
pyglet.input.base.DeviceOpenException: Device is already open.
Hi @Braised-Lamb, Is the bug permanent? Is there any condition where is does not happen? What if you try to run OpenMATB with no joystick at all (should display a simple warning, but not blocking, message).
Hi @Braised-Lamb, Is the bug permanent? Is there any condition where is does not happen? What if you try to run OpenMATB with no joystick at all (should display a simple warning, but not blocking, message).
It is permanent and I can't fix it. If I run OpenMATB without joystick the project will work properly. I added some breakpoint and found something. While running in Ubuntu, track.py open joystick device with evdev.py. Then problem happened in base.py (belong to pyglet) line 97 and raise the DeviceOpenException. But if I run OpenMATB in windows, track.py open the device in directinput.py. The code will not reach "base.py (belong to pyglet) line 97". I guess that it is because different system use different methods to drive joystick.
By the way, I don't have enough time to debug it. And I am using windows to run OpenMATB now. I may not be able to provide more information about this issue lately.
Thank you @Braised-Lamb for your feedback. Can you confirm you used the correct version of python and of its libraries, as mentioned in the main page of the repo?
Thank you @Braised-Lamb for your feedback. Can you confirm you used the correct version of python and of its libraries, as mentioned in the main page of the repo?
Thanks for your reply. I use python3.9 and install requirements with requirements.txt. And I compiled the binary file of pylsl by myself. I don't think it can lead to the problem. Since I am using windows to run OpenMATB now , I cannot repeat the scene lately. Maybe next time I can provide more information about it.
Hi, could you try editing resman.py (in the plugins directory) and replacing self.joystick.open()
with try: self.joystick.open() except: pass
Hi, could you try editing resman.py (in the plugins directory) and replacing self.joystick.open()
with try: self.joystick.open() except: pass
I had reinstalled system for my computer with Windows. maybe next time when I run the program in Ubuntu and I will try this