Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Xbox Controller? (http://www.chiefdelphi.com/forums/showthread.php?t=94131)

youxinche95 29-03-2011 01:17

Xbox Controller?
 
Any other team use an xbox controller for their robot? We figured most of the functionalities of a joystick pair up fairly well with the xbox controller, for instance, getTwist() is Y for the right joystick and getThrottle() is left. How do we access the current value of the view hat i.e. the arrow keys between the two joysticks. Thanks in advance!

MikeE 29-03-2011 02:05

Re: Xbox Controller?
 
Quote:

Originally Posted by youxinche95 (Post 1046802)
How do we access the current value of the view hat i.e. the arrow keys between the two joysticks. Thanks in advance!

The XBox controller effectively has 7 axes but unfortunately the HID standard supported by wpilib only returns 6 axes of control.

The left & right joysticks use 2 each as expected, but the two triggers also use an axis with the left trigger giving negative values and the right positive. Thus the amount of trigger displacement can be detected, not just a binary value of each trigger.

The Directional Pad (D-pad) uses the 6th and 7th axis, but you only have access to the 6th axis via getRawAxis. Therefore code can detect left & right directions on the D-pad, but not up / down.

A more complete answer including button mappings can be found here: http://www.chiefdelphi.com/forums/sh...45&postcount=8

There may be a way of circumventing the standard XBox axis mapping through its device driver, but I haven't looked into that.

R.C. 29-03-2011 05:29

Re: Xbox Controller?
 
Just wondering, has anyone been able to use the "rumble" feature of the xbox controller?

-RC

MikeE 29-03-2011 11:42

Re: Xbox Controller?
 
Quote:

Originally Posted by R.C. (Post 1046817)
Just wondering, has anyone been able to use the "rumble" feature of the xbox controller?

-RC

We've often joked about using an accelerometer to allow the driver to feel the impact of collisions as a Pavlovian training aid.

I read that the ZomB dashboard package supports rumble feedback http://www.chiefdelphi.com/forums/sh...ad.php?t=88306.

byteit101 29-03-2011 15:10

Re: Xbox Controller?
 
Quote:

Originally Posted by MikeE (Post 1046901)
We've often joked about using an accelerometer to allow the driver to feel the impact of collisions as a Pavlovian training aid.

I read that the ZomB dashboard package supports rumble feedback http://www.chiefdelphi.com/forums/sh...ad.php?t=88306.

it does indeed, drop an X Shake control (has black squiggly line) and give it a name. Send value to that name as either a float between 0 and 1, or a string in the format "left;right" where left and right are a float between 0 and 1.

Videos:
http://thecatattack.org/ZomB (@1:05)
http://thecatattack.org/user/PatrickP/ryantest (first video on page)

R.C. 29-03-2011 20:18

Re: Xbox Controller?
 
Quote:

Originally Posted by byteit101 (Post 1046988)
it does indeed, drop an X Shake control (has black squiggly line) and give it a name. Send value to that name as either a float between 0 and 1, or a string in the format "left;right" where left and right are a float between 0 and 1.

Videos:
http://thecatattack.org/ZomB (@1:05)
http://thecatattack.org/user/PatrickP/ryantest (first video on page)

Thats cool,

Even though my team isn't using the ZomB dashboard, how do you do it in Java?

Thanks,

-RC

byteit101 29-03-2011 21:13

Re: Xbox Controller?
 
Quote:

Originally Posted by R.C. (Post 1047111)
Thats cool,

Even though my team isn't using the ZomB dashboard, how do you do it in Java?

Thanks,

-RC

Not easily. you can look at the source for it (zombdlls/WPF/Controls/xShake.cs), but it is just a simple wrapper for a Direct X wrapper library (SlimDX), so you would have to call Direct X yourself if you want to do that in Java. I personally did not look too deeply into that, I just used http://www.mediafire.com/file/ihhjzt...Controller.zip and it worked, so I never bothered with anything else.


All times are GMT -5. The time now is 23:02.

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