Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Xbox Controller Tank Drive (http://www.chiefdelphi.com/forums/showthread.php?t=114882)

tuXguy15 11-03-2013 17:53

Xbox Controller Tank Drive
 
Hello. My team would like to use a tank drive system to drive our robot. I know how to do it with two joysticks but not 1 joystick that is an xbox controller. Can anyone help? Thanks!

tp2357 11-03-2013 18:59

Re: Xbox Controller Tank Drive
 
Instantiate the controller as a joystick.

The different physical stick on the controller are different axis to the code. You'll have to hack a bit/google to figure it out, I can't remember off the top of my head. The triggers are also another axis, with one pulling it negative, and the other pulling it positive.

I hope this helps.

JefferMC 12-03-2013 10:46

Re: Xbox Controller Tank Drive
 
As tp said, you can treat the XBox controller as a very strange joystick that has 6 different axes:

1 Left Joystick X
2 Left Joystick Y
3 Triggers
4 Right Joystick X
5 Right Joystick Y
6 DPAD X (never used this)

So, do joystick.GetRawAxis(2) for the left tank drive and joystick.GetRawAxis(5) for the right. You may need to change the signs of the input to get what you want.

gixxy 12-03-2013 13:08

Re: Xbox Controller Tank Drive
 
Here is our XBOX Class

Here is our TankDrive Command

We init an XboxController object in the OI, and I have everything mapped out in the class for the axis. Makes it very simple to call from commands.

ekapalka 12-03-2013 13:59

Re: Xbox Controller Tank Drive
 
Go to run on your computer (if you're using Windows) and search for / run "joy.cpl" (without quotes). Then go to properties (I think) and it should show you everything you could ever need to know about mapping the controller.

tuXguy15 12-03-2013 18:10

Re: Xbox Controller Tank Drive
 
Ok thanks guys ill try that

AlexBrinister 14-03-2013 21:36

Re: Xbox Controller Tank Drive
 
We used one too! You can look at this code. It's in C++ but the WPI syntax should be similar.

Alex Brinister


All times are GMT -5. The time now is 11:31.

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