Go to Post FIRST teams do not allow other FIRST teams to fail. - [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 23-04-2014, 18:48
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
How to Program an XBOX Controller

Hey robot peeps - our team is preparing for next years competition and we are completely lost on how to program in an XBOX controller. We drove using tankdrive this year and are using command base java. ANY help will be greatly appreciated.

THANKS!
Reply With Quote
  #2   Spotlight this post!  
Unread 23-04-2014, 18:51
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,078
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: How to Program an XBOX Controller

First, make sure you're using wired XBOX controllers. Wireless controls of any sort are illegal in competition.

Here's the class we use: https://github.com/team1306/Badgerbo...ontroller.java

Just use XBoxController xcon = new XBoxController(port #); to instantiate it and xcon.getWhatever(); to access it. Joysticks and triggers are returned as doubles and buttons are returned as booleans.

To program TankDrive, you can simply assign the Y-axis of the left joystick to the left motor(s) and the Y-axis of the right joystick to the right motor(s). I recommend cubing the inputs for better control and dealing with the deadband. (You'll want at least a 10 percent deadband.)

Note the comment regarding the triggers. We've never had an issue with it, but it's something to be aware of. (It's also unavoidable, since it has to do with how Windows reads the controller.)
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)


Last edited by cgmv123 : 23-04-2014 at 19:04.
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 22:39.

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