Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   getRawButton() problems (http://www.chiefdelphi.com/forums/showthread.php?t=132446)

thetonio96 08-01-2015 21:48

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?

//Example
public void teleopPeriodic() {
if(stick.getRawButton(1)==true){
//Some Code
}
}

orangelight 08-01-2015 22:00

Re: getRawButton() problems
 
Does anything else on the controller work?

thetonio96 08-01-2015 22:04

Re: getRawButton() problems
 
Yes, the RobotDrive is getting the X and Y axis and they are both working.

orangelight 08-01-2015 22:06

Re: getRawButton() problems
 
Did you look under the driver station joystick menu and see if the button is being read there?

thetonio96 08-01-2015 22:08

Re: getRawButton() problems
 
Yes, also did that with each button and they all blink the green light in the driver station.

orangelight 08-01-2015 22:10

Re: getRawButton() problems
 
Are you sure its the right port for the button? Do you mind sharing the rest of your code?

Ben Wolsieffer 08-01-2015 22:11

Re: getRawButton() problems
 
Even though it is for C++, this problem sounds suspiciously similar: http://www.chiefdelphi.com/forums/sh...hreadid=132426

orangelight 08-01-2015 22:16

Re: getRawButton() problems
 
It sounds like might be an issue just for that controller. Did you try other methods like getButton and getTrigger?

thetonio96 08-01-2015 22:23

Re: getRawButton() problems
 
Ok, so this https://gist.github.com/antoniotorre...9be53daa4f6a18 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.

BradAMiller 08-01-2015 22:35

Re: getRawButton() problems
 
What model joystick is it? And can you try another joystick type to see if that works?

thetonio96 08-01-2015 22:39

Re: getRawButton() problems
 
Yeah, we tried with the Logitech ATK3 and the Xbox Controller and both have the same issue.

nickmcski 09-01-2015 00:21

Re: getRawButton() problems
 
Quote:

Originally Posted by thetonio96 (Post 1424685)
public void teleopPeriodic() {
if(stick.getRawButton(1)==true){
//Some Code
}
}

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.

Code:

public void teleopPeriodic() {
        if(stick.getRawButton(1)){
                //Some Code
        }
}


notmattlythgoe 09-01-2015 07:47

Re: getRawButton() problems
 
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.

Pratik Kunapuli 09-01-2015 10:25

Re: getRawButton() problems
 
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.

Joe Ross 09-01-2015 11:34

Re: getRawButton() problems
 
Quote:

Originally Posted by Pratik341 (Post 1424945)
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.


All times are GMT -5. The time now is 11:17.

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