Class XboxController


  • public class XboxController
    extends java.lang.Object
    Wrapper class for the Xbox controller used by FRC 997.
    • Constructor Detail

      • XboxController

        public XboxController​(int port)
        Constructs an XboxController connected to a specific port in the driver station application.
        Parameters:
        port - The port reported by the driver station for this controller.
    • Method Detail

      • setRightRumble

        public void setRightRumble​(double value)
        Sets the rumble of the right side of the controller, for driver feedback.
        Parameters:
        value - The rumble value in [0,1] (inclusive).
      • setLeftRumble

        public void setLeftRumble​(double value)
        Sets the rumble of the left side of the controller, for driver feedback.
        Parameters:
        value - The rumble value in [0,1] (inclusive).
      • getRightRumble

        public double getRightRumble()
        Returns the currently applied right-side rumble value.
        Returns:
        The current rumble value, in [0,1] (inclusive).
      • getLeftRumble

        public double getLeftRumble()
        Returns the currently applied left-side rumble value.
        Returns:
        The current rumble value, in [0,1] (inclusive).
      • leftStickVerticalAxis

        public JoystickAxis leftStickVerticalAxis()
        Returns the JoystickAxis cooresponding to the left stick's vertical axis. Throws a warning if already allocated.
        Returns:
        The JoystickAxis at index 1.
      • leftStickHorizontalAxis

        public JoystickAxis leftStickHorizontalAxis()
        Returns the JoystickAxis cooresponding to the left stick's horizontal axis. Throws a warning if already allocated.
        Returns:
        The JoystickAxis at index 0.
      • rightStickVerticalAxis

        public JoystickAxis rightStickVerticalAxis()
        Returns the JoystickAxis cooresponding to the right stick's vertical axis. Throws a warning if already allocated.
        Returns:
        The JoystickAxis at index 5.
      • rightStickHorizontalAxis

        public JoystickAxis rightStickHorizontalAxis()
        Returns the JoystickAxis cooresponding to the right stick's horizontal axis. Throws a warning if already allocated.
        Returns:
        The JoystickAxis at index 4.
      • leftTriggerAxis

        public JoystickAxis leftTriggerAxis()
        Returns the JoystickAxis cooresponding to the left trigger. Throws a warning if already allocated.

        The triggers don't follow the conventions of the other axis regarding value for the mechanical default position.

        Returns:
        The JoystickAxis at index 2.
      • rightTriggerAxis

        public JoystickAxis rightTriggerAxis()
        Returns the JoystickAxis cooresponding to the right trigger. Throws a warning if already allocated.

        The triggers don't follow the conventions of the other axis regarding value for the mechanical default position.

        Returns:
        The JoystickAxis at index 3.
      • AButton

        public JoystickButton AButton()
        Returns the JoystickButton cooresponding to the A button. Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 1.
      • BButton

        public JoystickButton BButton()
        Returns the JoystickButton cooresponding to the B button. Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 2.
      • XButton

        public JoystickButton XButton()
        Returns the JoystickButton cooresponding to the X button. Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 3.
      • YButton

        public JoystickButton YButton()
        Returns the JoystickButton cooresponding to the Y button. Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 4.
      • leftBumperButton

        public JoystickButton leftBumperButton()
        Returns the JoystickButton cooresponding to the left bumper. Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 5.
      • rightBumperButton

        public JoystickButton rightBumperButton()
        Returns the JoystickButton cooresponding to the right bumper. Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 6.
      • leftStickButton

        public JoystickButton leftStickButton()
        Returns the JoystickButton cooresponding to the left stick button (pushing the stick into the controller, should make a small click). Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 9.
      • rightStickButton

        public JoystickButton rightStickButton()
        Returns the JoystickButton cooresponding to the right stick button (pushing the stick into the controller, should make a small click). Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 10.
      • backButton

        public JoystickButton backButton()
        Returns the JoystickButton cooresponding to the back button on the controller. Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 7.
      • startButton

        public JoystickButton startButton()
        Returns the JoystickButton cooresponding to the start button on the controller. Throws a warning if already allocated.
        Returns:
        The JoystickButton at index 8.