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
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionTrigger(BooleanSupplier input) Create a newTriggerObject.Trigger(BooleanSupplier input, edu.wpi.first.math.filter.Debouncer debouncer) Create aTriggerObject with a debouncer on a raw input. -
Method Summary
Modifier and TypeMethodDescriptionvoiddisable()Disables thisTrigger.voidenable()Enables thisTrigger.booleanvoidinitSendable(edu.wpi.first.util.sendable.SendableBuilder builder) booleanbooleanjoin(TriggerGroup triggerGroup) leave(TriggerGroup triggerGroup) not()Create aTriggerrepresenting a logical NOT.trigger(Trigger.ActivationCondition activateFor, edu.wpi.first.wpilibj2.command.Command cmd) Execute the given command when/while thisTriggeris triggered.
-
Constructor Details
-
Method Details
-
getAsBoolean
public boolean getAsBoolean()- Specified by:
getAsBooleanin 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 thisTriggeris triggered.- Parameters:
cmd- The Command to trigger.- Returns:
- This
Triggerfor chaining methods.
-
enable
public void enable()Enables thisTrigger. -
disable
public void disable()Disables thisTrigger. -
isEnabled
public boolean isEnabled()- Returns:
- If this
Triggeris enabled.
-
isDisabled
public boolean isDisabled()- Returns:
- If this
Triggeris disabled.
-
and
-
nand
-
or
-
xor
-
nor
-
xnor
-
not
Create aTriggerrepresenting a logical NOT.NOT |A||B| |0||1| |1||0|
- Returns:
- A
Triggerrepresenting logical NOT.
-
initSendable
public void initSendable(edu.wpi.first.util.sendable.SendableBuilder builder) - Specified by:
initSendablein interfaceedu.wpi.first.util.sendable.Sendable
-