Class LogitechAttack3

    • Constructor Detail

      • LogitechAttack3

        public LogitechAttack3​(int port)
        Create a new Joystick.
        Parameters:
        port - the USB port for this Joystick.
      • LogitechAttack3

        public LogitechAttack3​(int port,
                               int period,
                               java.util.concurrent.TimeUnit timeUnit)
        Create a new Joystick, with a specific polling frequency (for button bindings). For example, to poll at 50Hz, you might use a period of 20 and a timeUnit of TimeUnit.MILLISECONDS.
        Parameters:
        port - the USB port for this Joystick.
        period - the timeout period between button mapping polls.
        timeUnit - the unit of the timeout period.
    • Method Detail

      • validate

        protected static void validate​(Gamepad.Mapping mapping,
                                       java.lang.String message)
      • validate

        protected static void validate​(Gamepad.Button button,
                                       java.lang.String message)
      • validate

        protected static void validate​(Gamepad.Binding binding,
                                       java.lang.String message)
      • getValue

        public double getValue​(Gamepad.Mapping mapping)
        Get the value of an axis on a control. Generally between -1.0 and 1.0. Controls and Axes should be provided by Gamepad implementations supplying their own valid possible values. Controls and Axes defined by one Gamepad implementation should not be used as parameters to other Gamepad implementations.
        Parameters:
        mapping - the mapping to check
        Returns:
        the value of the axis on the control
      • getButton

        public boolean getButton​(Gamepad.Button button)
        Get the value of a button on the controller. Buttons should be provided by Gamepad implementations supplying their own valid possible values. Buttons defined by one Gamepad implementation should not be used as parameters to other Gamepad implementations.
        Parameters:
        button - which button to check. The mapping from values here to actual buttons will depend on the specific Gamepad implementation
        Returns:
        whether the specified button is currently pressed or not
      • getDpad

        public int getDpad()
      • setMode

        public void setMode​(Gamepad.Mapping mapping,
                            java.util.function.Function<java.lang.Double,​java.lang.Double> function)
        Set a function to adjust input on one of the controls of this Gamepad. Controls should be provided by Gamepad implementations supplying their own valid possible values. Controls defined by one Gamepad implementation should not be used as parameters to other Gamepad implementations. Likewise for axes.
        Parameters:
        mapping - the mapping for which to set a mode
        function - the function to apply
      • setMode

        public void setMode​(java.util.function.Function<java.lang.Double,​java.lang.Double> function)
        Set a function to adjust input on one of the controls of this Gamepad. Controls should be provided by Gamepad implementations supplying their own valid possible values. Controls defined by one Gamepad implementation should not be used as parameters to other Gamepad implementations. Likewise for axes.
        Parameters:
        function - the function to apply to all controls and all axes of this Gamepad
      • map

        public void map​(Gamepad.Mapping mapping,
                        java.util.function.Consumer<java.lang.Double> consumer)
        Map a control/axis pair to a function.

        The given function will be periodically called and given the then-current value of the control/axis pair specified. This is similar to binding button presses to methods, on a continuous-valued input (eg thumbstick) instead, to a method which requires a double value, for example tank drive.

        Parameters:
        mapping - the control mapping to use
        consumer - the function to be called
      • bind

        public void bind​(Gamepad.Binding binding,
                         java.lang.Runnable action)
        Bind a button press on this gamepad to an action to be performed when the button is pressed, released, or periodically while the button is held. Buttons should be provided by Gamepad implementations supplying their own valid possible values. Buttons defined by one Gamepad implementation should not be used as parameters to other Gamepad implementations.
        Parameters:
        binding - the binding on which to bind an action
        action - the action to be bound
      • unbind

        public void unbind​(Gamepad.Binding binding)
        Remove a binding for the given binding.
        Parameters:
        binding - the binding for which to unbind an action