GetRawAxis returns 0 no matter the position of the joystick

Using 2 thrust master joysticks. Made sure both of them matched the ports in code, and made sure the actual stick port matched in code. Driver station recognizes both joysticks. However, using system.out.println() shows that both axis values are always 0.

to be clear, the code looks something like (based on TimedRobot)

Joystick left = new Joystick(0);
Joystick right = new Joystick(1);
System.out.println(left.getRawAxis(0)); // usually left x axis
System.out.println(left.getRawAxis(1)); // usually left y axis inverted
System.out.println(left.getRawAxis(2)); // usually left x axis (twist)

You mention that the driver station application recognizes the joysticks… If you go to the USB tab and watch while moving the joystick, do you see the axis values move?

1 Like

If that happens every loop you are initializing the joysticks every time. Something to consider.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.