BooleanEvent
- class wpilib.event.BooleanEvent
Bases:
pybind11_object
This class provides an easy way to link actions to inputs. Each object represents a boolean condition to which callback actions can be bound using
IfHigh()
.These events can easily be composed using factories such as {@link #operator!}, {@link #operator||}, {@link #operator&&} etc.
To get an event that activates only when this one changes, see {@link #Falling()} and
Rising()
.- castTo(ctor: Callable) object
A method to “downcast” a BooleanEvent instance to a subclass (for example, to a command-based version of this class).
- Parameters:
ctor – a method reference to the constructor of the subclass that accepts the loop as the first parameter and the condition/signal as the second.
- Returns:
an instance of the subclass.
- debounce(debounceTime: wpimath.units.seconds, type: wpimath.filter._filter.Debouncer.DebounceType = <DebounceType.kRising: 0>) wpilib.event._event.BooleanEvent
Creates a new debounced event from this event - it will become active when this event has been active for longer than the specified period.
- Parameters:
debounceTime – The debounce period.
type – The debounce type.
- Returns:
The debounced event.
- falling() wpilib.event._event.BooleanEvent
Get a new event that triggers only when this one newly changes to false.
- Returns:
a new event representing when this one newly changes to false.
- getAsBoolean() bool
Check whether this event is active or not as of the last loop poll.
- Returns:
true if active, false if not active. If the event was never polled, it returns the state at event construction.
- ifHigh(action: Callable[[], None]) None
Bind an action to this event.
- Parameters:
action – the action to run if this event is active.
- rising() wpilib.event._event.BooleanEvent
Get a new event that events only when this one newly changes to true.
- Returns:
a new event representing when this one newly changes to true.