billmania / roboquest_ui

The front-end logic for the RoboQuest project
0 stars 1 forks source link

Support Logitech wired gamepad #145

Open billmania opened 1 week ago

billmania commented 1 week ago

See Issue #120

Using Chromium on ubuntu 22 with the Microsoft gamepad, the configuration process works correctly, completely, and robustly.

ubuntu 22 and Firefox, the configuration process for the buttons and axes of a gamepad has a problem with detecting and identifying axes with a Micro$oft gamepad. After moving any axis controller, it will not identify any other buttons or axes until the browser tab is closed and reopened. No complaints are written to the console.

The minimum required gamepad support is:

  1. MS-Windows 11, 64 bit
  2. Logitech F310 USB-wired gamepad
  3. Google Chrome 126.0.647.127, 64 bit
billmania commented 1 week ago

Browser support for gamepads

Standard gamepad mapping

ubuntu 22, 64 bit

F is Firefox 127.0.1, 64 bit C is Google Chrome 126.0.6478.114, 64 bit M is Microsoft knockoff L is Logitech F310

Buttons

Button FM CMbutton
A 0 0
B 1 1
X 3 2
Y 2 3
Back 8 8
Start 9 9
Big 16 16
left idx 4 4
right idx 5 5
left joy 10 10
right joy 11 11
left HAT 14 14
right HAT 15 15
up HAT 12 12
down HAT 13 13
right trig NA 7
left trig NA 6

Axes

In Firefox, the two triggers are reported as axes 4 and 5. When released, their value is -1.0 and when fully depressed, their value is 1.0.

In Chrome, they're reported, in compliance with the standard mapping, as buttons 6 and 7. When released, their value is 0.0 and when fully depressed 1.0.

billmania commented 1 week ago

The Windows utility joy.cpl confirms both gamepads behave the same from the OS perspective.

billmania commented 1 week ago

With the Logitech F310 connected to ubuntu 22 With Firefox navigator.userAgent returns:

"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"

navigator.getGamepads() returns:

an Array with 1 Gamepad object

id: "046d-c21d-Logitech Gamepad F310"
connected: true
buttons: Array of 17 GamepadButton
axes: Array of 6 Floats

With Chrome navigator.userAgent returns:

'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'

navigator.getGamepads() returns:

an Array of 4 elements which are either Gamepad object or null

id: "Logitech Gamepad F310 (STANDARD GAMEPAD Vendor: 046d Product: c21d)"
connected: true
buttons: Array of 17 GamepadButton
axes: Array of 4 Floats

With the Logitech F310 connected to Windows 11

With Chrome navigator.userAgent returns:

'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'

navigator.getGamepads() returns:

an Array of 4 elements which are either Gamepad object or null. NB When a single gamepad is connected, it may not be the first element in the array.

gp.length == 4
id: "Xbox 360 Controller (XInput STANDARD GAMEPAD)"
connected: true
buttons: Array of 17 GamepadButton
axes: Array of 4 Floats