Closed wardgeronimussmets closed 1 year ago
Hi,
From your description, it sounds like the VX360Gamepad object does not get destroyed properly when your program encounters some error?
I have not encountered this issue so far, what is your OS? Does it happen when there is an actual gamepad connected to the PC maybe? Does it also happen when you use the version of the vigembus driver that is embedded in vgamepad
rather than using the last version from nefarius?
I was thinking of a similar cause, strangely enough sometimes when I close all my scripts using vgamepad I will still see random movement in the menu that pops up when you press the windows key as if there is still some gamepad connected executing some random commands. Also, even though the virtual device cannot connect to the ViGEmBus I still get a pop-up from steam saying that it "detects" a new controller.
I'm using Windows 10. I've had the issue with both versions of the ViGEmBus software. I've removed it and reinstalled the bus using version 1.17.333.0 (which I got from the setup.py file). There is no actual gamepad connected to my computer.
The automatic installation and download prompt when running pip install vgamepad
doesn't show up anymore, but I assume this prompt installs the same version.
When reinstalling the Bus driver software it still says cannot connect to the ViGEmBus every now and then. I was wondering if there is a way to maybe remove all connections between vgamepad and the ViGEmBus?
It might also be important to mention that I'm trying to use two virtual gamepad connections at the same time for using input of two AI's. Maybe that isn't supported?
I'm also not closing the connection between vgamepad and ViGEmBus myself, maybe I'm supposed to this but looked over something in the documentation?
The connection is closed when the object is destroyed. If you want to close it manually, you can do del gamepad
Having several gamepads in parallel is not supported, but it might work, I have simply never tried 😅
Ok thx, I'll see if I can get it fixed by deleting the objects myself.
As far as multiple controllers in parallel goes, so far I've sighted as much as 3 players 😁
Hi! I'm trying to train a RL model using vgamepad for user input. But I often get the following error when creating a new instance of class vg.VX360Gamepad():
Traceback (most recent call last): File "c:\Users\wards\gitrepos\ML_gamebot_stick_fight\src\Trainer.py", line 98, in <module> start_training() File "c:\Users\wards\gitrepos\ML_gamebot_stick_fight\src\Trainer.py", line 87, in start_training env = load_new_bot() File "c:\Users\wards\gitrepos\ML_gamebot_stick_fight\src\Trainer.py", line 48, in load_new_bot gamepad = GamepadEmulator.GamePad() File "c:\Users\wards\gitrepos\ML_gamebot_stick_fight\src\GamepadEmulator.py", line 21, in __init__ raise e File "c:\Users\wards\gitrepos\ML_gamebot_stick_fight\src\GamepadEmulator.py", line 15, in __init__ self.gamepad = vg.VX360Gamepad() File "C:\Users\wards\anaconda3\envs\computer_vision\lib\site-packages\vgamepad\win\virtual_gamepad.py", line 115, in __init__ super().__init__() File "C:\Users\wards\anaconda3\envs\computer_vision\lib\site-packages\vgamepad\win\virtual_gamepad.py", line 60, in __init__ assert vcli.vigem_target_is_attached(self._devicep), "The virtual device could not connect to ViGEmBus." AssertionError: The virtual device could not connect to ViGEmBus.
I don't always get this error, sometimes it works perfectly fine other times it works after a number of tries and sometimes it doesn't work at all. This didn't happen in the beginning but seems to happen more often when the instance of vg.VX360Gamepad was opened and the program gets terminated by a KeyboardInterrupt or another error. I've tried reinstalling the ViGEmBus driver from their github repo, restarting my computer a number of times. What seems to be working best is when I shut down my computer instead of restarting it. But that might just be something random that happened to help by accident.