WPILibC++
2027.0.0-alpha-4
Loading...
Searching...
No Matches
RunCommand.hpp
Go to the documentation of this file.
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
#pragma once
6
7
#include <functional>
8
9
#include "
wpi/commands2/CommandHelper.hpp
"
10
#include "
wpi/commands2/FunctionalCommand.hpp
"
11
#include "
wpi/commands2/Requirements.hpp
"
12
13
namespace
wpi::cmd
{
14
/**
15
* A command that runs a Runnable continuously. Has no end condition as-is;
16
* either subclass it or use Command.WithTimeout() or
17
* Command.Until() to give it one. If you only wish
18
* to execute a Runnable once, use InstantCommand.
19
*
20
* This class is provided by the NewCommands VendorDep
21
*/
22
class
RunCommand
:
public
CommandHelper
<FunctionalCommand, RunCommand> {
23
public
:
24
/**
25
* Creates a new RunCommand. The Runnable will be run continuously until the
26
* command ends. Does not run when disabled.
27
*
28
* @param toRun the Runnable to run
29
* @param requirements the subsystems to require
30
*/
31
explicit
RunCommand
(std::function<
void
()> toRun,
32
Requirements
requirements = {});
33
34
RunCommand
(
RunCommand
&& other) =
default
;
35
36
RunCommand
(
const
RunCommand
& other) =
default
;
37
};
38
}
// namespace wpi::cmd
CommandHelper.hpp
FunctionalCommand.hpp
Requirements.hpp
wpi::cmd::CommandHelper< FunctionalCommand, RunCommand >::CommandHelper
CommandHelper()=default
wpi::cmd::Requirements
Represents requirements for a command, which is a set of (pointers to) subsystems.
Definition
Requirements.hpp:20
wpi::cmd::RunCommand::RunCommand
RunCommand(const RunCommand &other)=default
wpi::cmd::RunCommand::RunCommand
RunCommand(RunCommand &&other)=default
wpi::cmd::RunCommand::RunCommand
RunCommand(std::function< void()> toRun, Requirements requirements={})
Creates a new RunCommand.
wpi::cmd
Definition
CommandNiDsStadiaController.hpp:15
wpi
commands2
RunCommand.hpp
Generated on
for WPILibC++ by
1.15.0