Hi there im programming our Robots Controller and im running into a problem with our XboxController from 2021 to 2022 they updated the triggers on the XboxController and i was wondering if anyone could help me with getting the value of the double when you call that trigger and how to make it as like if statement.
Here is some of the code i have now rightTriggerAxis = xboxController.getRightTriggerAxis(); while(rightTriggerAxis >= 0.5){ System.out.println("Were Shootings"); }
and this will display but when we load the simulator it starts calling it before we put it in teleop and i was wondering if anyone had any idea on how to use these.
Would it be possible to share more of your code? If not can you share in what method you have placed this code block?
Lastly, it’s not often advisable to have a while loop in your FRC code (see here Are loops ok in FRC Programming) as it could possibly cause you to overrun the 20 ms periodic cycle of the period functions.
Here cause with the new xboxcontroller import you can just get the buttons like if(Xboxcontroller.getXbuttonPressed){
run command}
but when i get the controller leftTriggerAxis i cant put it in a if statment.
but
here is more code
Blockqoute
new JoystickButton(xboxController, 8).whileActiveOnce
(new WenchDownCmd(wenchSubsystem, WenchConstants.kMotorSpeed));
new JoystickButton(xboxController, 9).whileActiveOnce(
new ShootForwardCmd(shooterSubsysten, ShooterConstants.kleftMotorSpeed, ShooterConstants.krightMotorSpeed));