Package lib.custom.controllers
Class CustomCommandJoystick
java.lang.Object
edu.wpi.first.wpilibj2.command.button.CommandGenericHID
edu.wpi.first.wpilibj2.command.button.CommandJoystick
lib.custom.controllers.CustomCommandJoystick
public class CustomCommandJoystick
extends edu.wpi.first.wpilibj2.command.button.CommandJoystick
A joystick that implements the generic controller interface and the 2023
trigger interface. This allows us to use a joystick as a controller. This
contains 12 buttons to reflect the joysticks we are typically using.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerfinal edu.wpi.first.wpilibj2.command.button.Triggerprotected final doublefinal edu.wpi.first.wpilibj.event.EventLoopprotected final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.wpilibj2.command.button.Triggerbutton(int id) edu.wpi.first.wpilibj2.command.button.Triggerbutton(int button, edu.wpi.first.wpilibj.event.EventLoop loop) voidbooleanReturns true if the joystick is actually connected.doubleReturns the value of the given axis, with deadzone applied.doubleReturns the raw value of the given axis.doublegetRawX()Get the raw X axis value.doublegetRawY()Get the raw Y axis value.doublegetX()Get the X axis value with deadzone applied.doublegetY()Get the Y axis value with deadzone applied.booleanReturns true if a given axis is above the move threshold.Methods inherited from class edu.wpi.first.wpilibj2.command.button.CommandJoystick
getDirectionDegrees, getDirectionRadians, getHID, getMagnitude, getThrottle, getThrottleChannel, getTwist, getTwistChannel, getXChannel, getYChannel, getZ, getZChannel, setThrottleChannel, setTwistChannel, setXChannel, setYChannel, setZChannel, top, top, trigger, triggerMethods inherited from class edu.wpi.first.wpilibj2.command.button.CommandGenericHID
axisGreaterThan, axisGreaterThan, axisLessThan, axisLessThan, axisMagnitudeGreaterThan, axisMagnitudeGreaterThan, getRawAxis, isConnected, pov, pov, povCenter, povDown, povDownLeft, povDownRight, povLeft, povRight, povUp, povUpLeft, povUpRight, setRumble
-
Field Details
-
loop
public final edu.wpi.first.wpilibj.event.EventLoop loop -
deadzone
protected final double deadzone -
port
protected final int port -
button1
public final edu.wpi.first.wpilibj2.command.button.Trigger button1 -
button2
public final edu.wpi.first.wpilibj2.command.button.Trigger button2 -
button3
public final edu.wpi.first.wpilibj2.command.button.Trigger button3 -
button4
public final edu.wpi.first.wpilibj2.command.button.Trigger button4 -
button5
public final edu.wpi.first.wpilibj2.command.button.Trigger button5 -
button6
public final edu.wpi.first.wpilibj2.command.button.Trigger button6 -
button7
public final edu.wpi.first.wpilibj2.command.button.Trigger button7 -
button8
public final edu.wpi.first.wpilibj2.command.button.Trigger button8 -
button9
public final edu.wpi.first.wpilibj2.command.button.Trigger button9 -
button10
public final edu.wpi.first.wpilibj2.command.button.Trigger button10 -
button11
public final edu.wpi.first.wpilibj2.command.button.Trigger button11 -
button12
public final edu.wpi.first.wpilibj2.command.button.Trigger button12
-
-
Constructor Details
-
CustomCommandJoystick
public CustomCommandJoystick(int port, double deadzone)
-
-
Method Details
-
button
public edu.wpi.first.wpilibj2.command.button.Trigger button(int id) - Overrides:
buttonin classedu.wpi.first.wpilibj2.command.button.CommandGenericHID
-
button
public edu.wpi.first.wpilibj2.command.button.Trigger button(int button, edu.wpi.first.wpilibj.event.EventLoop loop) - Overrides:
buttonin classedu.wpi.first.wpilibj2.command.button.CommandGenericHID
-
clearBindings
public void clearBindings() -
connected
public boolean connected()Returns true if the joystick is actually connected. It determines this by counting the number of buttons (more than 0 means the joystick is connected). -
getRawAxis
Returns the raw value of the given axis. -
getAxis
Returns the value of the given axis, with deadzone applied. -
getX
public double getX()Get the X axis value with deadzone applied.- Overrides:
getXin classedu.wpi.first.wpilibj2.command.button.CommandJoystick
-
getY
public double getY()Get the Y axis value with deadzone applied.- Overrides:
getYin classedu.wpi.first.wpilibj2.command.button.CommandJoystick
-
getRawX
public double getRawX()Get the raw X axis value. -
getRawY
public double getRawY()Get the raw Y axis value. -
isActive
Returns true if a given axis is above the move threshold.- Returns:
- whether the current value of that axis is outside the deadzone
-