Class XboxController

    • Constructor Detail

      • XboxController

        public XboxController​(int port)
        Construct an instance of a joystick. The joystick index is the USB port on the drivers station.
        Parameters:
        port - The port on the Driver Station that the joystick is plugged into.
    • Method Detail

      • getButton

        public POVButton getButton​(CompassPOV direction)
        Get the virtual POVButton that corresponds to the physical button on the Xbox controller.
        Parameters:
        direction - The directional POVButton to get.
        Returns:
        A new POVButton object.
      • setDeadband

        public void setDeadband​(Deadband deadband,
                                XboxController.DeadbandAxis axis)
        Sets the deadband for this object.
        Parameters:
        deadband - The deadband to set
        axis - The axis to deadband
      • getDeadband

        public Deadband getDeadband​(XboxController.DeadbandAxis axis)
        Get the deadband for this object.
        Parameters:
        axis - The deadbanded axis.
        Returns:
        The deadband object for the deadbanded axis.
      • getTriggerAxis

        public double getTriggerAxis​(GenericHID.Hand hand,
                                     boolean deadbanded)
        Get the trigger axis value of the controller.
        Parameters:
        hand - Side of controller whose value should be returned.
        deadbanded - Whether or not to apply deadband to the returned value.
        Returns:
        The trigger axis value of the controller.
      • getTriggerAxis

        public double getTriggerAxis​(GenericHID.Hand hand)
        Get the trigger axis value of the controller, with deadband applied.
        Overrides:
        getTriggerAxis in class XboxController
        Parameters:
        hand - Side of controller whose value should be returned.
        Returns:
        The trigger axis value of the controller.
      • getX

        public double getX​(GenericHID.Hand hand,
                           boolean deadbanded)
        Get the X axis value of the controller.
        Parameters:
        hand - Side of controller whose value should be returned.
        deadbanded - Whether or not to apply deadband to the returned value.
        Returns:
        The X axis value of the controller.
      • getX

        public double getX​(GenericHID.Hand hand)
        Get the X axis value of the controller, with deadband applied.
        Overrides:
        getX in class XboxController
        Parameters:
        hand - Side of controller whose value should be returned.
        Returns:
        The X axis value of the controller.
      • getY

        public double getY​(GenericHID.Hand hand,
                           boolean deadbanded)
        Get the Y axis value of the controller.
        Parameters:
        hand - Side of controller whose value should be returned.
        deadbanded - Whether or not to apply deadband to the returned value.
        Returns:
        The Y axis value of the controller.
      • getY

        public double getY​(GenericHID.Hand hand)
        Get the Y axis value of the controller, with deadband applied.
        Overrides:
        getY in class XboxController
        Parameters:
        hand - Side of controller whose value should be returned.
        Returns:
        The Y axis value of the controller.