hybridgroup / gobot

Golang framework for robotics, drones, and the Internet of Things (IoT)
https://gobot.io
Other
8.98k stars 1.04k forks source link

Joystick:does not run properly on windows #868

Open wushu037 opened 2 years ago

wushu037 commented 2 years ago

Thanks a lot for providing the joystick library, it works fine on Mac, but there are exceptions on windows

environment

compilation warning joystick relies on go-sdl2, and this warning occurs when it is compiled cross-platform from Mac to Windows and directly on Windows. image

For this warning. I raised an issue with go-sdl2, and later I replaced it with 0.4.25 as suggested, and the warning disappeared. So maybe joystick should update the version of go-sdl2

running exception I'm using Xbox Wireless Controller (xsx2020) and it only occasionally listens to the trigger button, but not to all other keys!

I also tried to run scanner.go, but it quits immediately image

gen2thomas commented 2 years ago

maybe related to #860

wushu037 commented 2 years ago

maybe related to #860

sorry, don't see the obvious correlation

gen2thomas commented 2 years ago

Hi @wushu037, currently "github.com/veandco/go-sdl2 v0.3.3" is referenced by go.mod. Your suggestion was to use "0.4.25". Therefor I assumed this means the module version, but maybe I'm wrong.

wushu037 commented 2 years ago

Hi @gen2thomas , i read the issue you linked to, maybe I didn't understand it and didn't see any connection to the go-sdl2 module version. but yes, go-sdl2 needs to be replaced with the latest version in order to compile properly on windows. Also, even if it runs successfully, there are issues to troubleshoot during runtime (see first comment)

gen2thomas commented 2 years ago

Hi @wushu037 , I have now fixed the old modules on dev branch. I started "go run scanner.go" like you have done, but without any joystick attached and in a Linux box - it do not exit immediately, it waits. Unfortunately I have no windows system to test it.

What do you mean with "it works fine on Mac"? Do you have used the same example? I ask, because the example use a "dualshock3" type. Is this compatible with your "Xbox Wireless Controller (xsx2020)"?

wushu037 commented 2 years ago

Hi, @gen2thomas , thank you for your investigation of the problem Here's the thing. I tested it on Mac and Windows, and it works fine on Mac, but there is an exception on Windows. I didn't test it on Linux

It is the example of the sample. to describe the problem briefly, I do not give my program.. Although the example uses "dualshock3", on Mac, my xsx2020 joystick still has multiple keys that can be listened to. But on Windows, only the trigger key is occasionally listened to

To better solve the problem, I give my program file. It implements a very simple function: mapping the joystick's share keys to the system's share keys. In this program, the configuration file is set up by me running scanner.go on my Mac, and also only the trigger key is responded to.

gamepad-keys-map.zip

If you don't have Windows, you can install a virtual machine and the effect should be the same. Either on a win virtual machine or a win physical machine, I tried

gen2thomas commented 2 years ago

Hi @wushu037 , I need to stop my support here, because windows and no joystick available.

Please could you change the headline to which is more pointing to the remaining problem, e.g. this words/phrases should be included "windows, scanner.go, only one key". So someone can pick up the issue with existing hardware and deeper knowledge.

gen2thomas commented 3 weeks ago

Hi @wushu037 , the sdl dependency is now replaced by another module. Maybe you can test again your device on Windows with the new implementation.

Thanks Thomas