Keyboard Input in DS Java?


#1

I am trying to trigger commands on our robot using a breakout arcade buttuon board that displays as a keyboard. Does anybody know how to read keystrokes from the Driver Station in Java?


#2

I don’t think there is a direct interface. I also would not recommend this as if you accidentally hit the space bar you will E-Stop your robot or hit enter which disables it.


#3

Well, we have five buttons that map to u, v, c, x, and Ctrl (until recently Spacebar because the guy who built it didn’t know about e stop)


#4

The answer is it depends what dashboard you’re using. The only way the robot can get the keyboard data is if the dashboard sends it. If you’re programming in Java, you’re probably either using SmartDashboard or Shuffleboard. I don’t have a ton of experience with Java, but as far as I know, neither of these allow you to send keyboard data to the robot.

If, however, you use a custom programmed dashboard like a LabVIEW dashboard, locally-hosted website, or other custom program, you can choose any data to send over NetworkTables. If you don’t mind learning a bit of LabVIEW, the functions to get the currently pressed buttons and send them over NetworkTables aren’t too difficult. Since the LabVIEW dashboard is running locally on the driver station and the Java code is running on the roboRIO, they should be able to communicate by NetworkTables, which they both can read/write to.


#5

I assume you are trying to do something like team 1370 has done in this image?
They have an button box on the right side.
You could ask @pugsly14 to see what they did. I am also curious so please update here when/if you figure it out.


#6

That looks like a COTS box for controlling a device. We just have some arcade buttons stuck through a piece of wood and soldered to a board. We are switching it to a cypress board.


#7

Is it too late to change the controller to something that appears to the DS computer as a joystick/gamepad? If you can make this change, then you will be able to interact with your custom device from robot code the same way you read button presses off a joystick.

There is a discussion here about commonly-used options for custom gamepads available from FIRST Choice.

Obligatory pictures of our DS from last year: Robot Controller Options.

Edit: Didn’t see your last post before I posted. Sounds like you have it figured out:


#8

the cypress board might be too old…


#9

Which Cypress board are you using? What makes you say that it might be too old?


#10

CYC8CKIT-059. All the documentation i could find was from 2014. We also have a LaunchPad so I am using that


#11

That part will still work. (We used one last year, and plan to use one again this year.)

Here is slightly newer documentation: https://community.cypress.com/thread/30090. It hasn’t been updated, but nothing’s really changed, so not much need to update.

That is probably the easier option!


#12

Yep. It’s already programmed and sent off for wiring. Thanks for all your help guys


#13

We used the TI Launchpad with a the following box from Digi-Key
https://www.digikey.com/product-detail/en/bud-industries/PC-11491/377-1960-ND/439698


#14

We use a Button Board from AndyMark. It maps to normal controller buttons so adding functionality for it should take as long as it would to map a command to a normal controller button. You should give it a look, we’re actually using 2 because of all the subsystems on our bot.


#15

You can buy the exact same arcade button encoder from Amazon for around 1/2 the price of Andymark’s. They are just marking it up.
XCSOURCE Zero Delay Arcade Game USB Encoder