|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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!
|
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
||||
|
||||
|
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.
|
|
#6
|
||||
|
||||
|
Re: Xbox Controller Tank Drive
Ok thanks guys ill try that
|
|
#7
|
|||
|
|||
|
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 Last edited by AlexBrinister : 14-03-2013 at 21:46. Reason: Fixed link |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|