Go to Post I believe the employees of AndyMark should start making presentations to large companies on the right way to run a business. - Taylor [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 25-02-2010, 11:24
The Engineer The Engineer is offline
Registered User
FRC #2607
 
Join Date: Jan 2010
Location: America
Posts: 14
The Engineer is an unknown quantity at this point
Xbox 360 controllers

I am relatively new to java and i was wondering if anyone has gotten a xbox360 controller was using one. If so how do you hook it up? Can you just use the Joystick class in java? and How do you distinguish between axises in java? any answers would be greatly appreciated and I do have a wireless and a wired controller if that makes it easier.
Reply With Quote
  #2   Spotlight this post!  
Unread 25-02-2010, 11:46
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Xbox 360 controllers

We are using a wired Xbox 360 controller in Java with no problems. Just install the drivers on the Classmate, plug it in, and access it using the Joystick class.

For more information, and a mapping of controller axes to Joystick class axes, see: http://www.chiefdelphi.com/forums/sh...threadid=82825
Reply With Quote
  #3   Spotlight this post!  
Unread 25-02-2010, 12:03
The Engineer The Engineer is offline
Registered User
FRC #2607
 
Join Date: Jan 2010
Location: America
Posts: 14
The Engineer is an unknown quantity at this point
Re: Xbox 360 controllers

I can get the Xbox360 controller hooked up but actually using it to drive in java with multiple joysticks on the controller and if someone could tell me what buttons are what in java?
But the thing I really don't understand is how you get multiple joysticks on the controller working and pick one to use?
Reply With Quote
  #4   Spotlight this post!  
Unread 25-02-2010, 12:39
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Xbox 360 controllers

Read the link in my reply.

Quote:
Axis indexes:
1 - LeftX
2 - LeftY
3 - Triggers (Each trigger = 0 to 1, axis value = right - left)
4 - RightX
5 - RightY
6 - DPad Left/Right

Button mapping matches Windows Control Panel>Game Pads display
So you define the Joystick like:

Code:
Joystick mXboxController = new Joystick(1); // Where "1" is the index of the joystick (you can set this in the Driver Station software).
To read an axis (like the left stick Y axis), simply do:

Code:
double axisValue = mXboxController.getRawAxis(2); // Where "2" is the index of the Y axis on the left stick (see above)
To read a button, simply do:

Code:
boolean buttonPressed = mXboxController.getRawButton(1); // Where "1" is the index of the button reported by the Windows Control Panel "Game Controllers" display
Reply With Quote
  #5   Spotlight this post!  
Unread 25-02-2010, 13:08
The Engineer The Engineer is offline
Registered User
FRC #2607
 
Join Date: Jan 2010
Location: America
Posts: 14
The Engineer is an unknown quantity at this point
Re: Xbox 360 controllers

Thank you so much this has been a huge help the only thing i need now is the button layout and i can get that
Reply With Quote
  #6   Spotlight this post!  
Unread 25-02-2010, 23:55
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: Xbox 360 controllers

just remember to set a buffer b/c the sticks are waay too sensitive
Reply With Quote
  #7   Spotlight this post!  
Unread 26-02-2010, 00:04
Chris is me's Avatar
Chris is me Chris is me is offline
no bag, vex only, final destination
AKA: Pinecone
FRC #0228 (GUS Robotics); FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2006
Location: Glastonbury, CT
Posts: 7,630
Chris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond repute
Send a message via AIM to Chris is me
Re: Xbox 360 controllers

Quote:
Originally Posted by Robototes2412 View Post
just remember to set a buffer b/c the sticks are waay too sensitive
Specifically, the sticks don't return to the same position when you let go, so you'll want to program in a small (10 in each direction) deadband so that you don't have crawling robots.
__________________
Mentor / Drive Coach: 228 (2016-?)
...2016 Waterbury SFs (with 3314, 3719), RIDE #2 Seed / Winners (with 1058, 6153), Carver QFs (with 503, 359, 4607)
Mentor / Consultant Person: 2170 (2017-?)
---
College Mentor: 2791 (2010-2015)
...2015 TVR Motorola Quality, FLR GM Industrial Design
...2014 FLR Motorola Quality / SFs (with 341, 4930)
...2013 BAE Motorola Quality, WPI Regional #1 Seed / Delphi Excellence in Engineering / Finalists (with 20, 3182)
...2012 BAE Imagery / Finalists (with 1519, 885), CT Xerox Creativity / SFs (with 2168, 118)
Student: 1714 (2009) - 2009 Minnesota 10,000 Lakes Regional Winners (with 2826, 2470)
2791 Build Season Photo Gallery - Look here for mechanism photos My Robotics Blog (Updated April 11 2014)
Reply With Quote
  #8   Spotlight this post!  
Unread 26-02-2010, 11:36
The Engineer The Engineer is offline
Registered User
FRC #2607
 
Join Date: Jan 2010
Location: America
Posts: 14
The Engineer is an unknown quantity at this point
Re: Xbox 360 controllers

and how exactly do you set that in the code
Reply With Quote
  #9   Spotlight this post!  
Unread 26-02-2010, 11:44
Chris is me's Avatar
Chris is me Chris is me is offline
no bag, vex only, final destination
AKA: Pinecone
FRC #0228 (GUS Robotics); FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2006
Location: Glastonbury, CT
Posts: 7,630
Chris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond repute
Send a message via AIM to Chris is me
Re: Xbox 360 controllers

I'm not sure on the FRC specifics, but assuming a range of 0-255 with 127 being the middle (I dunno if that's how Xbox joysticks are defined so adjust accordingly)... just if (xBox < 140 || xBox > 110) { return 127;} or something like that.
__________________
Mentor / Drive Coach: 228 (2016-?)
...2016 Waterbury SFs (with 3314, 3719), RIDE #2 Seed / Winners (with 1058, 6153), Carver QFs (with 503, 359, 4607)
Mentor / Consultant Person: 2170 (2017-?)
---
College Mentor: 2791 (2010-2015)
...2015 TVR Motorola Quality, FLR GM Industrial Design
...2014 FLR Motorola Quality / SFs (with 341, 4930)
...2013 BAE Motorola Quality, WPI Regional #1 Seed / Delphi Excellence in Engineering / Finalists (with 20, 3182)
...2012 BAE Imagery / Finalists (with 1519, 885), CT Xerox Creativity / SFs (with 2168, 118)
Student: 1714 (2009) - 2009 Minnesota 10,000 Lakes Regional Winners (with 2826, 2470)
2791 Build Season Photo Gallery - Look here for mechanism photos My Robotics Blog (Updated April 11 2014)
Reply With Quote
  #10   Spotlight this post!  
