Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Regarding getPOV() (http://www.chiefdelphi.com/forums/showthread.php?t=132591)

Hsifeulbhsifder 10-01-2015 18:11

Regarding getPOV()
 
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?

cgmv123 10-01-2015 18:21

Re: Regarding getPOV()
 
Here's the API:

Quote:

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

Re: Regarding getPOV()
 
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

Re: Regarding getPOV()
 
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

Re: Regarding getPOV()
 
Quote:

Originally Posted by Hsifeulbhsifder (Post 1426171)
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

Re: Regarding getPOV()
 
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

Re: Regarding getPOV()
 
Quote:

Originally Posted by Poseidon1671 (Post 1426314)
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.

tStano 11-01-2015 18:50

Re: Regarding getPOV()
 
Quote:

Originally Posted by Poseidon1671 (Post 1426206)
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

Re: Regarding getPOV()
 
Quote:

Originally Posted by tStano (Post 1426407)
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.

tStano 11-01-2015 19:50

Re: Regarding getPOV()
 
Quote:

Originally Posted by Joe Ross (Post 1426415)
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

Re: Regarding getPOV()
 
Quote:

Originally Posted by Joe Ross (Post 1426329)
Have you tried it? That's not what the docs posted above say.

Sorry, I see that now.

tStano 13-01-2015 23:03

Re: Regarding getPOV()
 
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.


All times are GMT -5. The time now is 10:43.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi