Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defaulting to standard gamepad mapping when controller is unknown #48

Open
NoahBres opened this issue Feb 10, 2021 · 18 comments
Open

Defaulting to standard gamepad mapping when controller is unknown #48

NoahBres opened this issue Feb 10, 2021 · 18 comments

Comments

@NoahBres
Copy link
Contributor

I think this would require some testing with non-ftc gamepads but it would be neat to just default to the standard gamepad layout when the ID isn't known, enabling the use of non-FTC legal gamepads for use at home or something (there have been a non-zero amount of such requests, primarily Dualshock 5 and Xbox One controllers but not really important enough to spend significant time on imo).
With PR #47, the Dualshock 4 and Xbox 360 seem to have identical button layouts. I'm assuming that most modern gamepads will share the standard w3c spec.

@jasonappah
Copy link

I can PR this in but I probably won't be able to test for a bit.

@NoahBres
Copy link
Contributor Author

Bluetooth PS4 Gamepad doesnt in either Firefox or Safari because they report different ID's

Bluetooth

  • Safari: DUALSHOCK 4 Wireless Controller Extended Gamepad
  • Firefox: 54c-9cc-DUALSHOCK 4 Wireless Controller
    • this doesn't work because the regex searches for 4 character VID/PID with the zero prepended

Wired

  • Safari: Wireless Controller Extended Gamepad
  • Firefox: 54c-9cc-Wireless Controller

@NoahBres
Copy link
Contributor Author

Other have reported that the F310 doesn't work with Dash. I'm assuming it's due to the button mapping changes or an ID change. I would like to test this but I believe it would be safe to just remove the gamepad specific mappings and default to the browser standardized one now.

@TimVargo
Copy link

I too can confirm that our Logitech F310s are not detected by FTC Dashboard. We have never reported this before now, so we add a +1 to your count. I am willing to help with testing if you would explain what you need done.
~Tim Vargo, FTC Team 14571, The Marvels

@NoahBres
Copy link
Contributor Author

@TimVargo Would it be possible to go to https://gamepad-tester.com/ and record/report how the gamepad behaves?

It will look something like this:
https://user-images.githubusercontent.com/6739076/110693552-3006a800-81ad-11eb-8098-be2a8f4b3e9b.mp4

You can either just press all the buttons and record the screen or just post if the results match with the actual mappings. Take note of the button numbers.

Right now, in Dash, the Logitech's mappings are as follows:

  • A: B1
  • B: B2
  • X: B0
  • Y: B3
  • left stick x: axis 1
  • left stick y: axis 2
  • right stick x: axis 3
  • right stick y: axis 4
  • dpad up: 12
  • dpad down: 13
  • dpad left: 14
  • dpad right: 15

There are more mappings but you won't need it. The mappings are here if you're curious though:

left_stick_x: cleanMotionValues(-gamepad.axes[1]),

The xbox and ps4 gamepad mappings are as follows:

  • A: B0
  • B: B1
  • X: B2
  • Y: B3
  • left stick x: axis 0
  • left stick y: axis 1
  • right stick x: axis 2
  • right stick y: axis 3
  • dpad up: 12
  • dpad down: 13
  • dpad left: 14
  • dpad right: 15

I suspect what is happening is either the ID reporting at the top for the logitech is different or your mappings right now actually follow the Xbox/ps4 mappings (which is now the w3 standard).

@NoahBres
Copy link
Contributor Author

NoahBres commented Mar 10, 2021

@smartynenko For PR #47, you tested the Xbox 360 mapping?

Right stick X and Y are axes 3 and 4 which do not follow the w3 spec and do not match the PS4 mappings

right_stick_x: cleanMotionValues(gamepad.axes[3]),

@jasonappah
Copy link

Ngl I completely forgot about this but I can make the PR now and test tomorrow.

@TimVargo
Copy link

TimVargo commented Mar 10, 2021 via email

@NoahBres
Copy link
Contributor Author

@TimVargo Thank you so much!

@rbrott So is it okay to abolish the gamepad type completely and just use the standardized mappings?

@rbrott
Copy link
Member

rbrott commented Mar 11, 2021

I'm reluctant to change things again so soon. Maybe I'm missing something, but it seems like Tim's F310 should work with the current code given that it has an Xbox 360 ID?

@smartynenko
Copy link
Contributor

@smartynenko For PR #47, you tested the Xbox 360 mapping?

Right stick X and Y are axes 3 and 4 which do not follow the w3 spec and do not match the PS4 mappings

right_stick_x: cleanMotionValues(gamepad.axes[3]),

Sorry, must have checked in outdated version. I currently have

    case GamepadType.XBOX_360:
      return {
        left_stick_x: cleanMotionValues(gamepad.axes[0]),
        left_stick_y: -cleanMotionValues(-gamepad.axes[1]),
        right_stick_x: cleanMotionValues(gamepad.axes[2]),
        right_stick_y: -cleanMotionValues(-gamepad.axes[3]),

@NoahBres
Copy link
Contributor Author

Sorry, must have checked in outdated version. I currently have

You're absolutely right. My apologies.

@TimVargo
Copy link

To clarify what (doesn't) happen with F310, I plug in the gamepad and Windows does detect it, but pressing Start-A, or B, X, Y has no effect at all -- nothing happens with the dimmed gamepad icons.

@smartynenko
Copy link
Contributor

To clarify what (doesn't) happen with F310, I plug in the gamepad and Windows does detect it, but pressing Start-A, or B, X, Y has no effect at all -- nothing happens with the dimmed gamepad icons.

Do you have it in X mode or D mode?

@TimVargo
Copy link

TimVargo commented Mar 11, 2021 via email

@jasonappah
Copy link

jasonappah commented Mar 16, 2021

I was finally able to do a quick test using the default mapping using an F310 in xinput mode and all the buttons appear to be working except the guide button. I did have to do a bunch of Windows updates before I could get my browser to recognize the gamepads though.

Edit: My changes are at https://github.com/jasonappah/ftc-dashboard/commit/f3ff487a7d83688d0301257a57110462b901c3c0 if anyone wants to take a look. I was testing in Chrome 88 on my Windows laptop since I can't get the drivers to support xinput on my Mac.

@jasonappah
Copy link

jasonappah commented Apr 11, 2021

Update: Turns out I was a dum dum and used 0.4.0 for my testing instead of 0.4.1. In 0.4.1 the F310 seems to work fine without any modifications in xinput mode, tested on the same system as last time.

@jasonappah
Copy link

Oops I was wrong, everything works except the right joystick. The Y-axis shows up as the X-axis, and the X-axis doesn't work at all, but still better than 0.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants