Class XboxControllerSim

java.lang.Object
edu.wpi.first.wpilibj.simulation.GenericHIDSim
edu.wpi.first.wpilibj.simulation.XboxControllerSim

public class XboxControllerSim extends GenericHIDSim
Class to control a simulated Xbox controller.
  • Constructor Details

    • XboxControllerSim

      Constructs from a XboxController object.
      Parameters:
      joystick - controller to simulate
    • XboxControllerSim

      public XboxControllerSim(int port)
      Constructs from a joystick port number.
      Parameters:
      port - port number
  • Method Details

    • setLeftX

      public void setLeftX(double value)
      Change the left X value of the controller's joystick.
      Parameters:
      value - the new value
    • setRightX

      public void setRightX(double value)
      Change the right X value of the controller's joystick.
      Parameters:
      value - the new value
    • setLeftY

      public void setLeftY(double value)
      Change the left Y value of the controller's joystick.
      Parameters:
      value - the new value
    • setRightY

      public void setRightY(double value)
      Change the right Y value of the controller's joystick.
      Parameters:
      value - the new value
    • setLeftTriggerAxis

      public void setLeftTriggerAxis(double value)
      Change the value of the left trigger axis on the controller.
      Parameters:
      value - the new value
    • setRightTriggerAxis

      public void setRightTriggerAxis(double value)
      Change the value of the right trigger axis on the controller.
      Parameters:
      value - the new value
    • setAButton

      public void setAButton(boolean value)
      Change the value of the A button on the controller.
      Parameters:
      value - the new value
    • setBButton

      public void setBButton(boolean value)
      Change the value of the B button on the controller.
      Parameters:
      value - the new value
    • setXButton

      public void setXButton(boolean value)
      Change the value of the X button on the controller.
      Parameters:
      value - the new value
    • setYButton

      public void setYButton(boolean value)
      Change the value of the Y button on the controller.
      Parameters:
      value - the new value
    • setLeftBumperButton

      public void setLeftBumperButton(boolean value)
      Change the value of the left bumper button on the controller.
      Parameters:
      value - the new value
    • setRightBumperButton

      public void setRightBumperButton(boolean value)
      Change the value of the right bumper button on the controller.
      Parameters:
      value - the new value
    • setBackButton

      public void setBackButton(boolean value)
      Change the value of the back button on the controller.
      Parameters:
      value - the new value
    • setStartButton

      public void setStartButton(boolean value)
      Change the value of the start button on the controller.
      Parameters:
      value - the new value
    • setLeftStickButton

      public void setLeftStickButton(boolean value)
      Change the value of the left stick button on the controller.
      Parameters:
      value - the new value
    • setRightStickButton

      public void setRightStickButton(boolean value)
      Change the value of the right stick button on the controller.
      Parameters:
      value - the new value
    • setLeftBumper

      @Deprecated(since="2025", forRemoval=true) public void setLeftBumper(boolean state)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use setLeftBumperButton(boolean) instead. This function is deprecated for removal to make function names consistent to allow the HID classes to be automatically generated.
      Change the value of the left bumper on the joystick.
      Parameters:
      state - the new value
    • setRightBumper

      @Deprecated(since="2025", forRemoval=true) public void setRightBumper(boolean state)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use setRightBumperButton(boolean) instead. This function is deprecated for removal to make function names consistent to allow the HID classes to be automatically generated.
      Change the value of the right bumper on the joystick.
      Parameters:
      state - the new value