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:
Oblarg
2019-11-08 21:30:30 -05:00
committed by Peter Johnson
parent ff39a96cee
commit 00228678d4
18 changed files with 97 additions and 59 deletions

View File

@@ -28,8 +28,9 @@ Trigger Trigger::WhenActive(Command* command, bool interruptible) {
return *this;
}
Trigger Trigger::WhenActive(std::function<void()> toRun) {
return WhenActive(InstantCommand(std::move(toRun), {}));
Trigger Trigger::WhenActive(std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) {
return WhenActive(InstantCommand(std::move(toRun), requirements));
}
Trigger Trigger::WhileActiveContinous(Command* command, bool interruptible) {
@@ -48,8 +49,9 @@ Trigger Trigger::WhileActiveContinous(Command* command, bool interruptible) {
return *this;
}
Trigger Trigger::WhileActiveContinous(std::function<void()> toRun) {
return WhileActiveContinous(InstantCommand(std::move(toRun), {}));
Trigger Trigger::WhileActiveContinous(std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) {
return WhileActiveContinous(InstantCommand(std::move(toRun), requirements));
}
Trigger Trigger::WhileActiveOnce(Command* command, bool interruptible) {
@@ -82,8 +84,9 @@ Trigger Trigger::WhenInactive(Command* command, bool interruptible) {
return *this;
}
Trigger Trigger::WhenInactive(std::function<void()> toRun) {
return WhenInactive(InstantCommand(std::move(toRun), {}));
Trigger Trigger::WhenInactive(std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) {
return WhenInactive(InstantCommand(std::move(toRun), requirements));
}
Trigger Trigger::ToggleWhenActive(Command* command, bool interruptible) {