Log in

View Full Version : Xbox controller right analog stick not being read.


ToMoPAnae
16-01-2015, 20:37
The right analog stick is not being read. We tried all axes and hands available but the left joystick is being read for both the left and right hand. It worked fine in 2014. We read the number of axes and it said that there were 6 axes available. We are using Java. The joysticks appear in the driver station and both are read correctly there, but the .get methods on the joystick object do not work for the right joystick. Has anyone else had this problem? If so, how did you fix it?

We fixed the problem. You need to use .getRawAxis(AxisNumber) and input the correct axis number. 4 for the X axis for the right joystick and 5 was the Y axis for the right joystick.

AustinShalit
16-01-2015, 20:52
Have you made sure your controller is working? I would check it with the Joystick Explorer: http://firstforge.wpi.edu/sf/frs/do/viewRelease/projects.wpilib/frs.joystick_explorer.joystick_explorer.

You could also use the built in Driver Station tool as shown at the bottom of this page: http://wpilib.screenstepslive.com/s/4485/m/13810/l/241881-joysticks

If that says that the joystick is working then maybe you could post or PM me some code.

Greg McKaskle
17-01-2015, 07:44
The new DS supports joysticks via DirectInput, which is the same library used last year, and it supports Input for Xbox controllers. Which type of controller is this? Does it have a switch or Mode button to select axes behavior?

Greg McKaskle

shindigo
17-01-2015, 12:21
We just ran into the same problem!!

Based on our own testing: this is the new mapping for xBox joystick axis for this year

LeftX = 0;
LeftY = 1;
LeftTrigger = 2; // Strange because triggers were one axis last year.
RightTrigger = 3;
RightX = 4;
RightY = 5;

NHoffmann
21-01-2015, 09:34
We just ran into the same problem!!

Based on our own testing: this is the new mapping for xBox joystick axis for this year

LeftX = 0;
LeftY = 1;
LeftTrigger = 2; // Strange because triggers were one axis last year.
RightTrigger = 3;
RightX = 4;
RightY = 5;

Thank you so much! We were having so much trouble getting everything to work with the old mappings, and this explains it!

Mark McLeod
21-01-2015, 10:11
Here's a mapping:

http://www.team358.org/files/programming/ControlSystem2015-2019/images/XBoxControlMapping.jpg

and others: http://www.team358.org/files/programming/ControlSystem2015-2019/#joysticks

Arhowk
21-01-2015, 10:13
Thank you so much! We were having so much trouble getting everything to work with the old mappings, and this explains it!

The new driver station will show the name of all of the axes as well as their channels, I believe it is the fourth option down on the left

Greg McKaskle
21-01-2015, 10:35
I didn't realize that it was the number of axes that was the issue. For a bit of background on this.

DirectInput will read Xbox controllers and Xbox-like controllers and typically combines the left and right shoulder buttons into one. So one axes is spread out and the left button drives it negative and the right button positive, or vice-versa.

But The XInput drivers treat the shoulder buttons as two separate axes that only go from zero to 1.

The Logitech F310 can actually be both depending on a switch on the back.

So back to the topic. The joystick APIs are a little different. Quite a few additional features are supported, and the USB tab is key to understanding the functionality of a given joystick. If you assume it works just like last year, you may miss some functionality and/or get confused and assume a behavior change is a bug.

Greg McKaskle