How is a Logitech gamepad initialized? We had been using joysticks, but we decided to switch to a gamepad. Also, how do you read from buttons 11 and 12 (the two “joystick” buttons)? Do you use the AnalogIOButton class?
We initialized it just the same as the KOP joysticks. it is read as a 3 axis joystick (if you are using the same one) - axis one (x and y) is the left stick, axis 2 is the right stick, and axis 3 was the L2 and R2 buttons. The buttons should be just like the joysticks too - in LabVIEW, you would unbundle the button data. We just pulled up the Windows joystick configuration to figure out what buttons were which
So, by that I presume you mean that the left stick is the x-axis and the y-stick is the y axis, but it is just one joystick object. Correct?
This is how common gamepads map to the FRC joystick data bundle:
Logitech DualAction:
All buttons labeled on the gamepad (including 11 and 12) are accessed as their button # - In LabVIEW, you can unbundle the Buttons and pick 11 or 12, in C++ you can do whatever you normally would do to get a button (I don’t know exactly what that is)
Axis 1 -> Left X
Axis 2 -> Left Y
Axis 3 -> Right X
Axis 3 -> Right Y
Axis 5 -> D-Pad X (this is binary - ±1 is left/right)
Axis 6 -> D-Pad Y (binary also)
Logitech F310 or Xbox 360 is slightly different:
-Buttons 1-8 are used. They are not labeled, you can try reading all 8 and seeing what maps to what. I know that 9-12 are not used.
Axis 1 -> Left X
Axis 2 -> Left Y
Axis 3 -> Sum of L2 and R2 analog triggers - One is positive, the other is negative, both or neither is 0.
Axis 4 -> Right X
Axis 5 -> Right y
Axis 6 -> D-Pad X (binary like above - Note that you can’t read D-Pad Y)
Any way you do it, a gamepad is a single joystick object.
Use the forum search feature. This has been asked and answered before.