Unread 06-01-2014, 14:41
puneeth.meruva puneeth.meruva is offline
MIT Class of 2019
AKA: Puneeth Meruva
FRC #1501 (Team T.H.R.U.S.T)
Team Role: Alumni
 
Join Date: Oct 2013
Rookie Year: 2012
Location: Fort Wayne, Indiana
Posts: 36
puneeth.meruva will become famous soon enoughpuneeth.meruva will become famous soon enough
Re: Xbox 360 controllers

How can you use the left stick on the xbox controller to program an arcade drive on Java? Furthermore, how can you take input from the bumpers and the X,Y,B, and A buttons? Any sample code would be appreciated.
Reply With Quote
  #11   Spotlight this post!  
Unread 06-01-2014, 18:17
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Xbox 360 controllers

Quote:
Originally Posted by puneeth.meruva View Post
How can you use the left stick on the xbox controller to program an arcade drive on Java? Furthermore, how can you take input from the bumpers and the X,Y,B, and A buttons? Any sample code would be appreciated.
Do you understand how to program an acrade drive with a joystick? Do you understand how to read a button from a joystick?
Reply With Quote
  #12   Spotlight this post!  
Unread 06-01-2014, 18:40
markmcgary's Avatar
markmcgary markmcgary is offline
Software Mentor
FRC #4322 (Clockwork Oranges)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Fullerton, CA
Posts: 173
markmcgary is just really nicemarkmcgary is just really nicemarkmcgary is just really nicemarkmcgary is just really nicemarkmcgary is just really nice
Re: Xbox 360 controllers

Quote:
Originally Posted by puneeth.meruva View Post
How can you use the left stick on the xbox controller to program an arcade drive on Java? Furthermore, how can you take input from the bumpers and the X,Y,B, and A buttons? Any sample code would be appreciated.
This post with code may help.
Reply With Quote
  #13   Spotlight this post!  
Unread 10-01-2014, 12:07
puneeth.meruva puneeth.meruva is offline
MIT Class of 2019
AKA: Puneeth Meruva
FRC #1501 (Team T.H.R.U.S.T)
Team Role: Alumni
 
Join Date: Oct 2013
Rookie Year: 2012
Location: Fort Wayne, Indiana
Posts: 36
puneeth.meruva will become famous soon enoughpuneeth.meruva will become famous soon enough
Re: Xbox 360 controllers

Quote:
Originally Posted by Joe Ross View Post
Do you understand how to program an acrade drive with a joystick? Do you understand how to read a button from a joystick?
I am familiar with programming a tank drive, but I am unsure of how to program an arcade drive with a joystick. I know how to read joystick input from the xbox controller, but I am still slightly confused about how to read input from the letter buttons on an xbox controller.
Reply With Quote
  #14   Spotlight this post!  
Unread 10-01-2014, 21:20
Dustin Shadbolt's Avatar
Dustin Shadbolt Dustin Shadbolt is offline
In a server room somewhere...
AKA: Dustin Shadbolt
FRC #1555 (Team PULSE)
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Monticello,Indiana
Posts: 320
Dustin Shadbolt is on a distinguished road
Re: Xbox 360 controllers

Quote:
Originally Posted by Dustin Shadbolt View Post
This should be useful to you Puneeth.
Also, there are some example code posts here on CD. I'll link to one post where there is some example Java code to get you pointed in the right direction on how to program your Arcade drive. Great thread
Reply With Quote
  #15   Spotlight this post!  
Unread 10-01-2014, 22:32
Pratik Kunapuli's Avatar
Pratik Kunapuli Pratik Kunapuli is offline
Probably browning-out on Astro-Turf
FRC #1648 (G3 Robotics)(EWCP)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Atlanta, GA
Posts: 143
Pratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to all
Re: Xbox 360 controllers

Quote:
Originally Posted by The Engineer View Post
and how exactly do you set that in the code
In Java, you would need some kind of control loop.

Code:
if(Math.abs(xboxControler.getRawAxis(2)) > .1)
{
    //do something
}
In the above example, the loop checks and makes sure that the value of the stick is above the "dead band" whether it is positive or negative.
__________________
Official Driving Record: 101-59-0
2012-2015 Student 341 Miss Daisy
2015-Current Mentor 1648 G3 Robotics
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Xbox 360 controller viper110110 Programming 7 18-02-2010 19:58
Logitech or Xbox 360 Controllers? JohnFogarty Programming 11 08-02-2010 22:51
XBox 360 Joe Matt Chit-Chat 83 29-11-2005 15:18
Xbox 360 zdeswarte General Forum 1 11-05-2005 14:53


All times are GMT -5. The time now is 10:38.

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