When I try to use a real Microsoft Xbox Bluetooth controller with my Mac with the robot simulator it switches the right joystick with the right bottom trigger. We are using the (-controller.getRightX() call) However when I use another controller like this 8bitdo controller it works fine. We also tried the xbox controller on a windows machine and it also works fine there too. Also I expect to see the “Map Gamepad” box appear but it only appears for the 8bitdo controller on the Mac. Anyone else seen this behavior?
Joystick and gamepad support is notoriously inconsistent across platforms. Every platform has different APIs and different button/axis mappings. There’s no fix today. The right eventual fix is probably to provide a way in the simulator GUI to remap things.
Would also appreciate this as a Linux user.
Also do we know why the DS maps controllers in a non-standard way?
Controllers in general, or gamepads in particular? Internally I know it uses both the DirectInput and XInput APIs (preferring the latter if available), and it does the 0-1 thing with trigger axes. Not sure if doing 0-1 there is semi-standard or something unique.
The 0-1 thing is how XInput in general works.
And the DS just maps controllers as Windows sees them. It doesn’t do any remapping internally, if you look at the gamepad view in windows itself it has the exact same mappings as the DS.
Likely much of the issues are probably caused by XInput being a standard that isn’t generic HID. Theoretically Linux and macOS could properly detect controllers that support XInput and match Windows, but I don’t think there is much incentive to do so. Maybe on Linux (Which is why linux is better then macOS for joystick support), but macOS has basically 0 incentive to make joysticks better.
Gamepads in particular.
Hi, found this thread trying to figure out why I don’t see the “Map Gamepad” in the SimGUI when programming for our Romi. Does SimGui depend on DriverStation to display this check box? (I don’t think we get DS on Mac, but let me know if that’s not true)
We are able to use the xbox controller if we create a Joystick and then pass getRawAxis(n) values to the drive subsystem. The SimGui indicates button presses on the indicators beneath the Axis values so I expect we can use that info to figure out which buttons to map to actions.
VSCode 2024.2.1
MacOs 12.7.6
Adapting RapidReactCommandBot example to Romi
No. The sim gui has its own independent implementation for joysticks and gamepads. The map gamepad checkbox not appearing is due to the OS not identifying the device as a gamepad to the application. We don’t have good workarounds for this right now; at some point we should reimplement the joystick/gamepad support in sim gui and add more generic gamepad/axis configuration.