mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add requirements param to more Command APIs (#2059)
Assorted improvements to the ergonomics of declaring requirements in the new command framework. C++ requirements list parameters have been defaulted to an empty list, some missing C++ requirements list parameters have been added, and both C++ and Java have been given requirements list params in various InstantCommand wrapper methods (#2049), whose value is forwarded to the command.
This commit is contained in:
@@ -12,11 +12,14 @@ using namespace frc2;
|
||||
FunctionalCommand::FunctionalCommand(std::function<void()> onInit,
|
||||
std::function<void()> onExecute,
|
||||
std::function<void(bool)> onEnd,
|
||||
std::function<bool()> isFinished)
|
||||
std::function<bool()> isFinished,
|
||||
std::initializer_list<Subsystem*> requirements)
|
||||
: m_onInit{std::move(onInit)},
|
||||
m_onExecute{std::move(onExecute)},
|
||||
m_onEnd{std::move(onEnd)},
|
||||
m_isFinished{std::move(isFinished)} {}
|
||||
m_isFinished{std::move(isFinished)} {
|
||||
AddRequirements(requirements);
|
||||
}
|
||||
|
||||
void FunctionalCommand::Initialize() { m_onInit(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user