Debouncer

class wpimath.filter.Debouncer(debounceTime: seconds, type: wpimath.filter._filter.Debouncer.DebounceType = <DebounceType.kRising: 0>)

Bases: pybind11_object

A simple debounce filter for boolean streams. Requires that the boolean change value from baseline for a specified period of time before the filtered value changes.

Creates a new Debouncer.

Parameters:
  • debounceTime – The number of seconds the value must change from baseline for the filtered value to change.

  • type – Which type of state change the debouncing will be performed on.

class DebounceType(value: int)

Bases: pybind11_object

Members:

kRising

kFalling

kBoth

kBoth = <DebounceType.kBoth: 2>
kFalling = <DebounceType.kFalling: 1>
kRising = <DebounceType.kRising: 0>
property name
property value
calculate(input: bool) bool

Applies the debouncer to the input stream.

Parameters:

input – The current value of the input stream.

Returns:

The debounced value of the input stream.