getRawButton() problems

Hi everyone, our team is programming the robot with Java, but we are have a problem getting the boolean value of getRawButton() method. Does someone had a similar problem or knows how to fix it?

public void teleopPeriodic() {
//Some Code

Does anything else on the controller work?

Yes, the RobotDrive is getting the X and Y axis and they are both working.

Did you look under the driver station joystick menu and see if the button is being read there?

Yes, also did that with each button and they all blink the green light in the driver station.

Are you sure its the right port for the button? Do you mind sharing the rest of your code?

Even though it is for C++, this problem sounds suspiciously similar:

It sounds like might be an issue just for that controller. Did you try other methods like getButton and getTrigger?

Ok, so this is the test code that we are using to test the controller’s buttons. The basic idea is that the spikes turns on, which it does on the autonomous mode.

What model joystick is it? And can you try another joystick type to see if that works?

Yeah, we tried with the Logitech ATK3 and the Xbox Controller and both have the same issue.

Just remember that this should return a boolean, so you don’t need the == true

just try, it simplifies the code and leaves less room for error.

public void teleopPeriodic() {
                //Some Code

We ran into an issue like this yesterday. Make sure you have your joystick set on the right port. Everything shifted to a 0 index this year on the rio and the driver station.

Not sure if this is the case for the buttons and axis or not though.

Something that our team found was that all of the axis and button numbers don’t directly translate from the 2014 control system to the 2015 control system. We use Xbox controllers and previously, the left joystick Y axis was axis 5, but in the 2015 code it is recognized as axis 1. I would recommend making a test program and iteration through all the axis numbers and the button numbers and writing them all down for future use.

Have you looked at the display on the USB tab of the driver station? It does the same thing.

Okay, the problem was resolved by using another laptop. Still, we don’t know what caused the problem. This is the code that worked: