|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
Using keyboard
Hi Guys, before i start, let's imagine if your team forget the joystick at school during an event, Is there anyway to control our robot using keyboard(WSAD) to move our robot? How to do that?
![]() |
|
#2
|
||||
|
||||
|
Re: Using keyboard
It is very possible (but I don't have code at hand to show/give you).
Caution: you cannot toggle motor speeds and what not with a keyboard. It is either 1 or 0, so you'll either go full speed or not move. Just a warning. |
|
#3
|
|||
|
|||
|
Re: Using keyboard
Nice, but is there any library spicific to do that?
|
|
#4
|
|||
|
|||
|
Re: Using keyboard
No, there is no way to do it directly through WPILib. I would use a program (maybe a SmartDashboard extension) on the DS to read the keyboard and send commands over NetworkTables. I would be very careful about accidentally creating a runaway robot.
|
|
#5
|
|||||
|
|||||
|
Why would you want to? As a pc gamer I love wasd except for in driving games. First by nature is a driving game. A controller or joystick Is much better because it allows for more linear movements
|
|
#6
|
|||||
|
|||||
|
Re: Using keyboard
You could have WASD add/subtract a smaller fraction to the speed in that direction (perhaps 10%). If you go this route, you probably also want a button that goes to zero from whatever speed you are doing, so you might use WAZD for increment speed, and S for "stop".
|
|
#7
|
|||
|
|||
|
Re: Using keyboard
I would also like an answer to this.
I tried this for about 2 days to no avail (I've never used LabView before), and I would really like to know how to do this (mostly for testing purposes (such as being able to run the robot simulator without having to bring home a joystick)). If you want I can upload my unsuccessful code, but it didn't work right, so I won't right now. Thanks in advance! |
|
#8
|
|||
|
|||
|
Re: Using keyboard
The VIs for reading the keyboard, like a video game does, are located in Connectivity>>Input Devices. Your dashboard will need to open the keyboard and in a loop, it will need to read the keyboard and update one or more "virtual joystick" SmartDashboard globals. I'd recommend doing a flush when setting them or it will only get transmitted to the robot at 100ms rate.
The other way to get the data to the robot is via UDP or TCP communications. You will need to make your own simple protocol, possibly just sending the keys via TCP is sufficient. Greg McKaskle |
|
#9
|
||||
|
||||
|
Re: Using keyboard
I made a custom dashboard and put buttons on it and drove with the mouse rather than wasd, but labview's method of event capturing keystrokes isn't really going to work within the framework of the robotic code unless you make a keyboard driver VI that runs like the joystick driver runs. If you have a Wii, you can use one of those controllers via bluetooth... that might be worthwhile.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|