Using XBOX controller D-PAD

Ive been trying this for a while but it never works… what ive been told is that they are via get raw button and the button is their directional axis

-1 = none
0 = top
45 = topright

but it never works and i cant figure out why. Am I doing it wrong or is that misinformation?

I don’t have experience with the Xbox controller, but I’ve used Logitech gamepads and a couple of similar generic ones. The D-pad is read on axes 5 and 6, one axis for horizontal action and the other for vertical.

The xbox controllers use 1 more analog axis than the DualAction’s, so there aren’t 2 more axis for D-pad h and v. Only horizontal is available, via axis 6. -1 is one way, +1 is the other, 0 is center. There are only three states. You cannot access d-pad vertical. This is because two triggers (L2 and R2) are mapped to axis 3 (positive is one trigger, negative is the other trigger, they are summed so you can’t use both at once) on the xbox and F310 controllers.

Since the Logitech F310 is the same as an xbox controller in software, it is likely the same. I have not verified this though. Note: We’ve found the F310 is higher quality than the Xbox stick, as the joysticks return to center better and the springs ‘feel’ better. It’s also symmetrical, which many of our drivers prefer (even though it doesn’t matter with Halo drives). All of the button maps are identical to the xbox in software.

The Logitech dual action uses button inputs for L2 and R2, so the two joysticks are axis 1-2 and 3-4, and the D-pad is axis 5 and 6 (horiz and vertical respectively, -1, 0, +1 tri-state).

So how does edu.wpi.first.wpilibj.buttons.Button use the axes? (but theyre input only takes commands…)