diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/EndlessCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/EndlessCommand.java index 3f2e3ffb00..9ba8c1a291 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/EndlessCommand.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/EndlessCommand.java @@ -52,9 +52,4 @@ public class EndlessCommand extends CommandBase { public boolean runsWhenDisabled() { return m_command.runsWhenDisabled(); } - - @Override - public EndlessCommand endlessly() { - return this; - } } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java index edc8005f34..fa6ab8db92 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java @@ -95,10 +95,4 @@ public class ParallelCommandGroup extends CommandGroupBase { public boolean runsWhenDisabled() { return m_runWhenDisabled; } - - @Override - public ParallelCommandGroup alongWith(Command... parallel) { - addCommands(parallel); - return this; - } } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelDeadlineGroup.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelDeadlineGroup.java index 918a134860..f0e192958e 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelDeadlineGroup.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelDeadlineGroup.java @@ -119,10 +119,4 @@ public class ParallelDeadlineGroup extends CommandGroupBase { public boolean runsWhenDisabled() { return m_runWhenDisabled; } - - @Override - public ParallelDeadlineGroup deadlineWith(Command... parallel) { - addCommands(parallel); - return this; - } } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelRaceGroup.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelRaceGroup.java index 04ad5a81f4..edbb83d6de 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelRaceGroup.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelRaceGroup.java @@ -88,10 +88,4 @@ public class ParallelRaceGroup extends CommandGroupBase { public boolean runsWhenDisabled() { return m_runWhenDisabled; } - - @Override - public ParallelRaceGroup raceWith(Command... parallel) { - addCommands(parallel); - return this; - } } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PerpetualCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PerpetualCommand.java index 9448ed0d30..c165c354ac 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PerpetualCommand.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PerpetualCommand.java @@ -55,10 +55,4 @@ public class PerpetualCommand extends CommandBase { public boolean runsWhenDisabled() { return m_command.runsWhenDisabled(); } - - @SuppressWarnings("removal") // Command.perpetually() - @Override - public PerpetualCommand perpetually() { - return this; - } } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/RepeatCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/RepeatCommand.java index 5b17d63d19..a59b4a068d 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/RepeatCommand.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/RepeatCommand.java @@ -62,9 +62,4 @@ public class RepeatCommand extends CommandBase { public boolean runsWhenDisabled() { return m_command.runsWhenDisabled(); } - - @Override - public RepeatCommand repeatedly() { - return this; - } } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SequentialCommandGroup.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SequentialCommandGroup.java index 5fda8f68d0..f028e5ed56 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SequentialCommandGroup.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SequentialCommandGroup.java @@ -94,28 +94,4 @@ public class SequentialCommandGroup extends CommandGroupBase { public boolean runsWhenDisabled() { return m_runWhenDisabled; } - - @Override - public SequentialCommandGroup beforeStarting(Command before) { - // store all the commands - var commands = new ArrayList(); - commands.add(before); - commands.addAll(m_commands); - - // reset current state - commands.forEach(CommandGroupBase::clearGroupedCommand); - m_commands.clear(); - m_requirements.clear(); - m_runWhenDisabled = true; - - // add them back - addCommands(commands.toArray(Command[]::new)); - return this; - } - - @Override - public SequentialCommandGroup andThen(Command... next) { - addCommands(next); - return this; - } } diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/EndlessCommand.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/EndlessCommand.cpp index a7d28c9e6c..43714bfea4 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/EndlessCommand.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/EndlessCommand.cpp @@ -26,7 +26,3 @@ void EndlessCommand::Execute() { void EndlessCommand::End(bool interrupted) { m_command->End(interrupted); } - -EndlessCommand EndlessCommand::Endlessly() && { - return std::move(*this); -} diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/PerpetualCommand.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/PerpetualCommand.cpp index bd8bb93ed3..0c199f2d05 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/PerpetualCommand.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/PerpetualCommand.cpp @@ -26,7 +26,3 @@ void PerpetualCommand::Execute() { void PerpetualCommand::End(bool interrupted) { m_command->End(interrupted); } - -PerpetualCommand PerpetualCommand::Perpetually() && { - return std::move(*this); -} diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/RepeatCommand.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/RepeatCommand.cpp index c889fd59b4..226f1ea255 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/RepeatCommand.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/RepeatCommand.cpp @@ -39,7 +39,3 @@ void RepeatCommand::End(bool interrupted) { bool RepeatCommand::RunsWhenDisabled() const { return m_command->RunsWhenDisabled(); } - -RepeatCommand RepeatCommand::Repeatedly() && { - return std::move(*this); -} diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/SequentialCommandGroup.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/SequentialCommandGroup.cpp index 345a415786..1de96a3300 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/SequentialCommandGroup.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/SequentialCommandGroup.cpp @@ -4,8 +4,6 @@ #include "frc2/command/SequentialCommandGroup.h" -#include "frc2/command/InstantCommand.h" - using namespace frc2; SequentialCommandGroup::SequentialCommandGroup( @@ -74,33 +72,3 @@ void SequentialCommandGroup::AddCommands( m_commands.emplace_back(std::move(command)); } } - -SequentialCommandGroup SequentialCommandGroup::BeforeStarting( - std::function toRun, wpi::span requirements) && { - // store all the commands - std::vector> tmp; - tmp.emplace_back( - std::make_unique(std::move(toRun), requirements)); - for (auto&& command : m_commands) { - command->SetGrouped(false); - tmp.emplace_back(std::move(command)); - } - - // reset current state - m_commands.clear(); - m_requirements.clear(); - m_runWhenDisabled = true; - - // add the commands back - AddCommands(std::move(tmp)); - return std::move(*this); -} - -SequentialCommandGroup SequentialCommandGroup::AndThen( - std::function toRun, wpi::span requirements) && { - std::vector> tmp; - tmp.emplace_back( - std::make_unique(std::move(toRun), requirements)); - AddCommands(std::move(tmp)); - return std::move(*this); -} diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h index 0d82652d18..a888e24ae2 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h @@ -130,7 +130,7 @@ class Command { * @param duration the timeout duration * @return the command with the timeout added */ - virtual ParallelRaceGroup WithTimeout(units::second_t duration) &&; + ParallelRaceGroup WithTimeout(units::second_t duration) &&; /** * Decorates this command with an interrupt condition. If the specified @@ -141,7 +141,7 @@ class Command { * @param condition the interrupt condition * @return the command with the interrupt condition added */ - virtual ParallelRaceGroup Until(std::function condition) &&; + ParallelRaceGroup Until(std::function condition) &&; /** * Decorates this command with an interrupt condition. If the specified @@ -152,7 +152,7 @@ class Command { * @param condition the interrupt condition * @return the command with the interrupt condition added */ - virtual ParallelRaceGroup WithInterrupt(std::function condition) &&; + ParallelRaceGroup WithInterrupt(std::function condition) &&; /** * Decorates this command with a runnable to run before this command starts. @@ -161,7 +161,7 @@ class Command { * @param requirements the required subsystems * @return the decorated command */ - virtual SequentialCommandGroup BeforeStarting( + SequentialCommandGroup BeforeStarting( std::function toRun, std::initializer_list requirements) &&; @@ -172,7 +172,7 @@ class Command { * @param requirements the required subsystems * @return the decorated command */ - virtual SequentialCommandGroup BeforeStarting( + SequentialCommandGroup BeforeStarting( std::function toRun, wpi::span requirements = {}) &&; @@ -183,7 +183,7 @@ class Command { * @param requirements the required subsystems * @return the decorated command */ - virtual SequentialCommandGroup AndThen( + SequentialCommandGroup AndThen( std::function toRun, std::initializer_list requirements) &&; @@ -194,7 +194,7 @@ class Command { * @param requirements the required subsystems * @return the decorated command */ - virtual SequentialCommandGroup AndThen( + SequentialCommandGroup AndThen( std::function toRun, wpi::span requirements = {}) &&; @@ -206,7 +206,7 @@ class Command { * @deprecated replace with EndlessCommand */ WPI_DEPRECATED("Replace with Endlessly()") - virtual PerpetualCommand Perpetually() &&; + PerpetualCommand Perpetually() &&; /** * Decorates this command to run endlessly, ignoring its ordinary end @@ -214,7 +214,7 @@ class Command { * * @return the decorated command */ - virtual EndlessCommand Endlessly() &&; + EndlessCommand Endlessly() &&; /** * Decorates this command to run repeatedly, restarting it when it ends, until @@ -222,7 +222,7 @@ class Command { * * @return the decorated command */ - virtual RepeatCommand Repeatedly() &&; + RepeatCommand Repeatedly() &&; /** * Decorates this command to run "by proxy" by wrapping it in a @@ -232,7 +232,7 @@ class Command { * * @return the decorated command */ - virtual ProxyScheduleCommand AsProxy(); + ProxyScheduleCommand AsProxy(); /** * Decorates this command to only run if this condition is not met. If the @@ -243,7 +243,7 @@ class Command { * @param condition the condition that will prevent the command from running * @return the decorated command */ - virtual ConditionalCommand Unless(std::function condition) &&; + ConditionalCommand Unless(std::function condition) &&; /** * Decorates this command to run or stop when disabled. @@ -251,7 +251,7 @@ class Command { * @param doesRunWhenDisabled true to run when disabled. * @return the decorated command */ - virtual std::unique_ptr IgnoringDisable(bool doesRunWhenDisabled) &&; + std::unique_ptr IgnoringDisable(bool doesRunWhenDisabled) &&; /** * Decorates this command to run or stop when disabled. @@ -259,7 +259,7 @@ class Command { * @param interruptBehavior true to run when disabled. * @return the decorated command */ - virtual std::unique_ptr WithInterruptBehavior( + std::unique_ptr WithInterruptBehavior( InterruptionBehavior interruptBehavior) &&; /** diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/EndlessCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/EndlessCommand.h index 6de039f85b..c47da46f77 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/EndlessCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/EndlessCommand.h @@ -67,8 +67,6 @@ class EndlessCommand : public CommandHelper { void End(bool interrupted) override; - EndlessCommand Endlessly() && override; - private: std::unique_ptr m_command; }; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/PerpetualCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/PerpetualCommand.h index 7d4c7aa4a9..b4e7380dbc 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/PerpetualCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/PerpetualCommand.h @@ -73,8 +73,6 @@ class PerpetualCommand : public CommandHelper { void End(bool interrupted) override; - PerpetualCommand Perpetually() && override; - private: std::unique_ptr m_command; }; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/RepeatCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/RepeatCommand.h index 8d1b3b1678..0fb9e6f355 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/RepeatCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/RepeatCommand.h @@ -69,8 +69,6 @@ class RepeatCommand : public CommandHelper { bool RunsWhenDisabled() const override; - RepeatCommand Repeatedly() && override; - private: std::unique_ptr m_command; }; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/SequentialCommandGroup.h b/wpilibNewCommands/src/main/native/include/frc2/command/SequentialCommandGroup.h index f7931a6cc9..741eba416b 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/SequentialCommandGroup.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/SequentialCommandGroup.h @@ -15,8 +15,6 @@ #include #include -#include - #include "frc2/command/CommandGroupBase.h" #include "frc2/command/CommandHelper.h" @@ -88,16 +86,6 @@ class SequentialCommandGroup bool RunsWhenDisabled() const override; - SequentialCommandGroup BeforeStarting( - std::function toRun, - wpi::span requirements = {}) && - override; - - SequentialCommandGroup AndThen( - std::function toRun, - wpi::span requirements = {}) && - override; - private: void AddCommands(std::vector>&& commands) final;