Go to Post Speculate away! - IndySam [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 10-01-2015, 18:11
Hsifeulbhsifder Hsifeulbhsifder is offline
Programmer
AKA: Zaeem Mohamed
FRC #5428 (Breaking Bots)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Markham, ON, Canada
Posts: 41
Hsifeulbhsifder is on a distinguished road
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 10-01-2015, 18:21
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,085
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
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.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #3   Spotlight this post!  
Unread 11-01-2015, 10:14
Hsifeulbhsifder Hsifeulbhsifder is offline
Programmer
AKA: Zaeem Mohamed
FRC #5428 (Breaking Bots)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Markham, ON, Canada
Posts: 41
Hsifeulbhsifder is on a distinguished road
Re: Regarding getPOV()

So, if I wanted to get the value of left on the directional-pad, what value must i check for?
Reply With Quote
  #4   Spotlight this post!  
Unread 11-01-2015, 11:39
Poseidon5817's Avatar
Poseidon5817 Poseidon5817 is offline
Founder and CEO, DeadMemes Studios
AKA: Mitchel Stokes
FRC #5817 (Uni-Rex)
Team Role: Mentor
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Clovis, CA
Posts: 403
Poseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud of
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.
__________________
My FRC History:

2014 - Team 1671: Central Valley Regional Finalist and Chairman's Award Winner, Sacramento Regional Finalist, Archimedes Quarterfinalist
2015 - Team 1671: Central Valley Regional Semifinalist, Sacramento Regional Semifinalist and Chairman's Award Winner, Newton Winner, Einstein Winner
2016 - Team 5817: Central Valley Regional Finalist and Rookie All-Star, Orange County Regional Quarterfinalist and Rookie All-Star, Newton Division
2017 - Team 5817: Return of the bench grinder


Reply With Quote
  #5   Spotlight this post!  
Unread 11-01-2015, 12:15
nickmcski nickmcski is offline
Registered User
AKA: Nicholas McCurry
FRC #1482 (Grandin Ghosts)
Team Role: Alumni
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Canada
Posts: 112
nickmcski has a spectacular aura aboutnickmcski has a spectacular aura aboutnickmcski has a spectacular aura about
Re: Regarding getPOV()

Quote:
Originally Posted by Hsifeulbhsifder View Post
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)
Reply With Quote
  #6   Spotlight this post!  
Unread 11-01-2015, 15:34
Poseidon5817's Avatar
Poseidon5817 Poseidon5817 is offline
Founder and CEO, DeadMemes Studios
AKA: Mitchel Stokes
FRC #5817 (Uni-Rex)
Team Role: Mentor
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Clovis, CA
Posts: 403
Poseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud of
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.
__________________
My FRC History:

2014 - Team 1671: Central Valley Regional Finalist and Chairman's Award Winner, Sacramento Regional Finalist, Archimedes Quarterfinalist
2015 - Team 1671: Central Valley Regional Semifinalist, Sacramento Regional Semifinalist and Chairman's Award Winner, Newton Winner, Einstein Winner
2016 - Team 5817: Central Valley Regional Finalist and Rookie All-Star, Orange County Regional Quarterfinalist and Rookie All-Star, Newton Division
2017 - Team 5817: Return of the bench grinder


Reply With Quote
  #7   Spotlight this post!  
Unread 11-01-2015, 15:59
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Regarding getPOV()

Quote:
Originally Posted by Poseidon1671 View Post
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.
Reply With Quote
  #8   Spotlight this post!  
Unread 11-01-2015, 18:50
tStano tStano is offline
Registered User
AKA: Sparks
no team
Team Role: Electrical
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Madison, WI
Posts: 177
tStano will become famous soon enough
Re: Regarding getPOV()

Quote:
Originally Posted by Poseidon1671 View Post
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!
Reply With Quote
  #9   Spotlight this post!  
Unread 11-01-2015, 19:12
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Regarding getPOV()

Quote:
Originally Posted by tStano View Post
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.
Reply With Quote
  #10   Spotlight this post!  
Unread 11-01-2015, 19:50
tStano tStano is offline
Registered User
AKA: Sparks
no team
Team Role: Electrical
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Madison, WI
Posts: 177
tStano will become famous soon enough
Re: Regarding getPOV()

Quote:
Originally Posted by Joe Ross View Post
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!
Reply With Quote
  #11   Spotlight this post!  
Unread 11-01-2015, 22:22
Poseidon5817's Avatar
Poseidon5817 Poseidon5817 is offline
Founder and CEO, DeadMemes Studios
AKA: Mitchel Stokes
FRC #5817 (Uni-Rex)
Team Role: Mentor
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Clovis, CA
Posts: 403
Poseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud of
Re: Regarding getPOV()

Quote:
Originally Posted by Joe Ross View Post
Have you tried it? That's not what the docs posted above say.
Sorry, I see that now.
__________________
My FRC History:

2014 - Team 1671: Central Valley Regional Finalist and Chairman's Award Winner, Sacramento Regional Finalist, Archimedes Quarterfinalist
2015 - Team 1671: Central Valley Regional Semifinalist, Sacramento Regional Semifinalist and Chairman's Award Winner, Newton Winner, Einstein Winner
2016 - Team 5817: Central Valley Regional Finalist and Rookie All-Star, Orange County Regional Quarterfinalist and Rookie All-Star, Newton Division
2017 - Team 5817: Return of the bench grinder


Reply With Quote
  #12   Spotlight this post!  
Unread 13-01-2015, 23:03
tStano tStano is offline
Registered User
AKA: Sparks
no team
Team Role: Electrical
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Madison, WI
Posts: 177
tStano will become famous soon enough
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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:04.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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