Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Using keyboard (http://www.chiefdelphi.com/forums/showthread.php?t=133869)

igorjavaroni 02-02-2015 13:28

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? :confused: :confused: :confused:

faust1706 02-02-2015 13:30

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.

igorjavaroni 02-02-2015 13:35

Re: Using keyboard
 
Nice, but is there any library spicific to do that?

Ben Wolsieffer 02-02-2015 14:03

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.

Sperkowsky 02-02-2015 15:23

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

GeeTwo 02-02-2015 15:45

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".

orangeandblack5 03-02-2015 18:52

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!

Greg McKaskle 04-02-2015 06:29

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

orob 09-04-2015 19:22

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.


All times are GMT -5. The time now is 10:22.

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