Class SimpleJoystickInput

  • All Implemented Interfaces:
    Supplier<TankDriveData>, Input<TankDriveData>

    public class SimpleJoystickInput
    extends Object
    implements Input<TankDriveData>
    Simple tank-style input from a WPILib Joystick. The left and right joysticks are used to control the left and right sides of the robot respectively. Additionally, there is an optional "forward axis" and "back axis"; if the forward axis is bound to one trigger on an Xbox controller and the back to the other, the forward trigger will cause the robot to drive straight forward and the back trigger will cause it to drive straight backwards. This Input creates a TankDriveData with only the feed-forward fields set on the left and right sides.
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleJoystickInput​(edu.wpi.first.wpilibj.Joystick joystick, int leftAxis, int rightAxis, boolean invertLeft, boolean invertRight)
      Creates a new SimpleJoystickInput with a deadzone of 0.1 and no forward/back axis control.
      SimpleJoystickInput​(edu.wpi.first.wpilibj.Joystick joystick, int leftAxis, int rightAxis, int fwdAxis, int backAxis, boolean invertLeft, boolean invertRight)
      Creates a new SimpleJoystickInput with a deadzone of 0.1.
      SimpleJoystickInput​(edu.wpi.first.wpilibj.Joystick joystick, int leftAxis, int rightAxis, int fwdAxis, int backAxis, boolean invertLeft, boolean invertRight, double deadzone)
      Creates a new SimpleJoystickInput.
    • Constructor Detail

      • SimpleJoystickInput

        public SimpleJoystickInput​(edu.wpi.first.wpilibj.Joystick joystick,
                                   int leftAxis,
                                   int rightAxis,
                                   boolean invertLeft,
                                   boolean invertRight)
        Creates a new SimpleJoystickInput with a deadzone of 0.1 and no forward/back axis control.
        Parameters:
        joystick - The Joystick to use.
        leftAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the left side.
        rightAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the right side.
        invertLeft - Whether to invert the axis value of the left axis.
        invertRight - Whether to invert the axis value of the right axis.
      • SimpleJoystickInput

        public SimpleJoystickInput​(edu.wpi.first.wpilibj.Joystick joystick,
                                   int leftAxis,
                                   int rightAxis,
                                   int fwdAxis,
                                   int backAxis,
                                   boolean invertLeft,
                                   boolean invertRight)
        Creates a new SimpleJoystickInput with a deadzone of 0.1.
        Parameters:
        joystick - The Joystick to use.
        leftAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the left side.
        rightAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the right side.
        fwdAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the forward axis, or -1 for none.
        backAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the back axis, or -1 for none.
        invertLeft - Whether to invert the axis value of the left axis.
        invertRight - Whether to invert the axis value of the right axis.
      • SimpleJoystickInput

        public SimpleJoystickInput​(edu.wpi.first.wpilibj.Joystick joystick,
                                   int leftAxis,
                                   int rightAxis,
                                   int fwdAxis,
                                   int backAxis,
                                   boolean invertLeft,
                                   boolean invertRight,
                                   double deadzone)
        Creates a new SimpleJoystickInput.
        Parameters:
        joystick - The Joystick to use.
        leftAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the left side.
        rightAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the right side.
        fwdAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the forward axis.
        backAxis - The axis number (as provided to GenericHID.getRawAxis(int) for the back axis.
        invertLeft - Whether to invert the axis value of the left axis.
        invertRight - Whether to invert the axis value of the right axis.
        deadzone - The deadzone for the axes (see ControlUtils.deadzone(double, double)).