1 year ago
#141436
Engineer627
How can I test if the LTrigger or RTrigger from Xbox controller is pressed in java?
So I am trying to check if the LTrigger or the RTrigger is pressed. Here is what I am trying to do.
public double getLeftTriggerAxis() {
return getRawAxis(Axis.kLeftTrigger.value);
}
private double getRawAxis(int value) {
return 0;
}
/**
* Get the right trigger (RT) axis value of the controller. Note that this axis is bound to the
* range of [0, 1] as opposed to the usual [-1, 1].
*
* @return The axis value.
*/
public double getRightTriggerAxis() {
return getRawAxis(Axis.kRightTrigger.value);
}
/**
* Read the value of the left bumper (LB) button on the controller.
*
* @return The state of the button.
*/
public boolean getLeftBumper() {
return getRawButton(Button.kLeftBumper.value);
}
/**
* Read the value of the right bumper (RB) button on the controller.
*
* @return The state of the button.
*/
public boolean getRightBumper() {
return getRawButton(Button.kRightBumper.value);
}
How can I check if the triggers were pushed, and then use that information in an if statement. So like, if LTrigger is pressed, print "being pushed" or something like that. Thanks so much!
java
wpilib
0 Answers
Your Answer