View Full Version : Regarding getPOV()
Hsifeulbhsifder
10-01-2015, 18:11
I know the POV has to do with the directional-pad- on a gamepad, but what is the API in terms of using it?
And more importantly, how may I run commands based on POV input?
Here's the API:
getPOV
public int getPOV(int pov)
Get the state of a POV on the joystick.
Specified by:
getPOV in class GenericHID
Parameters:
pov - The index of the POV to read (starting at 0)
Returns:
the angle of the POV in degrees, or -1 if the POV is not pressed.
Hsifeulbhsifder
11-01-2015, 10:14
So, if I wanted to get the value of left on the directional-pad, what value must i check for?
Poseidon5817
11-01-2015, 11:39
This is something I've been wondering too. Did this method exist prior to 2015? Because I seem to recall that we had to use the getAxis() method before.
nickmcski
11-01-2015, 12:15
So, if I wanted to get the value of left on the directional-pad, what value must i check for?
i haven't messed with it but I would try for you is just storing the output of the method in a variable and doing a System.out.println(variable); just so you can see the values it outputs in console (or add it to smartdashboard)
Poseidon5817
11-01-2015, 15:34
It should return -1 - 7, with -1 being nothing pressed, 0 being top, 1 being top right, 2 being right, and progressing clockwise to 7 in top left.
Joe Ross
11-01-2015, 15:59
It should return -1 - 7, with -1 being nothing pressed, 0 being top, 1 being top right, 2 being right, and progressing clockwise to 7 in top left.
Have you tried it? That's not what the docs posted above say.
This is something I've been wondering too. Did this method exist prior to 2015? Because I seem to recall that we had to use the getAxis() method before.
Disclaimer: everything i say is for an xBox controller.
When I was trying to get a map of the button and axis numbers yesterday, I found that the dPad wasn't an axis or a button and the triggers were now separate axes. In the past, both triggers had been considered 1 axis, and one added to a value and the other decremented it. In the past, we've used axis for the dPad, but it only worked left and right. Here's hoping this new implementation will work for up and down too. When I saw the dPad didn't work, I assumed it just didn't work, I didn't try getPOV(), because I don't know what a POV was. I'll see if i can figure it out tomorrow!
Joe Ross
11-01-2015, 19:12
Disclaimer: everything i say is for an xBox controller.
When I was trying to get a map of the button and axis numbers yesterday, I found that the dPad wasn't an axis or a button and the triggers were now separate axes. In the past, both triggers had been considered 1 axis, and one added to a value and the other decremented it. In the past, we've used axis for the dPad, but it only worked left and right. Here's hoping this new implementation will work for up and down too. When I saw the dPad didn't work, I assumed it just didn't work, I didn't try getPOV(), because I don't know what a POV was. I'll see if i can figure it out tomorrow!
Have you looked at the display on the USB tab of the driver station? It makes it much easier to find out how things are mapped.
Have you looked at the display on the USB tab of the driver station? It makes it much easier to find out how things are mapped.
I did not. I didn't know that was an option. I just wrote a simple iterative robot program that printed out when i was over .5 on an axis or pressing a button. I had 10 axes and 15 buttons and caught everythign.
I should probably take a better look at the tools available to me before I solve a problem next time. And I'll examine that tomorrow as well. Thanks!
Poseidon5817
11-01-2015, 22:22
Have you tried it? That's not what the docs posted above say.
Sorry, I see that now.
On the x-box controller, the dpad is a "POV". It functions exactly how the doc says using the method call which does not require an argument. up is 0, right is 90, down is 180, left is 270, and if its unpressed, its -1. You do get the 45 degree intervals between those I listed as well.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.