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 TypeMethodDescriptionbooleanReturns true if a given axis is above the move threshold.edu.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 the deadzone applied.doubleReturns the raw value of the given axis (no deadzone calculation).Methods inherited from class edu.wpi.first.wpilibj2.command.button.CommandJoystick
getDirectionDegrees, getDirectionRadians, getHID, getMagnitude, getThrottle, getThrottleChannel, getTwist, getTwistChannel, getX, getXChannel, getY, 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 (no deadzone calculation). -
getAxis
Returns the value of the given axis, with the deadzone applied. -
active
Returns true if a given axis is above the move threshold.- Returns:
- whether the current value of that axis is outside the deadzone
-