Go to Post Let me live in my delusional world where minibots never happened and the Tetrix kit doesn't exist. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-01-2015, 15:34
TheMechanic40 TheMechanic40 is offline
Registered User
FRC #3506 (YETI Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: North Carolina
Posts: 31
TheMechanic40 is an unknown quantity at this point
Can you get joystick values?

Hello everyone, does anyone know if there is someway to get what button is currently being pressed on a joystick? Let provide some context: My team, 3506, is using a command based robot and we've just created a way to record the values taken from the joysticks and save them to a file so they can be used as the autonomous. We know how to record the various button inputs and the joystick axes values and we can do this successfully, but in order to be able to detect the button presses and save them we have to edit three different classes. So my question is: Is there a way to detect any button on a joystick and return a which button is being pressed?
  #2   Spotlight this post!  
Unread 23-01-2015, 16:44
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 430
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Can you get joystick values?

In either java or c++, they're both very similar.

Check out the getRawButton method in the joystick class

http://wpilib.screenstepslive.com/s/...1881-joysticks


[edit]
If you're asking how to get the status of all buttons simultaneously, look at the getStickButtons method in the DriverStation class.

Source code is here:
http://team2168.org/javadoc/src-html....html#line.291

Not really sure what the format of the returned in it. I would assume it's that each bit is set corresponding to button id. The code isn't really commented... so you'll need to just try it out and see.
__________________
http://team2168.org

Last edited by otherguy : 23-01-2015 at 17:00. Reason: more infos
  #3   Spotlight this post!  
Unread 23-01-2015, 17:47
Quantum Byte's Avatar
Quantum Byte Quantum Byte is offline
Lead Programmer
AKA: Domenic
FRC #4776 (S.C.O.T.S. Bots)
Team Role: Programmer
 
Join Date: May 2012
Rookie Year: 2011
Location: Hartland, Michigan
Posts: 16
Quantum Byte is an unknown quantity at this point
Re: Can you get joystick values?

Check out our GamePad util class (Java) for our robot. It makes joystick mapping easy!

https://github.com/SCOTS-Bots/FRC-20...s/Gamepad.java
  #4   Spotlight this post!  
Unread 24-01-2015, 13:59
TheMechanic40 TheMechanic40 is offline
Registered User
FRC #3506 (YETI Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: North Carolina
Posts: 31
TheMechanic40 is an unknown quantity at this point
Re: Can you get joystick values?

Quote:
Originally Posted by otherguy View Post
In either java or c++, they're both very similar.

Check out the getRawButton method in the joystick class

http://wpilib.screenstepslive.com/s/...1881-joysticks


[edit]
If you're asking how to get the status of all buttons simultaneously, look at the getStickButtons method in the DriverStation class.

Source code is here:
http://team2168.org/javadoc/src-html....html#line.291

Not really sure what the format of the returned in it. I would assume it's that each bit is set corresponding to button id. The code isn't really commented... so you'll need to just try it out and see.
Thank you so much this worked perfectly.
Closed Thread


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 02:43.

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