Log in

View Full Version : Programming Logitech Gamepad F310


Garten Haeska
12-01-2011, 20:26
is there a way to program the Logitech Gamepad F310 into Java so you are able to move around when you are driving? Any ideas would be great!

davidthefat
12-01-2011, 20:32
I assume, from what I can see, that the WPILib uses the "thumbstick" as the main axis. So what ever shows up in the X/Y box in the game controller settings in the control panel is what you get. So it would be totally independent of the game controller. As long as you have working drivers for it on the computer you should be fine. In fact, if you want I assume you can use a wii mote or kinect to control the robot. Assuming you have the right drivers and software.

http://i31.tinypic.com/2ebh113.jpg

Garten Haeska
12-01-2011, 20:40
But what i would like to know after you install the software on the clamshell, is there a certain item we can call for from the winlibj file to let us use the game pad?

davidthefat
12-01-2011, 20:44
Use the Joystick class. All game controllers and joypads all look like joypads to the computer. The only difference is the number of buttons and joysticks

Garten Haeska
12-01-2011, 20:49
so is there a way that when i call of the joysticks that both of the "thumbsticks" are used or do i have to call for two seperate joysticks?

davidthefat
12-01-2011, 20:56
so is there a way that when i call of the joysticks that both of the "thumbsticks" are used or do i have to call for two seperate joysticks?

Now, I am not sure about that. My computer interpreted the second joystick as the "Z" axis, and it can only do the left and tight movement. I am not sure about your gamepad, it is totally dependent on the drivers. I am not sure, but it might be a combination of the throttle and Z axis.

Garten Haeska
12-01-2011, 21:01
okay ill try that tomorrow, thanks for the help! its greatly apprectiated!

davidthefat
12-01-2011, 21:07
Now, I might be very wrong, so remember to put the robot on cinder blocks or something so it does not go haywire and dangerous. A safe way is just outputting the throttle and z on the console window using System.out.println();

ksanger
12-01-2011, 21:12
Thanks for this thread. I assume this means that If our driver station is running on a Windows 7 laptop and Win7 sees the gamepad and loads the drivers then the wpilibj will see the controllers as a Joystick.? Or is it more like XP and we have to find and install a .dll for the gamepad we choose?

davidthefat
12-01-2011, 21:30
Thanks for this thread. I assume this means that If our driver station is running on a Windows 7 laptop and Win7 sees the gamepad and loads the drivers then the wpilibj will see the controllers as a Joystick.? Or is it more like XP and we have to find and install a .dll for the gamepad we choose?

The Driverstation should identify the joystick if the computer has been able to find it. If it hasn't post here and I would be happy to assist you.

JewishDan18
12-01-2011, 23:32
I find it good to use the getRawAxis() command. It lets you use all four or five axis from a game controller (two for each stick, one for the triggers on the xbox 360 controllers my team used last year) easily, just by specifying the number, which is relatively easy to determine via trial and error.

EDIT: For buttons, I use getRawButton() in the same way (give it the number of the button). One issue I had was that the D pad wouldn't work, but I think thats because it is read as a 2D position, not a single axis, or something like that.