Class Trigger
java.lang.Object
io.github.tigerbotics7125.tigerlib.input.trigger.Trigger
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
,BooleanSupplier
- Direct Known Subclasses:
JoystickAxisTrigger
,JoystickPOVTrigger
,JoystickTrigger
public class Trigger
extends Object
implements BooleanSupplier, edu.wpi.first.util.sendable.Sendable
This class provides a way to track a boolean compared to time as a circuit would.
This class is meant to be a replacement for WPILib's version. Anything that uses a WPILib Trigger can easily be converted to work with this class.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionTrigger
(BooleanSupplier input) Create a newTrigger
Object.Trigger
(BooleanSupplier input, edu.wpi.first.math.filter.Debouncer debouncer) Create aTrigger
Object with a debouncer on a raw input. -
Method Summary
Modifier and TypeMethodDescriptionvoid
disable()
Disables thisTrigger
.void
enable()
Enables thisTrigger
.boolean
void
initSendable
(edu.wpi.first.util.sendable.SendableBuilder builder) boolean
boolean
join
(TriggerGroup triggerGroup) leave
(TriggerGroup triggerGroup) not()
Create aTrigger
representing a logical NOT.trigger
(Trigger.ActivationCondition activateFor, edu.wpi.first.wpilibj2.command.Command cmd) Execute the given command when/while thisTrigger
is triggered.
-
Constructor Details
-
Method Details
-
getAsBoolean
public boolean getAsBoolean()- Specified by:
getAsBoolean
in interfaceBooleanSupplier
- Returns:
- The input to this
Trigger
.
-
join
-
leave
-
trigger
public Trigger trigger(Trigger.ActivationCondition activateFor, edu.wpi.first.wpilibj2.command.Command cmd) Execute the given command when/while thisTrigger
is triggered.- Parameters:
cmd
- The Command to trigger.- Returns:
- This
Trigger
for chaining methods.
-
enable
public void enable()Enables thisTrigger
. -
disable
public void disable()Disables thisTrigger
. -
isEnabled
public boolean isEnabled()- Returns:
- If this
Trigger
is enabled.
-
isDisabled
public boolean isDisabled()- Returns:
- If this
Trigger
is disabled.
-
and
-
nand
-
or
-
xor
-
nor
-
xnor
-
not
Create aTrigger
representing a logical NOT.NOT |A||B| |0||1| |1||0|
- Returns:
- A
Trigger
representing logical NOT.
-
initSendable
public void initSendable(edu.wpi.first.util.sendable.SendableBuilder builder) - Specified by:
initSendable
in interfaceedu.wpi.first.util.sendable.Sendable
-