View Full Version : how to program an xbox controller to drive a robot
can someone explain how to do this???
Mark McLeod
25-10-2013, 19:16
An xbox game controller shows up in your code looking like any other joystick.
In your code you have to map the buttons and sticks to whatever you want them to do.
For example, to setup a 2-stick tank drive you might use Axis 2 for the left drive and Axis 5 for the right drive.
http://team358.org/files/programming/ControlSystem2009-/XBoxControlMapping.jpg
BBray_T1296
25-10-2013, 21:12
Remember, though, You must have a wired controller (with the USB cable) for competition play, because any wireless communication* is forbidden.
*-Other than the robot router, of course
RyanCahoon
25-10-2013, 21:30
can someone explain how to do this???
In your code you have to map the buttons and sticks to whatever you want them to do.
To go with Mark's post, you can follow the getting started instructions in the WPILib Documentation (http://wpilib.screenstepslive.com/s/3120) explaining how to create a basic robot drive program, if you don't know already.
Chadfrom308
25-10-2013, 21:55
What are you programming it in?
thanks for the help i will let my team's programer know what you have posted so far
MichaelBick
28-10-2013, 02:14
We tried Xbox controllers and drivers preferred Logitech gamepads because the joysticks are symetrical.
SoftwareBug2.0
28-10-2013, 03:13
joysticks are syndical.
I didn't even know that was a word, but I looked it up and it is. I guess you learn something new every day.
MichaelBick
28-10-2013, 04:12
I didn't even know that was a word, but I looked it up and it is. I guess you learn something new every day.
I should learn to not post from my phone. I corrected the original post
BBray_T1296
28-10-2013, 04:17
I should learn to not post from my phone. I corrected the original post
...Yeah. I was a bit confused :D
JamesTerm
28-10-2013, 10:34
can someone explain how to do this???
http://gaming.stackexchange.com/questions/62027/does-the-xbox-windows-controller-work-with-directinput-games
Keep in mind the Driver Station uses direct input (not xinput). This may change for 2015 (fingers crossed).
FYI: The left right trigger buttons acting as one is a side effect for Logitech F310 controller as well.
We tried Xbox controllers and drivers preferred Logitech gamepads because the joysticks are symetrical.
I'm surprised they prefer joysticks. Our team prefers xbox/logitech controllers because we are all so used to the feel and location of buttons on xbox type controllers since we play video games so much (whenever a visitor asks about the controller, our coach comments that he thinks that someday, cars will be driven with xbox controllers. Que up MIB2). We used to use joysticks, but now we exclusively use the controllers.
Our biggest problem with them is that the controllers keep disappearing when we need them most! In fact, at the Razorback Regional last year, we realized that we had forgotten to bring one and had to run to Best Buy and get one. We bought a pink one, figuring few people would ever take it. Low and behold, it was gone by August.
MichaelBick
28-10-2013, 12:56
I'm surprised they prefer joysticks
The gamepads are the logitech controllers: http://gaming.logitech.com/en-us/product/f310-gamepad . They are not independent joysticks. They prefer the OVER the xbox controllers because the joysticks on the controller are in the same place. We still have used independent logitech joysticks for the operator the past two years because for shooting the trigger makes more sense.
Invictus3593
31-10-2013, 11:16
We've used an Xbox controller since we began our team. It just shows up in Labview as another USB Joystick, all you have to do is make sure you have slescted the correct USB slot in Begin.vi and you can get values from there!
Domenic Rodriguez
31-10-2013, 12:19
If working in Java or C++, it can be helpful to write a utility class for the Xbox controller so you don't have to remember what button/axis number maps to each physical one. Here's (https://github.com/LuNaTeCs-316/SureShotSAM-Java/blob/master/src/org/lunatecs316/frc2013/lib/XboxController.java) what my team uses. Then you can just use it like any other joystick but with additional functionality.
You can program them the same way you program any joystick, the buttons/axis will just not match up by default, you can do some experimenting to figure that out.
If you are using Java, I wrote a class for the Xbox Controller last year that is a drop in replacement for the standard joystick class when it comes to the CommandBased scheduling.
XboxController.java (https://github.com/frc3946/UltimateAscent/blob/master/src/org/usfirst/frc3946/UltimateAscent/XboxController.java)
geomapguy
29-11-2013, 21:13
If you're working in LabVIEW, NI released a nifty program to show you where the axes and buttons are.
http://firstforge.wpi.edu/sf/frs/do/downloadFile/projects.wpilib/frs.joystick_explorer.joystick_explorer/frs1934?dl=1
Invictus3593
29-11-2013, 22:02
We tried Xbox controllers and drivers preferred Logitech gamepads because the joysticks are symetrical.
They must be playstation guys
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.