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

A command that does nothing but ends after a specified match time or condition. More...

#include <wpi/commands2/WaitUntilCommand.hpp>

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

Public Member Functions

 WaitUntilCommand (std::function< bool()> condition)
 Creates a new WaitUntilCommand that ends after a given condition becomes true.
 WaitUntilCommand (wpi::units::second_t time)
 Creates a new WaitUntilCommand that ends after a given match time.
 WaitUntilCommand (WaitUntilCommand &&other)=default
 WaitUntilCommand (const WaitUntilCommand &other)=default
bool IsFinished () override
bool RunsWhenDisabled () const override
Public Member Functions inherited from wpi::cmd::CommandHelper< Command, WaitUntilCommand >
 CommandHelper ()=default
CommandPtr ToPtr () &&override

Detailed Description

A command that does nothing but ends after a specified match time or condition.

Useful for CommandGroups.

This class is provided by the NewCommands VendorDep

Constructor & Destructor Documentation

◆ WaitUntilCommand() [1/4]

wpi::cmd::WaitUntilCommand::WaitUntilCommand ( std::function< bool()> condition)
explicit

Creates a new WaitUntilCommand that ends after a given condition becomes true.

Parameters
conditionthe condition to determine when to end

◆ WaitUntilCommand() [2/4]

wpi::cmd::WaitUntilCommand::WaitUntilCommand ( wpi::units::second_t time)
explicit

Creates a new WaitUntilCommand that ends after a given match time.

NOTE: The match timer used for this command is UNOFFICIAL. Using this command does NOT guarantee that the time at which the action is performed will be judged to be legal by the referees. When in doubt, add a safety factor or time the action manually.

The match time counts down when connected to FMS or the DS is in practice mode for the current mode. When the DS is not connected to FMS or in practice mode, the command will not wait.

Parameters
timethe match time after which to end, in seconds
See also
wpi::DriverStation::GetMatchTime()

◆ WaitUntilCommand() [3/4]

wpi::cmd::WaitUntilCommand::WaitUntilCommand ( WaitUntilCommand && other)
default

◆ WaitUntilCommand() [4/4]

wpi::cmd::WaitUntilCommand::WaitUntilCommand ( const WaitUntilCommand & other)
default

Member Function Documentation

◆ IsFinished()

bool wpi::cmd::WaitUntilCommand::IsFinished ( )
override

◆ RunsWhenDisabled()

bool wpi::cmd::WaitUntilCommand::RunsWhenDisabled ( ) const
override

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