Class CommandGamepad
java.lang.Object
org.wpilib.command3.button.CommandGamepad
-
Constructor Summary
ConstructorsConstructorDescriptionCommandGamepad(int port) Construct an instance of a controller.CommandGamepad(Scheduler scheduler, int port) Construct an instance of a controller.CommandGamepad(Scheduler scheduler, Gamepad gamepad) Construct an instance of a controller.CommandGamepad(Gamepad gamepad) Construct an instance of a controller. -
Method Summary
Modifier and TypeMethodDescriptionback()Constructs a Trigger instance around the Back button's digital signal.Constructs a Trigger instance around the Back button's digital signal.button(int button) Constructs an event instance around this button's digital signal.Constructs an event instance around this button's digital signal.dpadDown()Constructs a Trigger instance around the D-pad down button's digital signal.Constructs a Trigger instance around the D-pad down button's digital signal.dpadLeft()Constructs a Trigger instance around the D-pad left button's digital signal.Constructs a Trigger instance around the D-pad left button's digital signal.Constructs a Trigger instance around the D-pad right button's digital signal.Constructs a Trigger instance around the D-pad right button's digital signal.dpadUp()Constructs a Trigger instance around the D-pad up button's digital signal.Constructs a Trigger instance around the D-pad up button's digital signal.faceDown()Constructs a Trigger instance around the Face Down button's digital signal.Constructs a Trigger instance around the Face Down button's digital signal.faceLeft()Constructs a Trigger instance around the Face Left button's digital signal.Constructs a Trigger instance around the Face Left button's digital signal.Constructs a Trigger instance around the Face Right button's digital signal.Constructs a Trigger instance around the Face Right button's digital signal.faceUp()Constructs a Trigger instance around the Face Up button's digital signal.Constructs a Trigger instance around the Face Up button's digital signal.Get the underlying Gamepad object.getHID()Get the underlying CommandGenericHID object.doubleGet the left trigger value of the controller.doublegetLeftX()Get the X axis value of left side of the controller.doublegetLeftY()Get the Y axis value of left side of the controller.doubleGet the right trigger value of the controller.doubleGet the X axis value of right side of the controller.doubleGet the Y axis value of right side of the controller.guide()Constructs a Trigger instance around the Guide button's digital signal.Constructs a Trigger instance around the Guide button's digital signal.Constructs a Trigger instance around the right bumper button's digital signal.leftBumper(EventLoop loop) Constructs a Trigger instance around the right bumper button's digital signal.Constructs a Trigger instance around the Left Paddle 1 button's digital signal.leftPaddle1(EventLoop loop) Constructs a Trigger instance around the Left Paddle 1 button's digital signal.Constructs a Trigger instance around the Left Paddle 2 button's digital signal.leftPaddle2(EventLoop loop) Constructs a Trigger instance around the Left Paddle 2 button's digital signal.Constructs a Trigger instance around the left stick button's digital signal.Constructs a Trigger instance around the left stick button's digital signal.Constructs a Trigger instance around the axis value of the left trigger.leftTrigger(double threshold) Constructs a Trigger instance around the axis value of the left trigger.leftTrigger(double threshold, EventLoop loop) Constructs a Trigger instance around the axis value of the left trigger.misc1()Constructs a Trigger instance around the Miscellaneous 1 button's digital signal.Constructs a Trigger instance around the Miscellaneous 1 button's digital signal.misc2()Constructs a Trigger instance around the Miscellaneous 2 button's digital signal.Constructs a Trigger instance around the Miscellaneous 2 button's digital signal.misc3()Constructs a Trigger instance around the Miscellaneous 3 button's digital signal.Constructs a Trigger instance around the Miscellaneous 3 button's digital signal.misc4()Constructs a Trigger instance around the Miscellaneous 4 button's digital signal.Constructs a Trigger instance around the Miscellaneous 4 button's digital signal.misc5()Constructs a Trigger instance around the Miscellaneous 5 button's digital signal.Constructs a Trigger instance around the Miscellaneous 5 button's digital signal.misc6()Constructs a Trigger instance around the Miscellaneous 6 button's digital signal.Constructs a Trigger instance around the Miscellaneous 6 button's digital signal.Constructs a Trigger instance around the right bumper button's digital signal.rightBumper(EventLoop loop) Constructs a Trigger instance around the right bumper button's digital signal.Constructs a Trigger instance around the Right Paddle 1 button's digital signal.rightPaddle1(EventLoop loop) Constructs a Trigger instance around the Right Paddle 1 button's digital signal.Constructs a Trigger instance around the Right Paddle 2 button's digital signal.rightPaddle2(EventLoop loop) Constructs a Trigger instance around the Right Paddle 2 button's digital signal.Constructs a Trigger instance around the right stick button's digital signal.rightStick(EventLoop loop) Constructs a Trigger instance around the right stick button's digital signal.Constructs a Trigger instance around the axis value of the right trigger.rightTrigger(double threshold) Constructs a Trigger instance around the axis value of the right trigger.rightTrigger(double threshold, EventLoop loop) Constructs a Trigger instance around the axis value of the right trigger.start()Constructs a Trigger instance around the Start button's digital signal.Constructs a Trigger instance around the Start button's digital signal.touchpad()Constructs a Trigger instance around the Touchpad button's digital signal.Constructs a Trigger instance around the Touchpad button's digital signal.
-
Constructor Details
-
CommandGamepad
public CommandGamepad(int port) Construct an instance of a controller.- Parameters:
port- The port index on the Driver Station that the controller is plugged into.
-
CommandGamepad
Construct an instance of a controller. Commands bound to buttons on the controller will be scheduled on thedefault schedulerusing its default event loop.- Parameters:
gamepad- The Gamepad object to use for this controller.
-
CommandGamepad
Construct an instance of a controller.- Parameters:
scheduler- The scheduler that should execute the triggered commands.port- The port index on the Driver Station that the controller is plugged into.
-
CommandGamepad
Construct an instance of a controller. Commands bound to buttons on the controller will be scheduled on the given scheduler using its default event loop.- Parameters:
scheduler- The scheduler that should execute the triggered commands.gamepad- The Gamepad object to use for this controller.
-
-
Method Details
-
getHID
Get the underlying CommandGenericHID object.- Returns:
- the wrapped CommandGenericHID object
-
getGamepad
-
button
Constructs an event instance around this button's digital signal.- Parameters:
button- the button index- Returns:
- an event instance representing the button's digital signal attached to the
default scheduler button loop. - See Also:
-
button
Constructs an event instance around this button's digital signal.- Parameters:
button- the button indexloop- the event loop instance to attach the event to.- Returns:
- an event instance representing the button's digital signal attached to the given loop.
-
faceDown
Constructs a Trigger instance around the Face Down button's digital signal.- Returns:
- a Trigger instance representing the Face Down button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
faceDown
-
faceRight
Constructs a Trigger instance around the Face Right button's digital signal.- Returns:
- a Trigger instance representing the Face Right button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
faceRight
-
faceLeft
Constructs a Trigger instance around the Face Left button's digital signal.- Returns:
- a Trigger instance representing the Face Left button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
faceLeft
-
faceUp
Constructs a Trigger instance around the Face Up button's digital signal.- Returns:
- a Trigger instance representing the Face Up button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
faceUp
-
back
Constructs a Trigger instance around the Back button's digital signal.- Returns:
- a Trigger instance representing the Back button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
back
-
guide
Constructs a Trigger instance around the Guide button's digital signal.- Returns:
- a Trigger instance representing the Guide button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
guide
-
start
Constructs a Trigger instance around the Start button's digital signal.- Returns:
- a Trigger instance representing the Start button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
start
-
leftStick
Constructs a Trigger instance around the left stick button's digital signal.- Returns:
- a Trigger instance representing the left stick button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
leftStick
-
rightStick
Constructs a Trigger instance around the right stick button's digital signal.- Returns:
- a Trigger instance representing the right stick button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
rightStick
-
leftBumper
Constructs a Trigger instance around the right bumper button's digital signal.- Returns:
- a Trigger instance representing the right bumper button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
leftBumper
-
rightBumper
Constructs a Trigger instance around the right bumper button's digital signal.- Returns:
- a Trigger instance representing the right bumper button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
rightBumper
-
dpadUp
Constructs a Trigger instance around the D-pad up button's digital signal.- Returns:
- a Trigger instance representing the D-pad up button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
dpadUp
-
dpadDown
Constructs a Trigger instance around the D-pad down button's digital signal.- Returns:
- a Trigger instance representing the D-pad down button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
dpadDown
-
dpadLeft
Constructs a Trigger instance around the D-pad left button's digital signal.- Returns:
- a Trigger instance representing the D-pad left button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
dpadLeft
-
dpadRight
Constructs a Trigger instance around the D-pad right button's digital signal.- Returns:
- a Trigger instance representing the D-pad right button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
dpadRight
-
misc1
Constructs a Trigger instance around the Miscellaneous 1 button's digital signal.- Returns:
- a Trigger instance representing the Miscellaneous 1 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
misc1
-
rightPaddle1
Constructs a Trigger instance around the Right Paddle 1 button's digital signal.- Returns:
- a Trigger instance representing the Right Paddle 1 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
rightPaddle1
Constructs a Trigger instance around the Right Paddle 1 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- a Trigger instance representing the Right Paddle 1 button's digital signal attached to the given loop.
-
leftPaddle1
Constructs a Trigger instance around the Left Paddle 1 button's digital signal.- Returns:
- a Trigger instance representing the Left Paddle 1 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
leftPaddle1
Constructs a Trigger instance around the Left Paddle 1 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- a Trigger instance representing the Left Paddle 1 button's digital signal attached to the given loop.
-
rightPaddle2
Constructs a Trigger instance around the Right Paddle 2 button's digital signal.- Returns:
- a Trigger instance representing the Right Paddle 2 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
rightPaddle2
Constructs a Trigger instance around the Right Paddle 2 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- a Trigger instance representing the Right Paddle 2 button's digital signal attached to the given loop.
-
leftPaddle2
Constructs a Trigger instance around the Left Paddle 2 button's digital signal.- Returns:
- a Trigger instance representing the Left Paddle 2 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
leftPaddle2
Constructs a Trigger instance around the Left Paddle 2 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- a Trigger instance representing the Left Paddle 2 button's digital signal attached to the given loop.
-
touchpad
Constructs a Trigger instance around the Touchpad button's digital signal.- Returns:
- a Trigger instance representing the Touchpad button's digital signal attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
touchpad
-
misc2
Constructs a Trigger instance around the Miscellaneous 2 button's digital signal.- Returns:
- a Trigger instance representing the Miscellaneous 2 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
misc2
-
misc3
Constructs a Trigger instance around the Miscellaneous 3 button's digital signal.- Returns:
- a Trigger instance representing the Miscellaneous 3 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
misc3
-
misc4
Constructs a Trigger instance around the Miscellaneous 4 button's digital signal.- Returns:
- a Trigger instance representing the Miscellaneous 4 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
misc4
-
misc5
Constructs a Trigger instance around the Miscellaneous 5 button's digital signal.- Returns:
- a Trigger instance representing the Miscellaneous 5 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
misc5
-
misc6
Constructs a Trigger instance around the Miscellaneous 6 button's digital signal.- Returns:
- a Trigger instance representing the Miscellaneous 6 button's digital signal attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided. - See Also:
-
misc6
-
leftTrigger
Constructs a Trigger instance around the axis value of the left trigger. The returned trigger will be true when the axis value is greater thanthreshold.- Parameters:
threshold- the minimum axis value for the returnedTriggerto be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis.loop- the event loop instance to attach the Trigger to.- Returns:
- a Trigger instance that is true when the left trigger's axis exceeds the provided threshold, attached to the given event loop
-
leftTrigger
Constructs a Trigger instance around the axis value of the left trigger. The returned trigger will be true when the axis value is greater thanthreshold.- Parameters:
threshold- the minimum axis value for the returnedTriggerto be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis.- Returns:
- a Trigger instance that is true when the left trigger's axis exceeds the provided
threshold, attached to the
default scheduler button loop.
-
leftTrigger
Constructs a Trigger instance around the axis value of the left trigger. The returned trigger will be true when the axis value is greater than 0.5.- Returns:
- a Trigger instance that is true when the left trigger's axis exceeds 0.5, attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided.
-
rightTrigger
Constructs a Trigger instance around the axis value of the right trigger. The returned trigger will be true when the axis value is greater thanthreshold.- Parameters:
threshold- the minimum axis value for the returnedTriggerto be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis.loop- the event loop instance to attach the Trigger to.- Returns:
- a Trigger instance that is true when the right trigger's axis exceeds the provided threshold, attached to the given event loop
-
rightTrigger
Constructs a Trigger instance around the axis value of the right trigger. The returned trigger will be true when the axis value is greater thanthreshold.- Parameters:
threshold- the minimum axis value for the returnedTriggerto be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis.- Returns:
- a Trigger instance that is true when the right trigger's axis exceeds the provided
threshold, attached to the
default scheduler button loop.
-
rightTrigger
Constructs a Trigger instance around the axis value of the right trigger. The returned trigger will be true when the axis value is greater than 0.5.- Returns:
- a Trigger instance that is true when the right trigger's axis exceeds 0.5, attached to
the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided.
-
getLeftX
public double getLeftX()Get the X axis value of left side of the controller. Right is positive.- Returns:
- The axis value.
-
getLeftY
public double getLeftY()Get the Y axis value of left side of the controller. Back is positive.- Returns:
- The axis value.
-
getRightX
public double getRightX()Get the X axis value of right side of the controller. Right is positive.- Returns:
- The axis value.
-
getRightY
public double getRightY()Get the Y axis value of right side of the controller. Back is positive.- Returns:
- The axis value.
-
getLeftTrigger
public double getLeftTrigger()Get the left trigger value of the controller. Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].- Returns:
- The axis value.
-
getRightTrigger
public double getRightTrigger()Get the right trigger value of the controller. Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].- Returns:
- The axis value.
-