View Single Post
  #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,079
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