2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-01-01 20:09:17 -08:00
|
|
|
#include <functional>
|
|
|
|
|
#include <initializer_list>
|
2019-08-25 23:55:59 -04:00
|
|
|
#include <memory>
|
|
|
|
|
#include <utility>
|
|
|
|
|
|
2022-06-09 08:16:51 +03:00
|
|
|
#include <frc/event/BooleanEvent.h>
|
|
|
|
|
#include <frc/event/EventLoop.h>
|
2021-12-29 19:10:43 -05:00
|
|
|
#include <frc/filter/Debouncer.h>
|
2021-09-19 19:58:16 -07:00
|
|
|
#include <units/time.h>
|
2021-06-06 19:51:14 -07:00
|
|
|
#include <wpi/span.h>
|
2020-01-01 20:09:17 -08:00
|
|
|
|
2019-11-20 22:44:18 -08:00
|
|
|
#include "frc2/command/Command.h"
|
|
|
|
|
#include "frc2/command/CommandScheduler.h"
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
namespace frc2 {
|
|
|
|
|
class Command;
|
|
|
|
|
/**
|
2022-06-09 08:16:51 +03:00
|
|
|
* This class is a command-based wrapper around {@link BooleanEvent}, providing
|
|
|
|
|
* an easy way to link commands to inputs.
|
2019-08-25 23:55:59 -04:00
|
|
|
*
|
2022-01-08 11:11:34 -08:00
|
|
|
* This class is provided by the NewCommands VendorDep
|
|
|
|
|
*
|
2019-08-25 23:55:59 -04:00
|
|
|
* @see Button
|
|
|
|
|
*/
|
2022-06-09 08:16:51 +03:00
|
|
|
class Trigger : public frc::BooleanEvent {
|
2019-08-25 23:55:59 -04:00
|
|
|
public:
|
2022-06-09 08:16:51 +03:00
|
|
|
/**
|
|
|
|
|
* Creates a new trigger with the given condition determining whether it is
|
|
|
|
|
* active.
|
|
|
|
|
*
|
|
|
|
|
* <p>Polled by the default scheduler button loop.
|
|
|
|
|
*
|
|
|
|
|
* @param isActive returns whether or not the trigger should be active
|
|
|
|
|
*/
|
|
|
|
|
explicit Trigger(std::function<bool()> isActive)
|
|
|
|
|
: BooleanEvent{CommandScheduler::GetInstance().GetDefaultButtonLoop(),
|
|
|
|
|
std::move(isActive)} {}
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
/**
|
|
|
|
|
* Create a new trigger that is active when the given condition is true.
|
|
|
|
|
*
|
2022-06-09 08:16:51 +03:00
|
|
|
* @param loop The loop instance that polls this trigger.
|
2019-08-25 23:55:59 -04:00
|
|
|
* @param isActive Whether the trigger is active.
|
|
|
|
|
*/
|
2022-06-09 08:16:51 +03:00
|
|
|
Trigger(frc::EventLoop* loop, std::function<bool()> isActive)
|
|
|
|
|
: BooleanEvent{loop, std::move(isActive)} {}
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new trigger that is never active (default constructor) - activity
|
|
|
|
|
* can be further determined by subclass code.
|
|
|
|
|
*/
|
2022-06-09 08:16:51 +03:00
|
|
|
Trigger() : Trigger([] { return false; }) {}
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
Trigger(const Trigger& other);
|
|
|
|
|
|
|
|
|
|
/**
|
2022-08-30 07:53:47 +03:00
|
|
|
* Binds a command to start when the trigger becomes active. Takes a
|
2019-08-25 23:55:59 -04:00
|
|
|
* raw pointer, and so is non-owning; users are responsible for the lifespan
|
|
|
|
|
* of the command.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger WhenActive(Command* command);
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2022-10-06 01:19:28 +03:00
|
|
|
/**
|
|
|
|
|
* Binds a command to start when the trigger becomes active. Moves
|
|
|
|
|
* command ownership to the button scheduler.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
|
|
|
|
Trigger WhenActive(CommandPtr&& command);
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
/**
|
2022-08-30 07:53:47 +03:00
|
|
|
* Binds a command to start when the trigger becomes active. Transfers
|
2019-08-25 23:55:59 -04:00
|
|
|
* command ownership to the button scheduler, so the user does not have to
|
|
|
|
|
* worry about lifespan - rvalue refs will be *moved*, lvalue refs will be
|
|
|
|
|
* *copied.*
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2019-09-13 20:14:37 -07:00
|
|
|
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
|
|
|
|
Command, std::remove_reference_t<T>>>>
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger WhenActive(T&& command) {
|
2022-06-09 08:16:51 +03:00
|
|
|
this->Rising().IfHigh(
|
|
|
|
|
[command = std::make_unique<std::remove_reference_t<T>>(
|
2022-08-30 07:53:47 +03:00
|
|
|
std::forward<T>(command))] { command->Schedule(); });
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Binds a runnable to execute when the trigger becomes active.
|
|
|
|
|
*
|
|
|
|
|
* @param toRun the runnable to execute.
|
2021-10-14 18:09:38 -07:00
|
|
|
* @param requirements the required subsystems.
|
2019-08-25 23:55:59 -04:00
|
|
|
*/
|
2019-11-08 21:30:30 -05:00
|
|
|
Trigger WhenActive(std::function<void()> toRun,
|
2020-01-01 20:09:17 -08:00
|
|
|
std::initializer_list<Subsystem*> requirements);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Binds a runnable to execute when the trigger becomes active.
|
|
|
|
|
*
|
|
|
|
|
* @param toRun the runnable to execute.
|
2021-10-14 18:09:38 -07:00
|
|
|
* @param requirements the required subsystems.
|
2020-01-01 20:09:17 -08:00
|
|
|
*/
|
|
|
|
|
Trigger WhenActive(std::function<void()> toRun,
|
2021-06-06 19:51:14 -07:00
|
|
|
wpi::span<Subsystem* const> requirements = {});
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Binds a command to be started repeatedly while the trigger is active, and
|
2020-09-02 19:41:05 -07:00
|
|
|
* canceled when it becomes inactive. Takes a raw pointer, and so is
|
2019-08-25 23:55:59 -04:00
|
|
|
* non-owning; users are responsible for the lifespan of the command.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger WhileActiveContinous(Command* command);
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2022-10-06 01:19:28 +03:00
|
|
|
/**
|
|
|
|
|
* Binds a command to be started repeatedly while the trigger is active, and
|
|
|
|
|
* canceled when it becomes inactive. Moves command ownership to the button
|
|
|
|
|
* scheduler.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
|
|
|
|
Trigger WhileActiveContinous(CommandPtr&& command);
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
/**
|
|
|
|
|
* Binds a command to be started repeatedly while the trigger is active, and
|
2020-09-02 19:41:05 -07:00
|
|
|
* canceled when it becomes inactive. Transfers command ownership to the
|
2019-08-25 23:55:59 -04:00
|
|
|
* button scheduler, so the user does not have to worry about lifespan -
|
|
|
|
|
* rvalue refs will be *moved*, lvalue refs will be *copied.*
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2019-09-13 20:14:37 -07:00
|
|
|
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
|
|
|
|
Command, std::remove_reference_t<T>>>>
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger WhileActiveContinous(T&& command) {
|
2022-06-09 08:16:51 +03:00
|
|
|
std::shared_ptr<T> ptr =
|
|
|
|
|
std::make_shared<std::remove_reference_t<T>>(std::forward<T>(command));
|
2022-08-30 07:53:47 +03:00
|
|
|
this->IfHigh([ptr] { ptr->Schedule(); });
|
2022-06-09 08:16:51 +03:00
|
|
|
this->Falling().IfHigh([ptr] { ptr->Cancel(); });
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Binds a runnable to execute repeatedly while the trigger is active.
|
|
|
|
|
*
|
|
|
|
|
* @param toRun the runnable to execute.
|
2019-11-08 21:30:30 -05:00
|
|
|
* @param requirements the required subsystems.
|
2019-08-25 23:55:59 -04:00
|
|
|
*/
|
2020-01-01 20:09:17 -08:00
|
|
|
Trigger WhileActiveContinous(std::function<void()> toRun,
|
|
|
|
|
std::initializer_list<Subsystem*> requirements);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Binds a runnable to execute repeatedly while the trigger is active.
|
|
|
|
|
*
|
|
|
|
|
* @param toRun the runnable to execute.
|
|
|
|
|
* @param requirements the required subsystems.
|
|
|
|
|
*/
|
|
|
|
|
Trigger WhileActiveContinous(std::function<void()> toRun,
|
2021-06-06 19:51:14 -07:00
|
|
|
wpi::span<Subsystem* const> requirements = {});
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Binds a command to be started when the trigger becomes active, and
|
2020-09-02 19:41:05 -07:00
|
|
|
* canceled when it becomes inactive. Takes a raw pointer, and so is
|
2019-08-25 23:55:59 -04:00
|
|
|
* non-owning; users are responsible for the lifespan of the command.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger WhileActiveOnce(Command* command);
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2022-10-06 01:19:28 +03:00
|
|
|
/**
|
|
|
|
|
* Binds a command to be started when the trigger becomes active, and
|
|
|
|
|
* canceled when it becomes inactive. Moves command ownership to the button
|
|
|
|
|
* scheduler.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
|
|
|
|
Trigger WhileActiveOnce(CommandPtr&& command);
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
/**
|
|
|
|
|
* Binds a command to be started when the trigger becomes active, and
|
2022-08-30 07:53:47 +03:00
|
|
|
* canceled when it becomes inactive. Transfers command ownership to the
|
2019-08-25 23:55:59 -04:00
|
|
|
* button scheduler, so the user does not have to worry about lifespan -
|
|
|
|
|
* rvalue refs will be *moved*, lvalue refs will be *copied.*
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2019-09-13 20:14:37 -07:00
|
|
|
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
|
|
|
|
Command, std::remove_reference_t<T>>>>
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger WhileActiveOnce(T&& command) {
|
2022-06-09 08:16:51 +03:00
|
|
|
std::shared_ptr<T> ptr =
|
|
|
|
|
std::make_shared<std::remove_reference_t<T>>(std::forward<T>(command));
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2022-08-30 07:53:47 +03:00
|
|
|
this->Rising().IfHigh([ptr] { ptr->Schedule(); });
|
2022-06-09 08:16:51 +03:00
|
|
|
this->Falling().IfHigh([ptr] { ptr->Cancel(); });
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Binds a command to start when the trigger becomes inactive. Takes a
|
|
|
|
|
* raw pointer, and so is non-owning; users are responsible for the lifespan
|
|
|
|
|
* of the command.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger WhenInactive(Command* command);
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2022-10-06 01:19:28 +03:00
|
|
|
/**
|
|
|
|
|
* Binds a command to start when the trigger becomes inactive. Moves
|
|
|
|
|
* command ownership to the button scheduler.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
|
|
|
|
Trigger WhenInactive(CommandPtr&& command);
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
/**
|
|
|
|
|
* Binds a command to start when the trigger becomes inactive. Transfers
|
|
|
|
|
* command ownership to the button scheduler, so the user does not have to
|
|
|
|
|
* worry about lifespan - rvalue refs will be *moved*, lvalue refs will be
|
|
|
|
|
* *copied.*
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2019-09-13 20:14:37 -07:00
|
|
|
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
|
|
|
|
Command, std::remove_reference_t<T>>>>
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger WhenInactive(T&& command) {
|
2022-06-09 08:16:51 +03:00
|
|
|
this->Falling().IfHigh(
|
|
|
|
|
[command = std::make_unique<std::remove_reference_t<T>>(
|
2022-08-30 07:53:47 +03:00
|
|
|
std::forward<T>(command))] { command->Schedule(); });
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Binds a runnable to execute when the trigger becomes inactive.
|
|
|
|
|
*
|
|
|
|
|
* @param toRun the runnable to execute.
|
2019-11-08 21:30:30 -05:00
|
|
|
* @param requirements the required subsystems.
|
2019-08-25 23:55:59 -04:00
|
|
|
*/
|
2019-11-08 21:30:30 -05:00
|
|
|
Trigger WhenInactive(std::function<void()> toRun,
|
2020-01-01 20:09:17 -08:00
|
|
|
std::initializer_list<Subsystem*> requirements);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Binds a runnable to execute when the trigger becomes inactive.
|
|
|
|
|
*
|
|
|
|
|
* @param toRun the runnable to execute.
|
|
|
|
|
* @param requirements the required subsystems.
|
|
|
|
|
*/
|
|
|
|
|
Trigger WhenInactive(std::function<void()> toRun,
|
2021-06-06 19:51:14 -07:00
|
|
|
wpi::span<Subsystem* const> requirements = {});
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
/**
|
2020-09-02 19:41:05 -07:00
|
|
|
* Binds a command to start when the trigger becomes active, and be canceled
|
2022-08-30 07:53:47 +03:00
|
|
|
* when it again becomes active. Takes a raw pointer, and so is non-owning;
|
2019-08-25 23:55:59 -04:00
|
|
|
* users are responsible for the lifespan of the command.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger ToggleWhenActive(Command* command);
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2022-10-06 01:19:28 +03:00
|
|
|
/**
|
|
|
|
|
* Binds a command to start when the trigger becomes active, and be canceled
|
|
|
|
|
* when it again becomes active. Moves command ownership to the button
|
|
|
|
|
* scheduler.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
|
|
|
|
Trigger ToggleWhenActive(CommandPtr&& command);
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
/**
|
2020-09-02 19:41:05 -07:00
|
|
|
* Binds a command to start when the trigger becomes active, and be canceled
|
2019-08-25 23:55:59 -04:00
|
|
|
* when it again becomes active. Transfers command ownership to the button
|
|
|
|
|
* scheduler, so the user does not have to worry about lifespan - rvalue refs
|
|
|
|
|
* will be *moved*, lvalue refs will be *copied.*
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
2019-09-13 20:14:37 -07:00
|
|
|
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
|
|
|
|
Command, std::remove_reference_t<T>>>>
|
2022-08-30 07:53:47 +03:00
|
|
|
Trigger ToggleWhenActive(T&& command) {
|
2022-06-09 08:16:51 +03:00
|
|
|
this->Rising().IfHigh(
|
|
|
|
|
[command = std::make_unique<std::remove_reference_t<T>>(
|
2022-08-30 07:53:47 +03:00
|
|
|
std::forward<T>(command))] {
|
2022-06-09 08:16:51 +03:00
|
|
|
if (!command->IsScheduled()) {
|
2022-08-30 07:53:47 +03:00
|
|
|
command->Schedule();
|
2022-06-09 08:16:51 +03:00
|
|
|
} else {
|
|
|
|
|
command->Cancel();
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
});
|
2022-06-09 08:16:51 +03:00
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-02 19:41:05 -07:00
|
|
|
* Binds a command to be canceled when the trigger becomes active. Takes a
|
2019-08-25 23:55:59 -04:00
|
|
|
* raw pointer, and so is non-owning; users are responsible for the lifespan
|
|
|
|
|
* and scheduling of the command.
|
|
|
|
|
*
|
|
|
|
|
* @param command The command to bind.
|
|
|
|
|
* @return The trigger, for chained calls.
|
|
|
|
|
*/
|
|
|
|
|
Trigger CancelWhenActive(Command* command);
|
|
|
|
|
|
2022-06-09 08:16:51 +03:00
|
|
|
/**
|
|
|
|
|
* Get a new event that events only when this one newly changes to true.
|
|
|
|
|
*
|
|
|
|
|
* @return a new event representing when this one newly changes to true.
|
|
|
|
|
*/
|
|
|
|
|
Trigger Rising() { return BooleanEvent::Rising().CastTo<Trigger>(); }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a new event that triggers only when this one newly changes to false.
|
|
|
|
|
*
|
|
|
|
|
* @return a new event representing when this one newly changes to false.
|
|
|
|
|
*/
|
|
|
|
|
Trigger Falling() { return BooleanEvent::Falling().CastTo<Trigger>(); }
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
/**
|
|
|
|
|
* Composes two triggers with logical AND.
|
|
|
|
|
*
|
|
|
|
|
* @return A trigger which is active when both component triggers are active.
|
|
|
|
|
*/
|
2022-06-09 08:16:51 +03:00
|
|
|
Trigger operator&&(std::function<bool()> rhs) {
|
|
|
|
|
return BooleanEvent::operator&&(rhs).CastTo<Trigger>();
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Composes two triggers with logical OR.
|
|
|
|
|
*
|
|
|
|
|
* @return A trigger which is active when either component trigger is active.
|
|
|
|
|
*/
|
2022-06-09 08:16:51 +03:00
|
|
|
Trigger operator||(std::function<bool()> rhs) {
|
|
|
|
|
return BooleanEvent::operator||(rhs).CastTo<Trigger>();
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Composes a trigger with logical NOT.
|
|
|
|
|
*
|
|
|
|
|
* @return A trigger which is active when the component trigger is inactive,
|
|
|
|
|
* and vice-versa.
|
|
|
|
|
*/
|
2022-06-09 08:16:51 +03:00
|
|
|
Trigger operator!() { return BooleanEvent::operator!().CastTo<Trigger>(); }
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2021-09-19 19:58:16 -07:00
|
|
|
/**
|
|
|
|
|
* Creates a new debounced trigger from this trigger - it will become active
|
|
|
|
|
* when this trigger has been active for longer than the specified period.
|
|
|
|
|
*
|
2021-12-29 19:10:43 -05:00
|
|
|
* @param debounceTime The debounce period.
|
|
|
|
|
* @param type The debounce type.
|
|
|
|
|
* @return The debounced trigger.
|
2021-09-19 19:58:16 -07:00
|
|
|
*/
|
2021-12-29 19:10:43 -05:00
|
|
|
Trigger Debounce(units::second_t debounceTime,
|
|
|
|
|
frc::Debouncer::DebounceType type =
|
2022-06-09 08:16:51 +03:00
|
|
|
frc::Debouncer::DebounceType::kRising) {
|
|
|
|
|
return BooleanEvent::Debounce(debounceTime, type).CastTo<Trigger>();
|
|
|
|
|
}
|
2019-08-25 23:55:59 -04:00
|
|
|
};
|
|
|
|
|
} // namespace frc2
|