|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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. Last edited by otherguy : 23-01-2015 at 17:00. Reason: more infos |
|
#3
|
||||
|
||||
|
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
|
|||
|
|||
|
Re: Can you get joystick values?
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|