how to program an xbox controller to drive a robot

can someone explain how to do this???

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.

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

To go with Mark’s post, you can follow the getting started instructions in the WPILib Documentation explaining how to create a basic robot drive program, if you don’t know already.

What are you programming it in?

thanks for the help i will let my team’s programer know what you have posted so far

We tried Xbox controllers and drivers preferred Logitech gamepads because the joysticks are symetrical.

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

…Yeah. I was a bit confused :smiley:

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.

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.

The gamepads are the logitech controllers: . 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.

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 and you can get values from there!

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

If you’re working in LabVIEW, NI released a nifty program to show you where the axes and buttons are.

They must be playstation guys