Class SimpleJoystickInput
- java.lang.Object
-
- org.team1540.rooster.drive.pipeline.SimpleJoystickInput
-
- All Implemented Interfaces:
Supplier<TankDriveData>
,Input<TankDriveData>
public class SimpleJoystickInput extends Object implements Input<TankDriveData>
Simple tank-style input from a WPILibJoystick
. 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. ThisInput
creates aTankDriveData
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 newSimpleJoystickInput
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 newSimpleJoystickInput
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 newSimpleJoystickInput
.
-
-
-
Constructor Detail
-
SimpleJoystickInput
public SimpleJoystickInput(edu.wpi.first.wpilibj.Joystick joystick, int leftAxis, int rightAxis, boolean invertLeft, boolean invertRight)
Creates a newSimpleJoystickInput
with a deadzone of 0.1 and no forward/back axis control.- Parameters:
joystick
- TheJoystick
to use.leftAxis
- The axis number (as provided toGenericHID.getRawAxis(int)
for the left side.rightAxis
- The axis number (as provided toGenericHID.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 newSimpleJoystickInput
with a deadzone of 0.1.- Parameters:
joystick
- TheJoystick
to use.leftAxis
- The axis number (as provided toGenericHID.getRawAxis(int)
for the left side.rightAxis
- The axis number (as provided toGenericHID.getRawAxis(int)
for the right side.fwdAxis
- The axis number (as provided toGenericHID.getRawAxis(int)
for the forward axis, or -1 for none.backAxis
- The axis number (as provided toGenericHID.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 newSimpleJoystickInput
.- Parameters:
joystick
- TheJoystick
to use.leftAxis
- The axis number (as provided toGenericHID.getRawAxis(int)
for the left side.rightAxis
- The axis number (as provided toGenericHID.getRawAxis(int)
for the right side.fwdAxis
- The axis number (as provided toGenericHID.getRawAxis(int)
for the forward axis.backAxis
- The axis number (as provided toGenericHID.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 (seeControlUtils.deadzone(double, double)
).
-
-
Method Detail
-
get
public TankDriveData get()
- Specified by:
get
in interfaceSupplier<TankDriveData>
-
-