diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java
index 5bd24e16dd..7b5ccc7fb6 100644
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java
+++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java
@@ -115,25 +115,6 @@ public interface Command {
return until(() -> !condition.getAsBoolean());
}
- /**
- * Decorates this command with an interrupt condition. If the specified condition becomes true
- * before the command finishes normally, the command will be interrupted and un-scheduled.
- *
- *
Note: This decorator works by adding this command to a composition. The command the
- * decorator was called on cannot be scheduled independently or be added to a different
- * composition (namely, decorators), unless it is manually cleared from the list of composed
- * commands with {@link CommandScheduler#removeComposedCommand(Command)}. The command composition
- * returned from this method can be further decorated without issue.
- *
- * @param condition the interrupt condition
- * @return the command with the interrupt condition added
- * @deprecated Replace with {@link #until(BooleanSupplier)}
- */
- @Deprecated(since = "2023")
- default ParallelRaceGroup withInterrupt(BooleanSupplier condition) {
- return until(condition);
- }
-
/**
* Decorates this command with a runnable to run before this command starts.
*
@@ -261,28 +242,6 @@ public interface Command {
return group;
}
- /**
- * Decorates this command to run perpetually, ignoring its ordinary end conditions. The decorated
- * command can still be interrupted or canceled.
- *
- *
Note: This decorator works by adding this command to a composition. The command the
- * decorator was called on cannot be scheduled independently or be added to a different
- * composition (namely, decorators), unless it is manually cleared from the list of composed
- * commands with {@link CommandScheduler#removeComposedCommand(Command)}. The command composition
- * returned from this method can be further decorated without issue.
- *
- * @return the decorated command
- * @deprecated PerpetualCommand violates the assumption that execute() doesn't get called after
- * isFinished() returns true -- an assumption that should be valid. This was unsafe/undefined
- * behavior from the start, and RepeatCommand provides an easy way to achieve similar end
- * results with slightly different (and safe) semantics.
- */
- @SuppressWarnings("removal") // PerpetualCommand
- @Deprecated(forRemoval = true, since = "2023")
- default PerpetualCommand perpetually() {
- return new PerpetualCommand(this);
- }
-
/**
* Decorates this command to run repeatedly, restarting it when it ends, until this command is
* interrupted. The decorated command can still be canceled.
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandGroupBase.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandGroupBase.java
deleted file mode 100644
index 73a13423ee..0000000000
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandGroupBase.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-package edu.wpi.first.wpilibj2.command;
-
-/**
- * A base for CommandGroups.
- *
- *
This class is provided by the NewCommands VendorDep
- *
- * @deprecated This class is an empty abstraction. Inherit directly from CommandBase/Command.
- */
-@Deprecated(forRemoval = true)
-public abstract class CommandGroupBase extends CommandBase {
- /**
- * Adds the given commands to the command group.
- *
- * @param commands The commands to add.
- */
- public abstract void addCommands(Command... commands);
-
- /**
- * Factory method for {@link SequentialCommandGroup}, included for brevity/convenience.
- *
- * @param commands the commands to include
- * @return the command group
- * @deprecated Replace with {@link Commands#sequence(Command...)}
- */
- @Deprecated
- public static SequentialCommandGroup sequence(Command... commands) {
- return new SequentialCommandGroup(commands);
- }
-
- /**
- * Factory method for {@link ParallelCommandGroup}, included for brevity/convenience.
- *
- * @param commands the commands to include
- * @return the command group
- * @deprecated Replace with {@link Commands#parallel(Command...)}
- */
- @Deprecated
- public static ParallelCommandGroup parallel(Command... commands) {
- return new ParallelCommandGroup(commands);
- }
-
- /**
- * Factory method for {@link ParallelRaceGroup}, included for brevity/convenience.
- *
- * @param commands the commands to include
- * @return the command group
- * @deprecated Replace with {@link Commands#race(Command...)}
- */
- @Deprecated
- public static ParallelRaceGroup race(Command... commands) {
- return new ParallelRaceGroup(commands);
- }
-
- /**
- * Factory method for {@link ParallelDeadlineGroup}, included for brevity/convenience.
- *
- * @param deadline the deadline command
- * @param commands the commands to include
- * @return the command group
- * @deprecated Replace with {@link Commands#deadline(Command, Command...)}
- */
- @Deprecated
- public static ParallelDeadlineGroup deadline(Command deadline, Command... commands) {
- return new ParallelDeadlineGroup(deadline, commands);
- }
-}
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java
index 986cdb6851..37cac9cb3a 100644
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java
+++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java
@@ -151,27 +151,6 @@ public final class CommandScheduler implements NTSendable, AutoCloseable {
requireNonNullParam(loop, "loop", "CommandScheduler" + ".replaceButtonEventLoop");
}
- /**
- * Adds a button binding to the scheduler, which will be polled to schedule commands.
- *
- * @param button The button to add
- * @deprecated Use {@link edu.wpi.first.wpilibj2.command.button.Trigger}
- */
- @Deprecated(since = "2023")
- public void addButton(Runnable button) {
- m_activeButtonLoop.bind(requireNonNullParam(button, "button", "addButton"));
- }
-
- /**
- * Removes all button bindings from the scheduler.
- *
- * @deprecated call {@link EventLoop#clear()} on {@link #getActiveButtonLoop()} directly instead.
- */
- @Deprecated(since = "2023")
- public void clearButtons() {
- m_activeButtonLoop.clear();
- }
-
/**
* Initializes a given command, adds its requirements to the list, and performs the init actions.
*
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 3b36f42eca..6c5c8ea3a6 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
@@ -17,8 +17,7 @@ import java.util.Map;
*
*
This class is provided by the NewCommands VendorDep
*/
-@SuppressWarnings("removal")
-public class ParallelCommandGroup extends CommandGroupBase {
+public class ParallelCommandGroup extends CommandBase {
// maps commands in this composition to whether they are still running
private final Map m_commands = new HashMap<>();
private boolean m_runWhenDisabled = true;
@@ -35,7 +34,11 @@ public class ParallelCommandGroup extends CommandGroupBase {
addCommands(commands);
}
- @Override
+ /**
+ * Adds the given commands to the group.
+ *
+ * @param commands Commands to add to the group.
+ */
public final void addCommands(Command... commands) {
if (m_commands.containsValue(true)) {
throw new IllegalStateException(
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 2e62a9f08b..8c95685178 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
@@ -20,8 +20,7 @@ import java.util.Map;
*
* This class is provided by the NewCommands VendorDep
*/
-@SuppressWarnings("removal")
-public class ParallelDeadlineGroup extends CommandGroupBase {
+public class ParallelDeadlineGroup extends CommandBase {
// maps commands in this composition to whether they are still running
private final Map m_commands = new HashMap<>();
private boolean m_runWhenDisabled = true;
@@ -59,7 +58,11 @@ public class ParallelDeadlineGroup extends CommandGroupBase {
m_deadline = deadline;
}
- @Override
+ /**
+ * Adds the given commands to the group.
+ *
+ * @param commands Commands to add to the group.
+ */
public final void addCommands(Command... commands) {
if (!m_finished) {
throw new IllegalStateException(
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 e5ba80d173..697b1f3e79 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
@@ -18,8 +18,7 @@ import java.util.Set;
*
* This class is provided by the NewCommands VendorDep
*/
-@SuppressWarnings("removal")
-public class ParallelRaceGroup extends CommandGroupBase {
+public class ParallelRaceGroup extends CommandBase {
private final Set m_commands = new HashSet<>();
private boolean m_runWhenDisabled = true;
private boolean m_finished = true;
@@ -36,7 +35,11 @@ public class ParallelRaceGroup extends CommandGroupBase {
addCommands(commands);
}
- @Override
+ /**
+ * Adds the given commands to the group.
+ *
+ * @param commands Commands to add to the group.
+ */
public final void addCommands(Command... commands) {
if (!m_finished) {
throw new IllegalStateException(
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
deleted file mode 100644
index 9fb90190a7..0000000000
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PerpetualCommand.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-package edu.wpi.first.wpilibj2.command;
-
-/**
- * A command that runs another command in perpetuity, ignoring that command's end conditions. While
- * this class does not extend {@link CommandGroupBase}, it is still considered a composition, as it
- * allows one to compose another command within it; the command instances that are passed to it
- * cannot be added to any other groups, or scheduled individually.
- *
- * As a rule, CommandGroups require the union of the requirements of their component commands.
- *
- *
This class is provided by the NewCommands VendorDep
- *
- * @deprecated PerpetualCommand violates the assumption that execute() doesn't get called after
- * isFinished() returns true -- an assumption that should be valid. This was unsafe/undefined
- * behavior from the start, and RepeatCommand provides an easy way to achieve similar end
- * results with slightly different (and safe) semantics.
- */
-@Deprecated(forRemoval = true, since = "2023")
-public class PerpetualCommand extends CommandBase {
- protected final Command m_command;
-
- /**
- * Creates a new PerpetualCommand. Will run another command in perpetuity, ignoring that command's
- * end conditions, unless this command itself is interrupted.
- *
- * @param command the command to run perpetually
- */
- public PerpetualCommand(Command command) {
- CommandScheduler.getInstance().registerComposedCommands(command);
- m_command = command;
- m_requirements.addAll(command.getRequirements());
- }
-
- @Override
- public void initialize() {
- m_command.initialize();
- }
-
- @Override
- public void execute() {
- m_command.execute();
- }
-
- @Override
- public void end(boolean interrupted) {
- m_command.end(interrupted);
- }
-
- @Override
- public boolean runsWhenDisabled() {
- return m_command.runsWhenDisabled();
- }
-}
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProxyScheduleCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProxyScheduleCommand.java
deleted file mode 100644
index eec1b1809a..0000000000
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProxyScheduleCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-package edu.wpi.first.wpilibj2.command;
-
-import java.util.Set;
-
-/**
- * Schedules the given commands when this command is initialized, and ends when all the commands are
- * no longer scheduled. Useful for forking off from CommandGroups. If this command is interrupted,
- * it will cancel all the commands.
- *
- *
This class is provided by the NewCommands VendorDep
- */
-public class ProxyScheduleCommand extends CommandBase {
- private final Set m_toSchedule;
- private boolean m_finished;
-
- /**
- * Creates a new ProxyScheduleCommand that schedules the given commands when initialized, and ends
- * when they are all no longer scheduled.
- *
- * @param toSchedule the commands to schedule
- * @deprecated Replace with {@link ProxyCommand}, composing multiple of them in a {@link
- * ParallelRaceGroup} if needed.
- */
- @Deprecated
- public ProxyScheduleCommand(Command... toSchedule) {
- m_toSchedule = Set.of(toSchedule);
- }
-
- @Override
- public void initialize() {
- for (Command command : m_toSchedule) {
- command.schedule();
- }
- }
-
- @Override
- public void end(boolean interrupted) {
- if (interrupted) {
- for (Command command : m_toSchedule) {
- command.cancel();
- }
- }
- }
-
- @Override
- public void execute() {
- m_finished = true;
- for (Command command : m_toSchedule) {
- m_finished &= !command.isScheduled();
- }
- }
-
- @Override
- public boolean isFinished() {
- return m_finished;
- }
-}
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SelectCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SelectCommand.java
index d9477013d0..492ff3eb92 100644
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SelectCommand.java
+++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SelectCommand.java
@@ -23,7 +23,6 @@ import java.util.function.Supplier;
public class SelectCommand extends CommandBase {
private final Map m_commands;
private final Supplier m_selector;
- private final Supplier m_toRun;
private Command m_selectedCommand;
private boolean m_runsWhenDisabled = true;
private InterruptionBehavior m_interruptBehavior = InterruptionBehavior.kCancelIncoming;
@@ -41,8 +40,6 @@ public class SelectCommand extends CommandBase {
CommandScheduler.getInstance()
.registerComposedCommands(commands.values().toArray(new Command[] {}));
- m_toRun = null;
-
for (Command command : m_commands.values()) {
m_requirements.addAll(command.getRequirements());
m_runsWhenDisabled &= command.runsWhenDisabled();
@@ -52,35 +49,13 @@ public class SelectCommand extends CommandBase {
}
}
- /**
- * Creates a new SelectCommand.
- *
- * @param toRun a supplier providing the command to run
- * @deprecated Replace with {@link ProxyCommand}
- */
- @Deprecated
- public SelectCommand(Supplier toRun) {
- m_commands = null;
- m_selector = null;
- m_toRun = requireNonNullParam(toRun, "toRun", "SelectCommand");
-
- // we have no way of checking the underlying command, so default.
- m_runsWhenDisabled = false;
- m_interruptBehavior = InterruptionBehavior.kCancelSelf;
- }
-
@Override
public void initialize() {
- if (m_selector != null) {
- if (!m_commands.containsKey(m_selector.get())) {
- m_selectedCommand =
- new PrintCommand(
- "SelectCommand selector value does not correspond to" + " any command!");
- return;
- }
- m_selectedCommand = m_commands.get(m_selector.get());
+ if (!m_commands.containsKey(m_selector.get())) {
+ m_selectedCommand =
+ new PrintCommand("SelectCommand selector value does not correspond to any command!");
} else {
- m_selectedCommand = m_toRun.get();
+ m_selectedCommand = m_commands.get(m_selector.get());
}
m_selectedCommand.initialize();
}
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 892f94ac2c..5be4491903 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
@@ -17,8 +17,7 @@ import java.util.List;
*
* This class is provided by the NewCommands VendorDep
*/
-@SuppressWarnings("removal")
-public class SequentialCommandGroup extends CommandGroupBase {
+public class SequentialCommandGroup extends CommandBase {
private final List m_commands = new ArrayList<>();
private int m_currentCommandIndex = -1;
private boolean m_runWhenDisabled = true;
@@ -34,7 +33,11 @@ public class SequentialCommandGroup extends CommandGroupBase {
addCommands(commands);
}
- @Override
+ /**
+ * Adds the given commands to the group.
+ *
+ * @param commands Commands to add, in order of execution.
+ */
public final void addCommands(Command... commands) {
if (m_currentCommandIndex != -1) {
throw new IllegalStateException(
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/Button.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/Button.java
deleted file mode 100644
index 4e4e11a818..0000000000
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/Button.java
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-package edu.wpi.first.wpilibj2.command.button;
-
-import edu.wpi.first.wpilibj2.command.Command;
-import edu.wpi.first.wpilibj2.command.Subsystem;
-import java.util.function.BooleanSupplier;
-
-/**
- * This class provides an easy way to link commands to OI inputs.
- *
- * It is very easy to link a button to a command. For instance, you could link the trigger button
- * of a joystick to a "score" command.
- *
- *
This class represents a subclass of Trigger that is specifically aimed at buttons on an
- * operator interface as a common use case of the more generalized Trigger objects. This is a simple
- * wrapper around Trigger with the method names renamed to fit the Button object use.
- *
- * @deprecated Replace with {@link Trigger}.
- */
-@Deprecated
-public class Button extends Trigger {
- /**
- * Default constructor; creates a button that is never pressed.
- *
- * @deprecated Replace with {@code new Button(() -> false) }.
- */
- @Deprecated(since = "2023")
- public Button() {}
-
- /**
- * Creates a new button with the given condition determining whether it is pressed.
- *
- * @param isPressed returns whether the trigger should be active
- * @deprecated Replace with Trigger.
- */
- @Deprecated
- public Button(BooleanSupplier isPressed) {
- super(isPressed);
- }
-
- /**
- * Starts the given command whenever the button is newly pressed.
- *
- * @param command the command to start
- * @return this button, so calls can be chained
- * @deprecated Replace with {@link Trigger#onTrue(Command)}
- */
- @Deprecated
- public Button whenPressed(final Command command) {
- whenActive(command);
- return this;
- }
-
- /**
- * Runs the given runnable whenever the button is newly pressed.
- *
- * @param toRun the runnable to run
- * @param requirements the required subsystems
- * @return this button, so calls can be chained
- * @deprecated Replace with {@link #onTrue(Command)}, creating the InstantCommand manually
- */
- @Deprecated
- public Button whenPressed(final Runnable toRun, Subsystem... requirements) {
- whenActive(toRun, requirements);
- return this;
- }
-
- /**
- * Constantly starts the given command while the button is held.
- *
- *
{@link Command#schedule()} will be called repeatedly while the button is held, and will be
- * canceled when the button is released.
- *
- * @param command the command to start
- * @return this button, so calls can be chained
- * @deprecated Use {@link #whileTrue(Command)} with {@link
- * edu.wpi.first.wpilibj2.command.RepeatCommand RepeatCommand}.
- */
- @Deprecated
- public Button whileHeld(final Command command) {
- whileActiveContinuous(command);
- return this;
- }
-
- /**
- * Constantly runs the given runnable while the button is held.
- *
- * @param toRun the runnable to run
- * @param requirements the required subsystems
- * @return this button, so calls can be chained
- * @deprecated Use {@link #whileTrue(Command)} and construct a RunCommand manually
- */
- @Deprecated
- public Button whileHeld(final Runnable toRun, Subsystem... requirements) {
- whileActiveContinuous(toRun, requirements);
- return this;
- }
-
- /**
- * Starts the given command when the button is first pressed, and cancels it when it is released,
- * but does not start it again if it ends or is otherwise interrupted.
- *
- * @param command the command to start
- * @return this button, so calls can be chained
- * @deprecated Replace with {@link Trigger#whileTrue(Command)}
- */
- @Deprecated
- public Button whenHeld(final Command command) {
- whileActiveOnce(command);
- return this;
- }
-
- /**
- * Starts the command when the button is released. The command is set to be interruptible.
- *
- * @param command the command to start
- * @return this button, so calls can be chained
- * @deprecated Replace with {@link Trigger#onFalse(Command)}
- */
- @Deprecated
- public Button whenReleased(final Command command) {
- whenInactive(command);
- return this;
- }
-
- /**
- * Runs the given runnable when the button is released.
- *
- * @param toRun the runnable to run
- * @param requirements the required subsystems
- * @return this button, so calls can be chained
- * @deprecated Replace with {@link Trigger#onFalse(Command)}, creating the InstantCommand manually
- */
- @Deprecated
- public Button whenReleased(final Runnable toRun, Subsystem... requirements) {
- whenInactive(toRun, requirements);
- return this;
- }
-
- /**
- * Toggles the command whenever the button is pressed (on, then off, then on). The command is set
- * to be interruptible.
- *
- * @param command the command to start
- * @return this button, so calls can be chained
- * @deprecated Replace with {@link Trigger#toggleOnTrue(Command)}
- */
- @Deprecated
- public Button toggleWhenPressed(final Command command) {
- toggleWhenActive(command);
- return this;
- }
-
- /**
- * Cancels the command when the button is pressed.
- *
- * @param command the command to start
- * @return this button, so calls can be chained
- * @deprecated Instead, pass this as an end condition to {@link Command#until(BooleanSupplier)}.
- */
- @Deprecated
- public Button cancelWhenPressed(final Command command) {
- cancelWhenActive(command);
- return this;
- }
-}
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/InternalButton.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/InternalButton.java
index 3106264389..f4897f2aca 100644
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/InternalButton.java
+++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/InternalButton.java
@@ -12,8 +12,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
*
*
This class is provided by the NewCommands VendorDep
*/
-@SuppressWarnings("deprecation")
-public class InternalButton extends Button {
+public class InternalButton extends Trigger {
// need to be references, so they can be mutated after being captured in the constructor.
private final AtomicBoolean m_pressed;
private final AtomicBoolean m_inverted;
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/JoystickButton.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/JoystickButton.java
index f22d443582..e85b666e85 100644
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/JoystickButton.java
+++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/JoystickButton.java
@@ -9,12 +9,11 @@ import static edu.wpi.first.util.ErrorMessages.requireNonNullParam;
import edu.wpi.first.wpilibj.GenericHID;
/**
- * A {@link Button} that gets its state from a {@link GenericHID}.
+ * A {@link Trigger} that gets its state from a {@link GenericHID}.
*
*
This class is provided by the NewCommands VendorDep
*/
-@SuppressWarnings("deprecation")
-public class JoystickButton extends Button {
+public class JoystickButton extends Trigger {
/**
* Creates a joystick button for triggering commands.
*
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/NetworkButton.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/NetworkButton.java
index b21cd970f7..0fb55711a4 100644
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/NetworkButton.java
+++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/NetworkButton.java
@@ -12,12 +12,11 @@ import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableInstance;
/**
- * A {@link Button} that uses a {@link NetworkTable} boolean field.
+ * A {@link Trigger} that uses a {@link NetworkTable} boolean field.
*
*
This class is provided by the NewCommands VendorDep
*/
-@SuppressWarnings("deprecation")
-public class NetworkButton extends Button {
+public class NetworkButton extends Trigger {
/**
* Creates a NetworkButton that commands can be bound to.
*
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/POVButton.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/POVButton.java
index 28087ae55b..b8a63e43bd 100644
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/POVButton.java
+++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/POVButton.java
@@ -9,12 +9,11 @@ import static edu.wpi.first.util.ErrorMessages.requireNonNullParam;
import edu.wpi.first.wpilibj.GenericHID;
/**
- * A {@link Button} that gets its state from a POV on a {@link GenericHID}.
+ * A {@link Trigger} that gets its state from a POV on a {@link GenericHID}.
*
*
This class is provided by the NewCommands VendorDep
*/
-@SuppressWarnings("deprecation")
-public class POVButton extends Button {
+public class POVButton extends Trigger {
/**
* Creates a POV button for triggering commands.
*
diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/Trigger.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/Trigger.java
index 049aa2e043..40f7f78ddf 100644
--- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/Trigger.java
+++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/Trigger.java
@@ -7,12 +7,9 @@ package edu.wpi.first.wpilibj2.command.button;
import static edu.wpi.first.util.ErrorMessages.requireNonNullParam;
import edu.wpi.first.math.filter.Debouncer;
-import edu.wpi.first.wpilibj.event.BooleanEvent;
import edu.wpi.first.wpilibj.event.EventLoop;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
-import edu.wpi.first.wpilibj2.command.InstantCommand;
-import edu.wpi.first.wpilibj2.command.Subsystem;
import java.util.function.BooleanSupplier;
/**
@@ -52,12 +49,6 @@ public class Trigger implements BooleanSupplier {
this(CommandScheduler.getInstance().getDefaultButtonLoop(), condition);
}
- /** Creates a new trigger that is always `false`. */
- @Deprecated
- public Trigger() {
- this(() -> false);
- }
-
/**
* Starts the given command whenever the condition changes from `false` to `true`.
*
@@ -234,238 +225,6 @@ public class Trigger implements BooleanSupplier {
return this;
}
- /**
- * Starts the given command whenever the trigger just becomes active.
- *
- * @param command the command to start
- * @return this trigger, so calls can be chained
- * @deprecated Use {@link #onTrue(Command)} instead.
- */
- @Deprecated
- public Trigger whenActive(final Command command) {
- requireNonNullParam(command, "command", "whenActive");
-
- m_loop.bind(
- new Runnable() {
- private boolean m_pressedLast = m_condition.getAsBoolean();
-
- @Override
- public void run() {
- boolean pressed = m_condition.getAsBoolean();
-
- if (!m_pressedLast && pressed) {
- command.schedule();
- }
-
- m_pressedLast = pressed;
- }
- });
- return this;
- }
-
- /**
- * Runs the given runnable whenever the trigger just becomes active.
- *
- * @param toRun the runnable to run
- * @param requirements the required subsystems
- * @return this trigger, so calls can be chained
- * @deprecated Replace with {@link #onTrue(Command)}, creating the InstantCommand manually
- */
- @Deprecated
- public Trigger whenActive(final Runnable toRun, Subsystem... requirements) {
- return whenActive(new InstantCommand(toRun, requirements));
- }
-
- /**
- * Constantly starts the given command while the button is held.
- *
- *
{@link Command#schedule()} will be called repeatedly while the trigger is active, and will
- * be canceled when the trigger becomes inactive.
- *
- * @param command the command to start
- * @return this trigger, so calls can be chained
- * @deprecated Use {@link #whileTrue(Command)} with {@link
- * edu.wpi.first.wpilibj2.command.RepeatCommand RepeatCommand}, or bind {@link
- * Command#schedule() command::schedule} to {@link BooleanEvent#ifHigh(Runnable)} (passing no
- * requirements).
- */
- @Deprecated
- public Trigger whileActiveContinuous(final Command command) {
- requireNonNullParam(command, "command", "whileActiveContinuous");
-
- m_loop.bind(
- new Runnable() {
- private boolean m_pressedLast = m_condition.getAsBoolean();
-
- @Override
- public void run() {
- boolean pressed = m_condition.getAsBoolean();
-
- if (pressed) {
- command.schedule();
- } else if (m_pressedLast) {
- command.cancel();
- }
-
- m_pressedLast = pressed;
- }
- });
-
- return this;
- }
-
- /**
- * Constantly runs the given runnable while the button is held.
- *
- * @param toRun the runnable to run
- * @param requirements the required subsystems
- * @return this trigger, so calls can be chained
- * @deprecated Use {@link #whileTrue(Command)} and construct a RunCommand manually
- */
- @Deprecated
- public Trigger whileActiveContinuous(final Runnable toRun, Subsystem... requirements) {
- return whileActiveContinuous(new InstantCommand(toRun, requirements));
- }
-
- /**
- * Starts the given command when the trigger initially becomes active, and ends it when it becomes
- * inactive, but does not re-start it in-between.
- *
- * @param command the command to start
- * @return this trigger, so calls can be chained
- * @deprecated Use {@link #whileTrue(Command)} instead.
- */
- @Deprecated
- public Trigger whileActiveOnce(final Command command) {
- requireNonNullParam(command, "command", "whileActiveOnce");
-
- m_loop.bind(
- new Runnable() {
- private boolean m_pressedLast = m_condition.getAsBoolean();
-
- @Override
- public void run() {
- boolean pressed = m_condition.getAsBoolean();
-
- if (!m_pressedLast && pressed) {
- command.schedule();
- } else if (m_pressedLast && !pressed) {
- command.cancel();
- }
-
- m_pressedLast = pressed;
- }
- });
- return this;
- }
-
- /**
- * Starts the command when the trigger becomes inactive.
- *
- * @param command the command to start
- * @return this trigger, so calls can be chained
- * @deprecated Use {@link #onFalse(Command)} instead.
- */
- @Deprecated
- public Trigger whenInactive(final Command command) {
- requireNonNullParam(command, "command", "whenInactive");
-
- m_loop.bind(
- new Runnable() {
- private boolean m_pressedLast = m_condition.getAsBoolean();
-
- @Override
- public void run() {
- boolean pressed = m_condition.getAsBoolean();
-
- if (m_pressedLast && !pressed) {
- command.schedule();
- }
-
- m_pressedLast = pressed;
- }
- });
-
- return this;
- }
-
- /**
- * Runs the given runnable when the trigger becomes inactive.
- *
- * @param toRun the runnable to run
- * @param requirements the required subsystems
- * @return this trigger, so calls can be chained
- * @deprecated Construct the InstantCommand manually and replace with {@link #onFalse(Command)}
- */
- @Deprecated
- public Trigger whenInactive(final Runnable toRun, Subsystem... requirements) {
- return whenInactive(new InstantCommand(toRun, requirements));
- }
-
- /**
- * Toggles a command when the trigger becomes active.
- *
- * @param command the command to toggle
- * @return this trigger, so calls can be chained
- * @deprecated Use {@link #toggleOnTrue(Command)} instead.
- */
- @Deprecated
- public Trigger toggleWhenActive(final Command command) {
- requireNonNullParam(command, "command", "toggleWhenActive");
-
- m_loop.bind(
- new Runnable() {
- private boolean m_pressedLast = m_condition.getAsBoolean();
-
- @Override
- public void run() {
- boolean pressed = m_condition.getAsBoolean();
-
- if (!m_pressedLast && pressed) {
- if (command.isScheduled()) {
- command.cancel();
- } else {
- command.schedule();
- }
- }
-
- m_pressedLast = pressed;
- }
- });
-
- return this;
- }
-
- /**
- * Cancels a command when the trigger becomes active.
- *
- * @param command the command to cancel
- * @return this trigger, so calls can be chained
- * @deprecated Instead, pass this as an end condition to {@link Command#until(BooleanSupplier)}.
- */
- @Deprecated
- public Trigger cancelWhenActive(final Command command) {
- requireNonNullParam(command, "command", "cancelWhenActive");
-
- m_loop.bind(
- new Runnable() {
- private boolean m_pressedLast = m_condition.getAsBoolean();
-
- @Override
- public void run() {
- boolean pressed = m_condition.getAsBoolean();
-
- if (!m_pressedLast && pressed) {
- command.cancel();
- }
-
- m_pressedLast = pressed;
- }
- });
-
- return this;
- }
-
@Override
public boolean getAsBoolean() {
return m_condition.getAsBoolean();
diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp
index f802915359..87494d77cd 100644
--- a/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp
+++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp
@@ -11,7 +11,6 @@
#include "frc2/command/ParallelCommandGroup.h"
#include "frc2/command/ParallelDeadlineGroup.h"
#include "frc2/command/ParallelRaceGroup.h"
-#include "frc2/command/PerpetualCommand.h"
#include "frc2/command/RepeatCommand.h"
#include "frc2/command/SequentialCommandGroup.h"
#include "frc2/command/WaitCommand.h"
@@ -54,10 +53,6 @@ CommandPtr Command::WithInterruptBehavior(
return std::move(*this).ToPtr().WithInterruptBehavior(interruptBehavior);
}
-CommandPtr Command::WithInterrupt(std::function condition) && {
- return std::move(*this).ToPtr().Until(std::move(condition));
-}
-
CommandPtr Command::BeforeStarting(
std::function toRun,
std::initializer_list requirements) && {
@@ -82,12 +77,6 @@ CommandPtr Command::AndThen(std::function toRun,
return std::move(*this).ToPtr().AndThen(std::move(toRun), requirements);
}
-PerpetualCommand Command::Perpetually() && {
- WPI_IGNORE_DEPRECATED
- return PerpetualCommand(std::move(*this).TransferOwnership());
- WPI_UNIGNORE_DEPRECATED
-}
-
CommandPtr Command::Repeatedly() && {
return std::move(*this).ToPtr().Repeatedly();
}
@@ -150,14 +139,6 @@ void Command::SetComposed(bool isComposed) {
m_isComposed = isComposed;
}
-bool Command::IsGrouped() const {
- return IsComposed();
-}
-
-void Command::SetGrouped(bool grouped) {
- SetComposed(grouped);
-}
-
namespace frc2 {
bool RequirementsDisjoint(Command* first, Command* second) {
bool disjoint = true;
diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandGroupBase.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandGroupBase.cpp
deleted file mode 100644
index eb9c293e4d..0000000000
--- a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandGroupBase.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-#include "frc2/command/CommandGroupBase.h"
-
-using namespace frc2;
diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp
index 70443f497d..6d3256d4b7 100644
--- a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp
+++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp
@@ -107,10 +107,6 @@ frc::EventLoop* CommandScheduler::GetDefaultButtonLoop() const {
return &(m_impl->defaultButtonLoop);
}
-void CommandScheduler::ClearButtons() {
- m_impl->activeButtonLoop->Clear();
-}
-
void CommandScheduler::Schedule(Command* command) {
if (m_impl->inRunLoop) {
m_impl->toSchedule.emplace_back(command);
diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/PerpetualCommand.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/PerpetualCommand.cpp
deleted file mode 100644
index 2d0af1e153..0000000000
--- a/wpilibNewCommands/src/main/native/cpp/frc2/command/PerpetualCommand.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-#include "frc2/command/PerpetualCommand.h"
-
-using namespace frc2;
-
-PerpetualCommand::PerpetualCommand(std::unique_ptr&& command) {
- CommandScheduler::GetInstance().RequireUngrouped(command.get());
- m_command = std::move(command);
- m_command->SetComposed(true);
- AddRequirements(m_command->GetRequirements());
-}
-
-void PerpetualCommand::Initialize() {
- m_command->Initialize();
-}
-
-void PerpetualCommand::Execute() {
- m_command->Execute();
-}
-
-void PerpetualCommand::End(bool interrupted) {
- m_command->End(interrupted);
-}
diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/ProxyScheduleCommand.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/ProxyScheduleCommand.cpp
deleted file mode 100644
index dd0e2a7b3d..0000000000
--- a/wpilibNewCommands/src/main/native/cpp/frc2/command/ProxyScheduleCommand.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-#include "frc2/command/ProxyScheduleCommand.h"
-
-using namespace frc2;
-
-ProxyScheduleCommand::ProxyScheduleCommand(
- std::span toSchedule) {
- SetInsert(m_toSchedule, toSchedule);
-}
-
-ProxyScheduleCommand::ProxyScheduleCommand(Command* toSchedule) {
- SetInsert(m_toSchedule, {&toSchedule, 1});
-}
-
-void ProxyScheduleCommand::Initialize() {
- for (auto* command : m_toSchedule) {
- command->Schedule();
- }
-}
-
-void ProxyScheduleCommand::End(bool interrupted) {
- if (interrupted) {
- for (auto* command : m_toSchedule) {
- command->Cancel();
- }
- }
-}
-
-void ProxyScheduleCommand::Execute() {
- m_finished = true;
- for (auto* command : m_toSchedule) {
- m_finished &= !command->IsScheduled();
- }
-}
-
-bool ProxyScheduleCommand::IsFinished() {
- return m_finished;
-}
diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/button/Button.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/button/Button.cpp
deleted file mode 100644
index fdb64599d4..0000000000
--- a/wpilibNewCommands/src/main/native/cpp/frc2/command/button/Button.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-#include "frc2/command/button/Button.h"
-
-#include
-
-using namespace frc2;
-
-Button::Button(std::function isPressed) : Trigger(isPressed) {}
-
-Button Button::WhenPressed(Command* command) {
- WPI_IGNORE_DEPRECATED
- WhenActive(command);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::WhenPressed(std::function toRun,
- std::initializer_list requirements) {
- WPI_IGNORE_DEPRECATED
- WhenActive(std::move(toRun), requirements);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::WhenPressed(std::function toRun,
- std::span requirements) {
- WPI_IGNORE_DEPRECATED
- WhenActive(std::move(toRun), requirements);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::WhileHeld(Command* command) {
- WPI_IGNORE_DEPRECATED
- WhileActiveContinous(command);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::WhileHeld(std::function toRun,
- std::initializer_list requirements) {
- WPI_IGNORE_DEPRECATED
- WhileActiveContinous(std::move(toRun), requirements);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::WhileHeld(std::function toRun,
- std::span requirements) {
- WPI_IGNORE_DEPRECATED
- WhileActiveContinous(std::move(toRun), requirements);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::WhenHeld(Command* command) {
- WPI_IGNORE_DEPRECATED
- WhileActiveOnce(command);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::WhenReleased(Command* command) {
- WPI_IGNORE_DEPRECATED
- WhenInactive(command);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::WhenReleased(std::function toRun,
- std::initializer_list requirements) {
- WPI_IGNORE_DEPRECATED
- WhenInactive(std::move(toRun), requirements);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::WhenReleased(std::function toRun,
- std::span requirements) {
- WPI_IGNORE_DEPRECATED
- WhenInactive(std::move(toRun), requirements);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::ToggleWhenPressed(Command* command) {
- WPI_IGNORE_DEPRECATED
- ToggleWhenActive(command);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
-
-Button Button::CancelWhenPressed(Command* command) {
- WPI_IGNORE_DEPRECATED
- CancelWhenActive(command);
- WPI_UNIGNORE_DEPRECATED
- return *this;
-}
diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/button/NetworkButton.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/button/NetworkButton.cpp
index e26cd1477c..a0923a3ba5 100644
--- a/wpilibNewCommands/src/main/native/cpp/frc2/command/button/NetworkButton.cpp
+++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/button/NetworkButton.cpp
@@ -4,19 +4,15 @@
#include "frc2/command/button/NetworkButton.h"
-#include
-
using namespace frc2;
-WPI_IGNORE_DEPRECATED
NetworkButton::NetworkButton(nt::BooleanTopic topic)
: NetworkButton(topic.Subscribe(false)) {}
NetworkButton::NetworkButton(nt::BooleanSubscriber sub)
- : Button([sub = std::make_shared(std::move(sub))] {
+ : Trigger([sub = std::make_shared(std::move(sub))] {
return sub->GetTopic().GetInstance().IsConnected() && sub->Get();
}) {}
-WPI_UNIGNORE_DEPRECATED
NetworkButton::NetworkButton(std::shared_ptr table,
std::string_view field)
diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/button/Trigger.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/button/Trigger.cpp
index 5b0b36efce..38ec741e47 100644
--- a/wpilibNewCommands/src/main/native/cpp/frc2/command/button/Trigger.cpp
+++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/button/Trigger.cpp
@@ -5,7 +5,6 @@
#include "frc2/command/button/Trigger.h"
#include
-#include
#include "frc2/command/InstantCommand.h"
@@ -206,124 +205,6 @@ Trigger Trigger::ToggleOnFalse(CommandPtr&& command) {
return *this;
}
-WPI_IGNORE_DEPRECATED
-Trigger Trigger::WhenActive(Command* command) {
- return OnTrue(command);
-}
-
-Trigger Trigger::WhenActive(std::function toRun,
- std::initializer_list requirements) {
- return WhenActive(std::move(toRun),
- {requirements.begin(), requirements.end()});
-}
-
-Trigger Trigger::WhenActive(std::function toRun,
- std::span requirements) {
- return WhenActive(InstantCommand(std::move(toRun), requirements));
-}
-
-Trigger Trigger::WhileActiveContinous(Command* command) {
- m_loop->Bind([condition = m_condition, previous = m_condition(),
- command = std::move(command)]() mutable {
- bool current = condition();
-
- if (current) {
- command->Schedule();
- } else if (previous && !current) {
- command->Cancel();
- }
-
- previous = current;
- });
- return *this;
-}
-
-Trigger Trigger::WhileActiveContinous(
- std::function toRun,
- std::initializer_list requirements) {
- return WhileActiveContinous(std::move(toRun),
- {requirements.begin(), requirements.end()});
-}
-
-Trigger Trigger::WhileActiveContinous(
- std::function toRun, std::span requirements) {
- return WhileActiveContinous(InstantCommand(std::move(toRun), requirements));
-}
-
-Trigger Trigger::WhileActiveOnce(Command* command) {
- m_loop->Bind(
- [condition = m_condition, previous = m_condition(), command]() mutable {
- bool current = condition();
-
- if (!previous && current) {
- command->Schedule();
- } else if (previous && !current) {
- command->Cancel();
- }
-
- previous = current;
- });
- return *this;
-}
-
-Trigger Trigger::WhenInactive(Command* command) {
- m_loop->Bind(
- [condition = m_condition, previous = m_condition(), command]() mutable {
- bool current = condition();
-
- if (previous && !current) {
- command->Schedule();
- }
-
- previous = current;
- });
- return *this;
-}
-
-Trigger Trigger::WhenInactive(std::function toRun,
- std::initializer_list requirements) {
- return WhenInactive(std::move(toRun),
- {requirements.begin(), requirements.end()});
-}
-
-Trigger Trigger::WhenInactive(std::function toRun,
- std::span requirements) {
- return WhenInactive(InstantCommand(std::move(toRun), requirements));
-}
-
-Trigger Trigger::ToggleWhenActive(Command* command) {
- m_loop->Bind([condition = m_condition, previous = m_condition(),
- command = command]() mutable {
- bool current = condition();
-
- if (!previous && current) {
- if (command->IsScheduled()) {
- command->Cancel();
- } else {
- command->Schedule();
- }
- }
-
- previous = current;
- });
- return *this;
-}
-
-Trigger Trigger::CancelWhenActive(Command* command) {
- m_loop->Bind([condition = m_condition, previous = m_condition(),
- command = std::move(command)]() mutable {
- bool current = condition();
-
- if (!previous && current) {
- command->Cancel();
- }
-
- previous = current;
- });
- return *this;
-}
-WPI_UNIGNORE_DEPRECATED
-
Trigger Trigger::Debounce(units::second_t debounceTime,
frc::Debouncer::DebounceType type) {
return Trigger(m_loop, [debouncer = frc::Debouncer(debounceTime, type),
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h
index 9d33028816..8f608d5ba9 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h
@@ -23,8 +23,6 @@ std::string GetTypeName(const T& type) {
return wpi::Demangle(typeid(type).name());
}
-class PerpetualCommand;
-
/**
* A state machine representing a complete action to be performed by the robot.
* Commands are run by the CommandScheduler, and can be composed into
@@ -147,18 +145,6 @@ class Command {
[[nodiscard]]
CommandPtr OnlyWhile(std::function condition) &&;
- /**
- * Decorates this command with an interrupt condition. If the specified
- * condition becomes true before the command finishes normally, the command
- * will be interrupted and un-scheduled.
- *
- * @param condition the interrupt condition
- * @return the command with the interrupt condition added
- * @deprecated Replace with Until()
- */
- [[deprecated("Replace with Until()")]] [[nodiscard]]
- CommandPtr WithInterrupt(std::function condition) &&;
-
/**
* Decorates this command with a runnable to run before this command starts.
*
@@ -203,26 +189,6 @@ class Command {
CommandPtr AndThen(std::function toRun,
std::span requirements = {}) &&;
- /**
- * Decorates this command to run perpetually, ignoring its ordinary end
- * conditions. The decorated command can still be interrupted or canceled.
- *
- * @return the decorated command
- * @deprecated PerpetualCommand violates the assumption that execute() doesn't
-get called after isFinished() returns true -- an assumption that should be
-valid. This was unsafe/undefined behavior from the start, and RepeatCommand
-provides an easy way to achieve similar end results with slightly different (and
-safe) semantics.
- */
- [[deprecated(
- "PerpetualCommand violates the assumption that execute() doesn't get "
- "called after isFinished() returns true -- an assumption that should be "
- "valid."
- "This was unsafe/undefined behavior from the start, and RepeatCommand "
- "provides an easy way to achieve similar end results with slightly "
- "different (and safe) semantics.")]]
- PerpetualCommand Perpetually() &&;
-
/**
* Decorates this command to run repeatedly, restarting it when it ends, until
* this command is interrupted. The decorated command can still be canceled.
@@ -361,25 +327,6 @@ safe) semantics.
*/
void SetComposed(bool isComposed);
- /**
- * Whether the command is currently grouped in a command group. Used as extra
- * insurance to prevent accidental independent use of grouped commands.
- *
- * @deprecated Moved to IsComposed()
- */
- [[deprecated("Moved to IsComposed()")]]
- bool IsGrouped() const;
-
- /**
- * Sets whether the command is currently grouped in a command group. Can be
- * used to "reclaim" a command if a group is no longer going to use it. NOT
- * ADVISED!
- *
- * @deprecated Moved to SetComposed()
- */
- [[deprecated("Moved to SetComposed()")]]
- void SetGrouped(bool grouped);
-
/**
* Whether the given command should run when the robot is disabled. Override
* to return true if the command should run when disabled.
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandGroupBase.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandGroupBase.h
deleted file mode 100644
index e607bf139a..0000000000
--- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandGroupBase.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-#pragma once
-
-#include
-#include
-
-#include "frc2/command/CommandBase.h"
-
-namespace frc2 {
-
-/**
- * A base for CommandGroups.
- *
- * This class is provided by the NewCommands VendorDep
- * @deprecated This class is an empty abstraction. Inherit directly from
- * CommandBase.
- */
-class CommandGroupBase : public CommandBase {
- public:
- /**
- * Adds the given commands to the command group.
- *
- * @param commands The commands to add.
- */
- virtual void AddCommands(
- std::vector>&& commands) = 0;
-};
-} // namespace frc2
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h
index cd9579c472..4b65f30812 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h
@@ -77,12 +77,6 @@ class CommandScheduler final : public nt::NTSendable,
*/
frc::EventLoop* GetDefaultButtonLoop() const;
- /**
- * Removes all button bindings from the scheduler.
- */
- [[deprecated("Call Clear on the EventLoop instance directly!")]]
- void ClearButtons();
-
/**
* Schedules a command for execution. Does nothing if the command is already
* scheduled. If a command's requirements are not available, it will only be
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/ParallelCommandGroup.h b/wpilibNewCommands/src/main/native/include/frc2/command/ParallelCommandGroup.h
index f5adc60806..2fe6f937ab 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/ParallelCommandGroup.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/ParallelCommandGroup.h
@@ -17,7 +17,7 @@
#include
-#include "frc2/command/CommandGroupBase.h"
+#include "frc2/command/CommandBase.h"
#include "frc2/command/CommandHelper.h"
namespace frc2 {
@@ -33,7 +33,7 @@ namespace frc2 {
* This class is provided by the NewCommands VendorDep
*/
class ParallelCommandGroup
- : public CommandHelper {
+ : public CommandHelper {
public:
/**
* Creates a new ParallelCommandGroup. The given commands will be executed
@@ -67,6 +67,11 @@ class ParallelCommandGroup
// Prevent template expansion from emulating copy ctor
ParallelCommandGroup(ParallelCommandGroup&) = delete;
+ /**
+ * Adds the given commands to the group.
+ *
+ * @param commands Commands to add to the group.
+ */
template ... Commands>
void AddCommands(Commands&&... commands) {
std::vector> foo;
@@ -89,7 +94,7 @@ class ParallelCommandGroup
Command::InterruptionBehavior GetInterruptionBehavior() const override;
private:
- void AddCommands(std::vector>&& commands) final;
+ void AddCommands(std::vector>&& commands);
std::vector, bool>> m_commands;
bool m_runWhenDisabled{true};
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/ParallelDeadlineGroup.h b/wpilibNewCommands/src/main/native/include/frc2/command/ParallelDeadlineGroup.h
index cbf675b78a..adb29db57f 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/ParallelDeadlineGroup.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/ParallelDeadlineGroup.h
@@ -17,7 +17,7 @@
#include
-#include "frc2/command/CommandGroupBase.h"
+#include "frc2/command/CommandBase.h"
#include "frc2/command/CommandHelper.h"
namespace frc2 {
@@ -34,7 +34,7 @@ namespace frc2 {
* This class is provided by the NewCommands VendorDep
*/
class ParallelDeadlineGroup
- : public CommandHelper {
+ : public CommandHelper {
public:
/**
* Creates a new ParallelDeadlineGroup. The given commands (including the
@@ -73,6 +73,11 @@ class ParallelDeadlineGroup
// Prevent template expansion from emulating copy ctor
ParallelDeadlineGroup(ParallelDeadlineGroup&) = delete;
+ /**
+ * Adds the given commands to the group.
+ *
+ * @param commands Commands to add to the group.
+ */
template ... Commands>
void AddCommands(Commands&&... commands) {
std::vector> foo;
@@ -97,7 +102,7 @@ class ParallelDeadlineGroup
void InitSendable(wpi::SendableBuilder& builder) override;
private:
- void AddCommands(std::vector>&& commands) final;
+ void AddCommands(std::vector>&& commands);
void SetDeadline(std::unique_ptr&& deadline);
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/ParallelRaceGroup.h b/wpilibNewCommands/src/main/native/include/frc2/command/ParallelRaceGroup.h
index 187765333f..4a760a0c9e 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/ParallelRaceGroup.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/ParallelRaceGroup.h
@@ -17,7 +17,7 @@
#include
-#include "frc2/command/CommandGroupBase.h"
+#include "frc2/command/CommandBase.h"
#include "frc2/command/CommandHelper.h"
namespace frc2 {
@@ -32,8 +32,7 @@ namespace frc2 {
*
* This class is provided by the NewCommands VendorDep
*/
-class ParallelRaceGroup
- : public CommandHelper {
+class ParallelRaceGroup : public CommandHelper {
public:
/**
* Creates a new ParallelCommandRace. The given commands will be executed
@@ -57,6 +56,11 @@ class ParallelRaceGroup
// Prevent template expansion from emulating copy ctor
ParallelRaceGroup(ParallelRaceGroup&) = delete;
+ /**
+ * Adds the given commands to the group.
+ *
+ * @param commands Commands to add to the group.
+ */
template ... Commands>
void AddCommands(Commands&&... commands) {
std::vector> foo;
@@ -79,7 +83,7 @@ class ParallelRaceGroup
Command::InterruptionBehavior GetInterruptionBehavior() const override;
private:
- void AddCommands(std::vector>&& commands) final;
+ void AddCommands(std::vector>&& commands);
std::vector> m_commands;
bool m_runWhenDisabled{true};
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/PerpetualCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/PerpetualCommand.h
deleted file mode 100644
index e377703481..0000000000
--- a/wpilibNewCommands/src/main/native/include/frc2/command/PerpetualCommand.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-#pragma once
-
-#ifdef _WIN32
-#pragma warning(push)
-#pragma warning(disable : 4521)
-#endif
-
-#include
-#include
-#include
-
-#include
-
-#include "frc2/command/CommandBase.h"
-#include "frc2/command/CommandHelper.h"
-
-namespace frc2 {
-/**
- * A command that runs another command in perpetuity, ignoring that command's
- * end conditions. While this class does not extend frc2::CommandGroupBase,
- * it is still considered a CommandGroup, as it allows one to compose another
- * command within it; the command instances that are passed to it cannot be
- * added to any other groups, or scheduled individually.
- *
- * As a rule, CommandGroups require the union of the requirements of their
- * component commands.
- *
- * This class is provided by the NewCommands VendorDep
- *
- * @deprecated PerpetualCommand violates the assumption that execute() doesn't
-get called after isFinished() returns true -- an assumption that should be
-valid. This was unsafe/undefined behavior from the start, and RepeatCommand
-provides an easy way to achieve similar end results with slightly different (and
-safe) semantics.
- */
-class PerpetualCommand : public CommandHelper {
- public:
- /**
- * Creates a new PerpetualCommand. Will run another command in perpetuity,
- * ignoring that command's end conditions, unless this command itself is
- * interrupted.
- *
- * @param command the command to run perpetually
- */
- WPI_DEPRECATED(
- "PerpetualCommand violates the assumption that execute() doesn't get "
- "called after isFinished() returns true -- an assumption that should be "
- "valid. This was unsafe/undefined behavior from the start, and "
- "RepeatCommand provides an easy way to achieve similar end results with "
- "slightly different (and safe) semantics.")
- explicit PerpetualCommand(std::unique_ptr&& command);
- WPI_IGNORE_DEPRECATED
-
- /**
- * Creates a new PerpetualCommand. Will run another command in perpetuity,
- * ignoring that command's end conditions, unless this command itself is
- * interrupted.
- *
- * @param command the command to run perpetually
- */
- template T>
- WPI_DEPRECATED(
- "PerpetualCommand violates the assumption that execute() doesn't get "
- "called after isFinished() returns true -- an assumption that should "
- "be valid. This was unsafe/undefined behavior from the start, and "
- "RepeatCommand provides an easy way to achieve similar end results "
- "with slightly different (and safe) semantics.")
- // NOLINTNEXTLINE(bugprone-forwarding-reference-overload)
- explicit PerpetualCommand(T&& command)
- : PerpetualCommand(
- std::make_unique>(std::forward(command))) {}
- WPI_UNIGNORE_DEPRECATED
-
- PerpetualCommand(PerpetualCommand&& other) = default;
-
- // No copy constructors for command groups
- PerpetualCommand(const PerpetualCommand& other) = delete;
-
- // Prevent template expansion from emulating copy ctor
- PerpetualCommand(PerpetualCommand&) = delete;
-
- void Initialize() override;
-
- void Execute() override;
-
- void End(bool interrupted) override;
-
- private:
- std::unique_ptr m_command;
-};
-} // namespace frc2
-
-#ifdef _WIN32
-#pragma warning(pop)
-#endif
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/ProxyScheduleCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/ProxyScheduleCommand.h
deleted file mode 100644
index f79b5492c7..0000000000
--- a/wpilibNewCommands/src/main/native/include/frc2/command/ProxyScheduleCommand.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-#pragma once
-
-#include
-#include
-
-#include
-#include
-
-#include "frc2/command/CommandBase.h"
-#include "frc2/command/CommandHelper.h"
-#include "frc2/command/SetUtilities.h"
-
-namespace frc2 {
-/**
- * Schedules the given commands when this command is initialized, and ends when
- * all the commands are no longer scheduled. Useful for forking off from
- * CommandGroups. If this command is interrupted, it will cancel all of the
- * commands.
- *
- * This class is provided by the NewCommands VendorDep
- */
-class ProxyScheduleCommand
- : public CommandHelper {
- public:
- /**
- * Creates a new ProxyScheduleCommand that schedules the given commands when
- * initialized, and ends when they are all no longer scheduled.
- *
- * @param toSchedule the commands to schedule
- * @deprecated Replace with {@link ProxyCommand},
- * composing multiple of them in a {@link ParallelRaceGroup} if needed.
- */
- WPI_DEPRECATED("Replace with ProxyCommand")
- explicit ProxyScheduleCommand(std::span toSchedule);
-
- explicit ProxyScheduleCommand(Command* toSchedule);
-
- ProxyScheduleCommand(ProxyScheduleCommand&& other) = default;
-
- void Initialize() override;
-
- void End(bool interrupted) override;
-
- void Execute() override;
-
- bool IsFinished() override;
-
- private:
- wpi::SmallVector m_toSchedule;
- std::unique_ptr m_owning;
- bool m_finished{false};
-};
-} // namespace frc2
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h
index eed41c9b57..b4548e5ac3 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h
@@ -16,7 +16,6 @@
#include
#include
-#include
#include
#include "frc2/command/CommandBase.h"
@@ -95,17 +94,6 @@ class SelectCommand : public CommandHelper> {
// Prevent template expansion from emulating copy ctor
SelectCommand(SelectCommand&) = delete;
- /**
- * Creates a new selectcommand.
- *
- * @param toRun a supplier providing the command to run
- * @deprecated Replace with {@link ProxyCommand},
- * composing multiple of them in a {@link ParallelRaceGroup} if needed.
- */
- WPI_DEPRECATED("Replace with ProxyCommand")
- explicit SelectCommand(std::function toRun)
- : m_toRun{std::move(toRun)} {}
-
SelectCommand(SelectCommand&& other) = default;
void Initialize() override;
@@ -147,7 +135,6 @@ class SelectCommand : public CommandHelper> {
private:
std::unordered_map> m_commands;
std::function m_selector;
- std::function m_toRun;
Command* m_selectedCommand;
bool m_runsWhenDisabled = true;
Command::InterruptionBehavior m_interruptBehavior{
@@ -156,16 +143,12 @@ class SelectCommand : public CommandHelper> {
template
void SelectCommand::Initialize() {
- if (m_selector) {
- auto find = m_commands.find(m_selector());
- if (find == m_commands.end()) {
- m_selectedCommand = new PrintCommand(
- "SelectCommand selector value does not correspond to any command!");
- return;
- }
- m_selectedCommand = find->second.get();
+ auto find = m_commands.find(m_selector());
+ if (find == m_commands.end()) {
+ m_selectedCommand = new PrintCommand(
+ "SelectCommand selector value does not correspond to any command!");
} else {
- m_selectedCommand = m_toRun();
+ m_selectedCommand = find->second.get();
}
m_selectedCommand->Initialize();
}
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/SequentialCommandGroup.h b/wpilibNewCommands/src/main/native/include/frc2/command/SequentialCommandGroup.h
index 1904dacd26..a0da1b34be 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/SequentialCommandGroup.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/SequentialCommandGroup.h
@@ -19,7 +19,7 @@
#include
-#include "frc2/command/CommandGroupBase.h"
+#include "frc2/command/CommandBase.h"
#include "frc2/command/CommandHelper.h"
namespace frc2 {
@@ -37,7 +37,7 @@ const size_t invalid_index = std::numeric_limits::max();
* This class is provided by the NewCommands VendorDep
*/
class SequentialCommandGroup
- : public CommandHelper {
+ : public CommandHelper {
public:
/**
* Creates a new SequentialCommandGroup. The given commands will be run
@@ -69,6 +69,11 @@ class SequentialCommandGroup
// Prevent template expansion from emulating copy ctor
SequentialCommandGroup(SequentialCommandGroup&) = delete;
+ /**
+ * Adds the given commands to the group.
+ *
+ * @param commands Commands to add, in order of execution.
+ */
template ... Commands>
void AddCommands(Commands&&... commands) {
std::vector> foo;
@@ -93,7 +98,7 @@ class SequentialCommandGroup
void InitSendable(wpi::SendableBuilder& builder) override;
private:
- void AddCommands(std::vector>&& commands) final;
+ void AddCommands(std::vector>&& commands);
wpi::SmallVector, 4> m_commands;
size_t m_currentCommandIndex{invalid_index};
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/button/Button.h b/wpilibNewCommands/src/main/native/include/frc2/command/button/Button.h
deleted file mode 100644
index a71238061f..0000000000
--- a/wpilibNewCommands/src/main/native/include/frc2/command/button/Button.h
+++ /dev/null
@@ -1,269 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include "Trigger.h"
-#include "frc2/command/CommandPtr.h"
-
-namespace frc2 {
-class Command;
-/**
- * A class used to bind command scheduling to button presses. Can be composed
- * with other buttons with the operators in Trigger.
- *
- * This class is provided by the NewCommands VendorDep
- *
- * @see Trigger
- */
-class Button : public Trigger {
- public:
- /**
- * Create a new button that is pressed when the given condition is true.
- *
- * @param isPressed Whether the button is pressed.
- * @deprecated Replace with Trigger
- */
- WPI_DEPRECATED("Replace with Trigger")
- explicit Button(std::function isPressed);
-
- /**
- * Create a new button that is pressed active (default constructor) - activity
- * can be further determined by subclass code.
- * @deprecated Replace with Trigger
- */
- [[deprecated("Replace with Trigger")]] Button() = default;
-
- /**
- * Binds a command to start when the button is pressed. Takes a
- * raw pointer, and so is non-owning; users are responsible for the lifespan
- * of the command.
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Replace with Trigger::OnTrue()
- */
- [[deprecated("Replace with Trigger#OnTrue()")]]
- Button WhenPressed(Command* command);
-
- /**
- * Binds a command to start when the button is pressed. Transfers
- * command ownership to the button scheduler, so the user does not have to
- * worry about lifespan - rvalue refs will be *moved*, lvalue refs will be
- * *copied.*
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Replace with Trigger::OnTrue()
- */
- template T>
- [[deprecated("Replace with Trigger#OnTrue()")]]
- Button WhenPressed(T&& command) {
- WhenActive(std::forward(command));
- return *this;
- }
-
- /**
- * Binds a runnable to execute when the button is pressed.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Replace with Trigger::OnTrue(cmd::RunOnce())
- */
- [[deprecated("Replace with Trigger#OnTrue(cmd::RunOnce())")]]
- Button WhenPressed(std::function toRun,
- std::initializer_list requirements);
-
- /**
- * Binds a runnable to execute when the button is pressed.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Replace with Trigger::OnTrue(cmd::RunOnce())
- */
- [[deprecated("Replace with Trigger#OnTrue(cmd::RunOnce())")]]
- Button WhenPressed(std::function toRun,
- std::span requirements = {});
-
- /**
- * Binds a command to be started repeatedly while the button is pressed, and
- * canceled when it is released. Takes a raw pointer, and so is non-owning;
- * users are responsible for the lifespan of the command.
- *
- * @param command The command to bind.
- * @return The button, for chained calls.
- * @deprecated Replace with Trigger::WhileTrue(command.Repeatedly())
- */
- [[deprecated("Replace with Trigger#WhileTrue(command.Repeatedly())")]]
- Button WhileHeld(Command* command);
-
- /**
- * Binds a command to be started repeatedly while the button is pressed, and
- * canceled when it is released. Transfers command ownership to the button
- * scheduler, so the user does not have to worry about lifespan - rvalue refs
- * will be *moved*, lvalue refs will be *copied.*
- *
- * @param command The command to bind.
- * @return The button, for chained calls.
- * @deprecated Replace with Trigger::WhileTrue(command.Repeatedly())
- */
- template T>
- [[deprecated("Replace with Trigger#WhileTrue(command.Repeatedly())")]]
- Button WhileHeld(T&& command) {
- WhileActiveContinous(std::forward(command));
- return *this;
- }
-
- /**
- * Binds a runnable to execute repeatedly while the button is pressed.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Replace with Trigger::WhileTrue(cmd::Run())
- */
- [[deprecated("Replace with Trigger#WhileTrue(cmd::Run())")]]
- Button WhileHeld(std::function toRun,
- std::initializer_list requirements);
-
- /**
- * Binds a runnable to execute repeatedly while the button is pressed.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Replace with Trigger::WhileTrue(cmd::Run())
- */
- [[deprecated("Replace with Trigger#WhileTrue(cmd::Run())")]]
- Button WhileHeld(std::function toRun,
- std::span requirements = {});
-
- /**
- * Binds a command to be started when the button is pressed, and canceled
- * when it is released. Takes a raw pointer, and so is non-owning; users are
- * responsible for the lifespan of the command.
- *
- * @param command The command to bind.
- * @return The button, for chained calls.
- * @deprecated Replace with Trigger::WhileTrue()
- */
- [[deprecated("Replace with Trigger#WhileTrue()")]]
- Button WhenHeld(Command* command);
-
- /**
- * Binds a command to be started when the button is pressed, and canceled
- * when it is released. Transfers command ownership to the button scheduler,
- * so the user does not have to worry about lifespan - rvalue refs will be
- * *moved*, lvalue refs will be *copied.*
- *
- * @param command The command to bind.
- * @return The button, for chained calls.
- * @deprecated Replace with Trigger::WhileTrue()
- */
- template T>
- [[deprecated("Replace with Trigger#WhileTrue()")]]
- Button WhenHeld(T&& command) {
- WhileActiveOnce(std::forward(command));
- return *this;
- }
-
- /**
- * Binds a command to start when the button is released. Takes a
- * raw pointer, and so is non-owning; users are responsible for the lifespan
- * of the command.
- *
- * @param command The command to bind.
- * @return The button, for chained calls.
- * @deprecated Replace with Trigger::OnFalse()
- */
- [[deprecated("Replace with Trigger#OnFalse()")]]
- Button WhenReleased(Command* command);
-
- /**
- * Binds a command to start when the button is pressed. Transfers
- * command ownership to the button scheduler, so the user does not have to
- * worry about lifespan - rvalue refs will be *moved*, lvalue refs will be
- * *copied.*
- *
- * @param command The command to bind.
- * @return The button, for chained calls.
- * @deprecated Replace with Trigger::OnFalse()
- */
- template T>
- [[deprecated("Replace with Trigger#OnFalse()")]]
- Button WhenReleased(T&& command) {
- WhenInactive(std::forward(command));
- return *this;
- }
-
- /**
- * Binds a runnable to execute when the button is released.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Replace with Trigger::OnFalse(cmd::RunOnce())
- */
- [[deprecated("Replace with Trigger#OnFalse(cmd::RunOnce())")]]
- Button WhenReleased(std::function toRun,
- std::initializer_list requirements);
-
- /**
- * Binds a runnable to execute when the button is released.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Replace with Trigger::OnFalse(cmd::RunOnce())
- */
- [[deprecated("Replace with Trigger#OnFalse(cmd::RunOnce())")]]
- Button WhenReleased(std::function toRun,
- std::span requirements = {});
-
- /**
- * Binds a command to start when the button is pressed, and be canceled when
- * it is pressed again. Takes a raw pointer, and so is non-owning; users are
- * responsible for the lifespan of the command.
- *
- * @param command The command to bind.
- * @return The button, for chained calls.
- * @deprecated Replace with Trigger::ToggleOnTrue()
- */
- [[deprecated("Replace with Trigger#ToggleOnTrue()")]]
- Button ToggleWhenPressed(Command* command);
-
- /**
- * Binds a command to start when the button is pressed, and be canceled when
- * it is pressed again. Transfers command ownership to the button scheduler,
- * so the user does not have to worry about lifespan - rvalue refs will be
- * *moved*, lvalue refs will be *copied.*
- *
- * @param command The command to bind.
- * @return The button, for chained calls.
- * @deprecated Replace with Trigger::ToggleOnTrue()
- */
- template T>
- [[deprecated("Replace with Trigger#ToggleOnTrue()")]]
- Button ToggleWhenPressed(T&& command) {
- ToggleWhenActive(std::forward(command));
- return *this;
- }
-
- /**
- * Binds a command to be canceled when the button is pressed. Takes a
- * raw pointer, and so is non-owning; users are responsible for the lifespan
- * and scheduling of the command.
- *
- * @param command The command to bind.
- * @return The button, for chained calls.
- * @deprecated Pass this as a command end condition with Until() instead.
- */
- [[deprecated("Pass this as a command end condition with Until() instead.")]]
- Button CancelWhenPressed(Command* command);
-};
-} // namespace frc2
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/button/JoystickButton.h b/wpilibNewCommands/src/main/native/include/frc2/command/button/JoystickButton.h
index b5280c062c..a0d04e79bc 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/button/JoystickButton.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/button/JoystickButton.h
@@ -4,9 +4,8 @@
#pragma once
#include
-#include
-#include "Button.h"
+#include "Trigger.h"
namespace frc2 {
/**
@@ -17,7 +16,7 @@ namespace frc2 {
*
* @see Trigger
*/
-class JoystickButton : public Button {
+class JoystickButton : public Trigger {
public:
/**
* Creates a JoystickButton that commands can be bound to.
@@ -25,11 +24,9 @@ class JoystickButton : public Button {
* @param joystick The joystick on which the button is located.
* @param buttonNumber The number of the button on the joystick.
*/
- WPI_IGNORE_DEPRECATED
explicit JoystickButton(frc::GenericHID* joystick, int buttonNumber)
- : Button([joystick, buttonNumber] {
+ : Trigger([joystick, buttonNumber] {
return joystick->GetRawButton(buttonNumber);
}) {}
- WPI_UNIGNORE_DEPRECATED
};
} // namespace frc2
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/button/NetworkButton.h b/wpilibNewCommands/src/main/native/include/frc2/command/button/NetworkButton.h
index 3d0378d6bb..673821e698 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/button/NetworkButton.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/button/NetworkButton.h
@@ -11,7 +11,7 @@
#include
#include
-#include "Button.h"
+#include "Trigger.h"
namespace frc2 {
/**
@@ -19,7 +19,7 @@ namespace frc2 {
*
* This class is provided by the NewCommands VendorDep
*/
-class NetworkButton : public Button {
+class NetworkButton : public Trigger {
public:
/**
* Creates a NetworkButton that commands can be bound to.
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/button/POVButton.h b/wpilibNewCommands/src/main/native/include/frc2/command/button/POVButton.h
index 544a3eebf5..00723be7e5 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/button/POVButton.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/button/POVButton.h
@@ -5,9 +5,8 @@
#pragma once
#include
-#include
-#include "Button.h"
+#include "Trigger.h"
namespace frc2 {
/**
@@ -18,7 +17,7 @@ namespace frc2 {
*
* @see Trigger
*/
-class POVButton : public Button {
+class POVButton : public Trigger {
public:
/**
* Creates a POVButton that commands can be bound to.
@@ -27,11 +26,9 @@ class POVButton : public Button {
* @param angle The angle of the POV corresponding to a button press.
* @param povNumber The number of the POV on the joystick.
*/
- WPI_IGNORE_DEPRECATED
POVButton(frc::GenericHID* joystick, int angle, int povNumber = 0)
- : Button([joystick, angle, povNumber] {
+ : Trigger([joystick, angle, povNumber] {
return joystick->GetPOV(povNumber) == angle;
}) {}
- WPI_UNIGNORE_DEPRECATED
};
} // namespace frc2
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/button/Trigger.h b/wpilibNewCommands/src/main/native/include/frc2/command/button/Trigger.h
index 49c46bd186..c4433a5813 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/button/Trigger.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/button/Trigger.h
@@ -204,305 +204,6 @@ class Trigger {
*/
Trigger ToggleOnFalse(CommandPtr&& command);
- /**
- * Binds a command to start when the trigger becomes active. Takes a
- * raw pointer, and so is non-owning; users are responsible for the lifespan
- * of the command.
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use OnTrue(Command) instead
- */
- [[deprecated("Use OnTrue(Command) instead")]]
- Trigger WhenActive(Command* command);
-
- /**
- * Binds a command to start when the trigger becomes active. Transfers
- * command ownership to the button scheduler, so the user does not have to
- * worry about lifespan - rvalue refs will be *moved*, lvalue refs will be
- * *copied.*
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use OnTrue(Command) instead
- */
- template T>
- [[deprecated("Use OnTrue(Command) instead")]]
- Trigger WhenActive(T&& command) {
- m_loop->Bind([condition = m_condition, previous = m_condition(),
- command = std::make_unique>(
- std::forward(command))]() mutable {
- bool current = condition();
-
- if (!previous && current) {
- command->Schedule();
- }
-
- previous = current;
- });
- return *this;
- }
-
- /**
- * Binds a runnable to execute when the trigger becomes active.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Use OnTrue(Command) instead and construct the InstantCommand
- * manually
- */
- [[deprecated(
- "Use OnTrue(Command) instead and construct the InstantCommand manually")]]
- Trigger WhenActive(std::function toRun,
- std::initializer_list requirements);
-
- /**
- * Binds a runnable to execute when the trigger becomes active.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Use OnTrue(Command) instead and construct the InstantCommand
- * manually
- */
- [[deprecated(
- "Use OnTrue(Command) instead and construct the InstantCommand manually")]]
- Trigger WhenActive(std::function toRun,
- std::span requirements = {});
-
- /**
- * Binds a command to be started repeatedly while the trigger is active, and
- * canceled when it becomes inactive. Takes a raw pointer, and so is
- * non-owning; users are responsible for the lifespan of the command.
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use WhileTrue(Command) with RepeatCommand, or bind
- command::Schedule with IfHigh(std::function).
- */
- [[deprecated(
- "Use WhileTrue(Command) with RepeatCommand, or bind command::Schedule "
- "with IfHigh(std::function).")]]
- Trigger WhileActiveContinous(Command* command);
-
- /**
- * Binds a command to be started repeatedly while the trigger is active, and
- * canceled when it becomes inactive. Transfers command ownership to the
- * button scheduler, so the user does not have to worry about lifespan -
- * rvalue refs will be *moved*, lvalue refs will be *copied.*
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use WhileTrue(Command) with RepeatCommand, or bind
- command::Schedule with IfHigh(std::function).
- */
- template T>
- [[deprecated(
- "Use WhileTrue(Command) with RepeatCommand, or bind command::Schedule "
- "with IfHigh(std::function).")]]
- Trigger WhileActiveContinous(T&& command) {
- m_loop->Bind([condition = m_condition, previous = m_condition(),
- command = std::make_unique>(
- std::forward(command))]() mutable {
- bool current = condition();
-
- if (current) {
- command->Schedule();
- } else if (previous && !current) {
- command->Cancel();
- }
-
- previous = current;
- });
-
- return *this;
- }
-
- /**
- * Binds a runnable to execute repeatedly while the trigger is active.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Use WhileTrue(Command) and construct a RunCommand manually
- */
- [[deprecated("Use WhileTrue(Command) and construct a RunCommand manually")]]
- Trigger WhileActiveContinous(std::function toRun,
- std::initializer_list requirements);
-
- /**
- * Binds a runnable to execute repeatedly while the trigger is active.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Use WhileTrue(Command) and construct a RunCommand manually
- */
- [[deprecated("Use WhileTrue(Command) and construct a RunCommand manually")]]
- Trigger WhileActiveContinous(std::function toRun,
- std::span requirements = {});
-
- /**
- * Binds a command to be started when the trigger becomes active, and
- * canceled when it becomes inactive. Takes a raw pointer, and so is
- * non-owning; users are responsible for the lifespan of the command.
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use WhileTrue(Command) instead.
- */
- [[deprecated("Use WhileTrue(Command) instead.")]]
- Trigger WhileActiveOnce(Command* command);
-
- /**
- * Binds a command to be started when the trigger becomes active, and
- * canceled when it becomes inactive. Transfers command ownership to the
- * button scheduler, so the user does not have to worry about lifespan -
- * rvalue refs will be *moved*, lvalue refs will be *copied.*
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use WhileTrue(Command) instead.
- */
- template T>
- [[deprecated("Use WhileTrue(Command) instead.")]]
- Trigger WhileActiveOnce(T&& command) {
- m_loop->Bind([condition = m_condition, previous = m_condition(),
- command = std::make_unique>(
- std::forward(command))]() mutable {
- bool current = condition();
-
- if (!previous && current) {
- command->Schedule();
- } else if (previous && !current) {
- command->Cancel();
- }
-
- previous = current;
- });
- return *this;
- }
-
- /**
- * Binds a command to start when the trigger becomes inactive. Takes a
- * raw pointer, and so is non-owning; users are responsible for the lifespan
- * of the command.
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use OnFalse(Command) instead.
- */
- [[deprecated("Use OnFalse(Command) instead.")]]
- Trigger WhenInactive(Command* command);
-
- /**
- * Binds a command to start when the trigger becomes inactive. Transfers
- * command ownership to the button scheduler, so the user does not have to
- * worry about lifespan - rvalue refs will be *moved*, lvalue refs will be
- * *copied.*
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use OnFalse(Command) instead.
- */
- template T>
- [[deprecated("Use OnFalse(Command) instead.")]]
- Trigger WhenInactive(T&& command) {
- m_loop->Bind([condition = m_condition, previous = m_condition(),
- command = std::make_unique>(
- std::forward(command))]() mutable {
- bool current = condition();
-
- if (previous && !current) {
- command->Schedule();
- }
-
- previous = current;
- });
- return *this;
- }
-
- /**
- * Binds a runnable to execute when the trigger becomes inactive.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Use OnFalse(Command) instead and construct the InstantCommand
- * manually
- */
- [[deprecated(
- "Use OnFalse(Command) instead and construct the InstantCommand "
- "manually")]]
- Trigger WhenInactive(std::function toRun,
- std::initializer_list requirements);
-
- /**
- * Binds a runnable to execute when the trigger becomes inactive.
- *
- * @param toRun the runnable to execute.
- * @param requirements the required subsystems.
- * @deprecated Use OnFalse(Command) instead and construct the InstantCommand
- * manually
- */
- [[deprecated(
- "Use OnFalse(Command) instead and construct the InstantCommand "
- "manually")]]
- Trigger WhenInactive(std::function toRun,
- std::span requirements = {});
-
- /**
- * Binds a command to start when the trigger becomes active, and be canceled
- * when it again becomes active. Takes a raw pointer, and so is non-owning;
- * users are responsible for the lifespan of the command.
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use ToggleOnTrue(Command) instead.
- */
- [[deprecated("Use ToggleOnTrue(Command) instead.")]]
- Trigger ToggleWhenActive(Command* command);
-
- /**
- * Binds a command to start when the trigger becomes active, and be canceled
- * when it again becomes active. Transfers command ownership to the button
- * scheduler, so the user does not have to worry about lifespan - rvalue refs
- * will be *moved*, lvalue refs will be *copied.*
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Use ToggleOnTrue(Command) instead.
- */
- template T>
- [[deprecated("Use ToggleOnTrue(Command) instead.")]]
- Trigger ToggleWhenActive(T&& command) {
- m_loop->Bind([condition = m_condition, previous = m_condition(),
- command = std::make_unique>(
- std::forward(command))]() mutable {
- bool current = condition();
-
- if (!previous && current) {
- if (command->IsScheduled()) {
- command->Cancel();
- } else {
- command->Schedule();
- }
- }
-
- previous = current;
- });
-
- return *this;
- }
-
- /**
- * Binds a command to be canceled when the trigger becomes active. Takes a
- * raw pointer, and so is non-owning; users are responsible for the lifespan
- * and scheduling of the command.
- *
- * @param command The command to bind.
- * @return The trigger, for chained calls.
- * @deprecated Pass this as a command end condition with Until() instead.
- */
- [[deprecated("Pass this as a command end condition with Until() instead.")]]
- Trigger CancelWhenActive(Command* command);
-
/**
* Composes two triggers with logical AND.
*
diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandDecoratorTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandDecoratorTest.java
index d164a9b99d..0f66acdef2 100644
--- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandDecoratorTest.java
+++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandDecoratorTest.java
@@ -200,23 +200,6 @@ class CommandDecoratorTest extends CommandTestBase {
}
}
- @SuppressWarnings("removal") // Command.perpetually()
- @Test
- void perpetuallyTest() {
- try (CommandScheduler scheduler = new CommandScheduler()) {
- Command command = new InstantCommand();
-
- Command perpetual = command.perpetually();
-
- scheduler.schedule(perpetual);
- scheduler.run();
- scheduler.run();
- scheduler.run();
-
- assertTrue(scheduler.isScheduled(perpetual));
- }
- }
-
@Test
void unlessTest() {
try (CommandScheduler scheduler = new CommandScheduler()) {
diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/PerpetualCommandTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/PerpetualCommandTest.java
deleted file mode 100644
index 6b9690bde8..0000000000
--- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/PerpetualCommandTest.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-package edu.wpi.first.wpilibj2.command;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Test;
-
-class PerpetualCommandTest extends CommandTestBase {
- @SuppressWarnings("removal") // PerpetualCommand
- @Test
- void perpetualCommandScheduleTest() {
- try (CommandScheduler scheduler = new CommandScheduler()) {
- PerpetualCommand command = new PerpetualCommand(new InstantCommand());
-
- scheduler.schedule(command);
- scheduler.run();
-
- assertTrue(scheduler.isScheduled(command));
- }
- }
-}
diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/button/TriggerTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/button/TriggerTest.java
index 82d359c3aa..87f8d163c9 100644
--- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/button/TriggerTest.java
+++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/button/TriggerTest.java
@@ -194,34 +194,6 @@ class TriggerTest extends CommandTestBase {
assertEquals(1, endCounter.get());
}
- // Binding runnables directly is deprecated -- users should create the command manually
- @SuppressWarnings("deprecation")
- @Test
- void runnableBindingTest() {
- InternalButton buttonWhenActive = new InternalButton();
- InternalButton buttonWhileActiveContinuous = new InternalButton();
- InternalButton buttonWhenInactive = new InternalButton();
-
- buttonWhenActive.setPressed(false);
- buttonWhileActiveContinuous.setPressed(true);
- buttonWhenInactive.setPressed(true);
-
- AtomicInteger counter = new AtomicInteger(0);
-
- buttonWhenActive.whenPressed(counter::incrementAndGet);
- buttonWhileActiveContinuous.whileActiveContinuous(counter::incrementAndGet);
- buttonWhenInactive.whenInactive(counter::incrementAndGet);
-
- CommandScheduler scheduler = CommandScheduler.getInstance();
-
- scheduler.run();
- buttonWhenActive.setPressed(true);
- buttonWhenInactive.setPressed(false);
- scheduler.run();
-
- assertEquals(counter.get(), 4);
- }
-
@Test
void triggerCompositionTest() {
InternalButton button1 = new InternalButton();
diff --git a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandDecoratorTest.cpp b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandDecoratorTest.cpp
index 405d44dc82..884d504346 100644
--- a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandDecoratorTest.cpp
+++ b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandDecoratorTest.cpp
@@ -9,7 +9,6 @@
#include "frc2/command/FunctionalCommand.h"
#include "frc2/command/InstantCommand.h"
#include "frc2/command/ParallelRaceGroup.h"
-#include "frc2/command/PerpetualCommand.h"
#include "frc2/command/RunCommand.h"
#include "frc2/command/SequentialCommandGroup.h"
@@ -122,21 +121,6 @@ TEST_F(CommandDecoratorTest, AndThen) {
EXPECT_TRUE(finished);
}
-TEST_F(CommandDecoratorTest, Perpetually) {
- CommandScheduler scheduler = GetScheduler();
-
- WPI_IGNORE_DEPRECATED
- auto command = InstantCommand([] {}, {}).Perpetually();
- WPI_UNIGNORE_DEPRECATED
-
- scheduler.Schedule(&command);
-
- scheduler.Run();
- scheduler.Run();
-
- EXPECT_TRUE(scheduler.IsScheduled(&command));
-}
-
TEST_F(CommandDecoratorTest, Unless) {
CommandScheduler scheduler = GetScheduler();
diff --git a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandRequirementsTest.cpp b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandRequirementsTest.cpp
index 79a472fc50..b46bb8bbde 100644
--- a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandRequirementsTest.cpp
+++ b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandRequirementsTest.cpp
@@ -12,7 +12,6 @@
#include "frc2/command/ParallelCommandGroup.h"
#include "frc2/command/ParallelDeadlineGroup.h"
#include "frc2/command/ParallelRaceGroup.h"
-#include "frc2/command/SelectCommand.h"
#include "frc2/command/SequentialCommandGroup.h"
using namespace frc2;
diff --git a/wpilibNewCommands/src/test/native/cpp/frc2/command/ConditionalCommandTest.cpp b/wpilibNewCommands/src/test/native/cpp/frc2/command/ConditionalCommandTest.cpp
index a82d834f3a..d7bbd26b20 100644
--- a/wpilibNewCommands/src/test/native/cpp/frc2/command/ConditionalCommandTest.cpp
+++ b/wpilibNewCommands/src/test/native/cpp/frc2/command/ConditionalCommandTest.cpp
@@ -6,7 +6,6 @@
#include "frc2/command/Commands.h"
#include "frc2/command/ConditionalCommand.h"
#include "frc2/command/InstantCommand.h"
-#include "frc2/command/SelectCommand.h"
using namespace frc2;
class ConditionalCommandTest : public CommandTestBase {};
diff --git a/wpilibNewCommands/src/test/native/cpp/frc2/command/PerpetualCommandTest.cpp b/wpilibNewCommands/src/test/native/cpp/frc2/command/PerpetualCommandTest.cpp
deleted file mode 100644
index b53835bc16..0000000000
--- a/wpilibNewCommands/src/test/native/cpp/frc2/command/PerpetualCommandTest.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) FIRST and other WPILib contributors.
-// Open Source Software; you can modify and/or share it under the terms of
-// the WPILib BSD license file in the root directory of this project.
-
-#include "CommandTestBase.h"
-#include "frc2/command/InstantCommand.h"
-#include "frc2/command/PerpetualCommand.h"
-
-using namespace frc2;
-class PerpetualCommandTest : public CommandTestBase {};
-
-TEST_F(PerpetualCommandTest, PerpetualCommandSchedule) {
- CommandScheduler scheduler = GetScheduler();
-
- bool check = false;
-
- WPI_IGNORE_DEPRECATED
- PerpetualCommand command{InstantCommand([&check] { check = true; }, {})};
- WPI_UNIGNORE_DEPRECATED
-
- scheduler.Schedule(&command);
- scheduler.Run();
- EXPECT_TRUE(scheduler.IsScheduled(&command));
- EXPECT_TRUE(check);
-}
diff --git a/wpilibNewCommands/src/test/native/cpp/frc2/command/button/TriggerTest.cpp b/wpilibNewCommands/src/test/native/cpp/frc2/command/button/TriggerTest.cpp
index f7312dde1c..a3c27e3e5e 100644
--- a/wpilibNewCommands/src/test/native/cpp/frc2/command/button/TriggerTest.cpp
+++ b/wpilibNewCommands/src/test/native/cpp/frc2/command/button/TriggerTest.cpp
@@ -3,7 +3,6 @@
// the WPILib BSD license file in the root directory of this project.
#include
-#include
#include "../CommandTestBase.h"
#include "frc2/command/CommandPtr.h"
@@ -207,24 +206,6 @@ TEST_F(TriggerTest, Negate) {
EXPECT_TRUE(scheduler.IsScheduled(&command));
}
-// this type of binding is deprecated and identical to OnTrue
-WPI_IGNORE_DEPRECATED
-TEST_F(TriggerTest, RValueTrigger) {
- auto& scheduler = CommandScheduler::GetInstance();
- int counter = 0;
- bool pressed = false;
-
- RunCommand command([&counter] { counter++; }, {});
-
- Trigger([&pressed] { return pressed; }).WhenActive(std::move(command));
- scheduler.Run();
- EXPECT_EQ(counter, 0);
- pressed = true;
- scheduler.Run();
- EXPECT_EQ(counter, 1);
-}
-WPI_UNIGNORE_DEPRECATED
-
TEST_F(TriggerTest, Debounce) {
auto& scheduler = CommandScheduler::GetInstance();
bool pressed = false;
diff --git a/wpilibcExamples/src/main/cpp/examples/RomiReference/cpp/RobotContainer.cpp b/wpilibcExamples/src/main/cpp/examples/RomiReference/cpp/RobotContainer.cpp
index f6e1fa4b0e..f068a7da1a 100644
--- a/wpilibcExamples/src/main/cpp/examples/RomiReference/cpp/RobotContainer.cpp
+++ b/wpilibcExamples/src/main/cpp/examples/RomiReference/cpp/RobotContainer.cpp
@@ -6,7 +6,6 @@
#include
#include
-#include
#include "commands/TeleopArcadeDrive.h"
diff --git a/wpilibcExamples/src/main/cpp/examples/RomiReference/include/RobotContainer.h b/wpilibcExamples/src/main/cpp/examples/RomiReference/include/RobotContainer.h
index 96cb34667f..6f36537dfd 100644
--- a/wpilibcExamples/src/main/cpp/examples/RomiReference/include/RobotContainer.h
+++ b/wpilibcExamples/src/main/cpp/examples/RomiReference/include/RobotContainer.h
@@ -8,7 +8,7 @@
#include
#include
#include
-#include
+#include
#include "Constants.h"
#include "commands/AutonomousDistance.h"