WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::cmd::NotifierCommand Class Reference

A command that starts a notifier to run the given runnable periodically in a separate thread. More...

#include <wpi/commands2/NotifierCommand.hpp>

Inheritance diagram for wpi::cmd::NotifierCommand:
wpi::cmd::CommandHelper< Command, NotifierCommand >

Public Member Functions

 NotifierCommand (std::function< void()> toRun, wpi::units::second_t period, Requirements requirements={})
 Creates a new NotifierCommand.
 NotifierCommand (NotifierCommand &&other)
 NotifierCommand (const NotifierCommand &other)
void Initialize () override
void End (bool interrupted) override
Public Member Functions inherited from wpi::cmd::CommandHelper< Command, NotifierCommand >
 CommandHelper ()=default
CommandPtr ToPtr () &&override

Detailed Description

A command that starts a notifier to run the given runnable periodically in a separate thread.

Has no end condition as-is; either subclass it or use Command::WithTimeout(double) or Command::Until(BooleanSupplier) to give it one.

WARNING: Do not use this class unless you are confident in your ability to make the executed code thread-safe. If you do not know what "thread-safe" means, that is a good sign that you should not use this class.

This class is provided by the NewCommands VendorDep

Constructor & Destructor Documentation

◆ NotifierCommand() [1/3]

wpi::cmd::NotifierCommand::NotifierCommand ( std::function< void()> toRun,
wpi::units::second_t period,
Requirements requirements = {} )

Creates a new NotifierCommand.

Parameters
toRunthe runnable for the notifier to run
periodthe period at which the notifier should run
requirementsthe subsystems required by this command

◆ NotifierCommand() [2/3]

wpi::cmd::NotifierCommand::NotifierCommand ( NotifierCommand && other)

◆ NotifierCommand() [3/3]

wpi::cmd::NotifierCommand::NotifierCommand ( const NotifierCommand & other)

Member Function Documentation

◆ End()

void wpi::cmd::NotifierCommand::End ( bool interrupted)
override

◆ Initialize()

void wpi::cmd::NotifierCommand::Initialize ( )
override

The documentation for this class was generated from the following file: