Class CommandSwitch2GCController
java.lang.Object
org.wpilib.command3.button.CommandSwitch2GCController
A version of
Switch2GCController with Trigger factories for command-based.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCommandSwitch2GCController(int port) Construct an instance of a controller.CommandSwitch2GCController(Scheduler scheduler, int port) Construct an instance of a controller.CommandSwitch2GCController(Scheduler scheduler, Switch2GCController controller) Construct an instance of a controller.CommandSwitch2GCController(Switch2GCController controller) Construct an instance of a controller. -
Method Summary
Modifier and TypeMethodDescriptiona()Constructs a Trigger instance around the A button's digital signal.Constructs a Trigger instance around the A button's digital signal.b()Constructs a Trigger instance around the B button's digital signal.Constructs a Trigger instance around the B button's digital signal.C()Constructs a Trigger instance around the C button's digital signal.Constructs a Trigger instance around the C button's digital signal.capture()Constructs a Trigger instance around the Capture button's digital signal.Constructs a Trigger instance around the Capture button's digital signal.dpadDown()Constructs a Trigger instance around the Dpad Down button's digital signal.Constructs a Trigger instance around the Dpad Down button's digital signal.dpadLeft()Constructs a Trigger instance around the Dpad Left button's digital signal.Constructs a Trigger instance around the Dpad Left button's digital signal.Constructs a Trigger instance around the Dpad Right button's digital signal.Constructs a Trigger instance around the Dpad Right button's digital signal.dpadUp()Constructs a Trigger instance around the Dpad Up button's digital signal.Constructs a Trigger instance around the Dpad Up button's digital signal.Get the wrapped controller object.doubleGet the C Stick X value of the controller.doubleGet the C Stick Y value of the controller.getHID()Get the underlying CommandGenericHID object.doublegetLeftX()Get the Left X value of the controller.doublegetLeftY()Get the Left Y value of the controller.doubleGet the L Trigger value of the controller.doubleGet the R Trigger value of the controller.home()Constructs a Trigger instance around the Home button's digital signal.Constructs a Trigger instance around the Home button's digital signal.L()Constructs a Trigger instance around the L button's digital signal.Constructs a Trigger instance around the L button's digital signal.LTrigger()Constructs a Trigger instance around the axis value of the L Trigger.LTrigger(double threshold) Constructs a Trigger instance around the axis value of the L Trigger.Constructs a Trigger instance around the axis value of the L Trigger.R()Constructs a Trigger instance around the R button's digital signal.Constructs a Trigger instance around the R button's digital signal.RTrigger()Constructs a Trigger instance around the axis value of the R Trigger.RTrigger(double threshold) Constructs a Trigger instance around the axis value of the R Trigger.Constructs a Trigger instance around the axis value of the R Trigger.start()Constructs a Trigger instance around the Start button's digital signal.Constructs a Trigger instance around the Start button's digital signal.x()Constructs a Trigger instance around the X button's digital signal.Constructs a Trigger instance around the X button's digital signal.y()Constructs a Trigger instance around the Y button's digital signal.Constructs a Trigger instance around the Y button's digital signal.Z()Constructs a Trigger instance around the Z button's digital signal.Constructs a Trigger instance around the Z button's digital signal.ZL()Constructs a Trigger instance around the ZL button's digital signal.Constructs a Trigger instance around the ZL button's digital signal.
-
Constructor Details
-
CommandSwitch2GCController
public CommandSwitch2GCController(int port) Construct an instance of a controller. Commands bound to buttons on the controller will be scheduled on thedefault schedulerusing its default event loop.- Parameters:
port- The port index on the Driver Station that the controller is plugged into.
-
CommandSwitch2GCController
Construct an instance of a controller. Commands bound to buttons on the controller will be scheduled on thedefault schedulerusing its default event loop.- Parameters:
controller- The Switch2GCController object to use for this controller.
-
CommandSwitch2GCController
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.port- The port index on the Driver Station that the controller is plugged into.
-
CommandSwitch2GCController
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.controller- The Switch2GCController object to use for this controller.
-
-
Method Details
-
getHID
Get the underlying CommandGenericHID object.- Returns:
- the wrapped CommandGenericHID object
-
getController
Get the wrapped controller object.- Returns:
- the wrapped controller object
-
a
Constructs a Trigger instance around the A button's digital signal.- Returns:
- a Trigger instance representing the A 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:
-
a
-
x
Constructs a Trigger instance around the X button's digital signal.- Returns:
- a Trigger instance representing the X 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:
-
x
-
b
Constructs a Trigger instance around the B button's digital signal.- Returns:
- a Trigger instance representing the B 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:
-
b
-
y
Constructs a Trigger instance around the Y button's digital signal.- Returns:
- a Trigger instance representing the Y 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:
-
y
-
home
Constructs a Trigger instance around the Home button's digital signal.- Returns:
- a Trigger instance representing the Home 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:
-
home
-
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
-
ZL
Constructs a Trigger instance around the ZL button's digital signal.- Returns:
- a Trigger instance representing the ZL 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:
-
ZL
-
Z
Constructs a Trigger instance around the Z button's digital signal.- Returns:
- a Trigger instance representing the Z 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:
-
Z
-
dpadUp
Constructs a Trigger instance around the Dpad Up button's digital signal.- Returns:
- a Trigger instance representing the Dpad 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 Dpad Down button's digital signal.- Returns:
- a Trigger instance representing the Dpad 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 Dpad Left button's digital signal.- Returns:
- a Trigger instance representing the Dpad 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 Dpad Right button's digital signal.- Returns:
- a Trigger instance representing the Dpad 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
-
capture
Constructs a Trigger instance around the Capture button's digital signal.- Returns:
- a Trigger instance representing the Capture 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:
-
capture
-
C
Constructs a Trigger instance around the C button's digital signal.- Returns:
- a Trigger instance representing the C 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:
-
C
-
L
Constructs a Trigger instance around the L button's digital signal.- Returns:
- a Trigger instance representing the L 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:
-
L
-
R
Constructs a Trigger instance around the R button's digital signal.- Returns:
- a Trigger instance representing the R 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:
-
R
-
LTrigger
Constructs a Trigger instance around the axis value of the L 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 L Trigger axis exceeds the provided threshold, attached to the given event loop
-
LTrigger
Constructs a Trigger instance around the axis value of the L 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 L Trigger axis exceeds the provided
threshold, attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided.
-
LTrigger
Constructs a Trigger instance around the axis value of the L 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 L Trigger 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.
-
RTrigger
Constructs a Trigger instance around the axis value of the R 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 R Trigger axis exceeds the provided threshold, attached to the given event loop
-
RTrigger
Constructs a Trigger instance around the axis value of the R 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 R Trigger axis exceeds the provided
threshold, attached to the
default scheduler event loopon the scheduler passed to the controller's constructor, or thedefault schedulerif a scheduler was not explicitly provided.
-
RTrigger
Constructs a Trigger instance around the axis value of the R 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 R Trigger 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 Left X value of the controller.- Returns:
- The axis value.
-
getLeftY
public double getLeftY()Get the Left Y value of the controller.- Returns:
- The axis value.
-
getCStickX
public double getCStickX()Get the C Stick X value of the controller.- Returns:
- The axis value.
-
getCStickY
public double getCStickY()Get the C Stick Y value of the controller.- Returns:
- The axis value.
-
getLTrigger
public double getLTrigger()Get the L Trigger value of the controller.- Returns:
- The axis value.
-
getRTrigger
public double getRTrigger()Get the R Trigger value of the controller.- Returns:
- The axis value.
-