Go to Post Hall of Fame FIRST Team 254 has arguably helped more teams become good than any other team in FIRST. I don't think they need a lecture on helping their opponents. - Karthik [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-03-2013, 17:53
tuXguy15's Avatar
tuXguy15 tuXguy15 is offline
Team Mentor
AKA: Devin Kolarac
FRC #2559 (Normality Zero)
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Harrisburg, PA
Posts: 127
tuXguy15 is an unknown quantity at this point
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!
Reply With Quote
  #2   Spotlight this post!  
Unread 11-03-2013, 18:59
tp2357 tp2357 is offline
Registered User
AKA: Tyler Pawlaczyk
FRC #0340 (Greater Rochester Robotics)
Team Role: Programmer
 
Join Date: Mar 2012
Rookie Year: 2011
Location: North Chili, NY
Posts: 5
tp2357 is an unknown quantity at this point
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.
__________________
Java, Embedded C and LISP.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-03-2013, 10:46
JefferMC JefferMC is offline
Registered User
AKA: Jeff Corbett
FRC #1319 (Flash)
Team Role: Mentor
 
Join Date: Nov 2012
Rookie Year: 2005
Location: United States
Posts: 44
JefferMC will become famous soon enough
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 12-03-2013, 13:08
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
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.
__________________
Programmer - A creature known for converting Caffeine into Code.
Studying Computer Science @ Louisiana Tech University
Associate Consultant @ Fenway Group

2012-13: 3946 - Head of Programming, Electrical and Web
2014 - 3468 - Programming Mentor
2015 - Present - Lurker
Reply With Quote
  #5   Spotlight this post!  
Unread 12-03-2013, 13:59
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 12-03-2013, 18:10
tuXguy15's Avatar
tuXguy15 tuXguy15 is offline
Team Mentor
AKA: Devin Kolarac
FRC #2559 (Normality Zero)
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Harrisburg, PA
Posts: 127
tuXguy15 is an unknown quantity at this point
Re: Xbox Controller Tank Drive

Ok thanks guys ill try that
Reply With Quote
  #7   Spotlight this post!  
Unread 14-03-2013, 21:36
AlexBrinister AlexBrinister is offline
Registered User
AKA: Alex Brinister
FRC #1768 (RoboChiefs)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Bolton, MA
Posts: 93
AlexBrinister will become famous soon enough
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
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:25.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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