[docs] Change NewCommands to Commands v2 (NFC) (#8702)

This commit is contained in:
sciencewhiz
2026-03-29 20:40:36 -07:00
committed by GitHub
parent d74644283b
commit ceb712b089
57 changed files with 56 additions and 58 deletions

View File

@@ -26,7 +26,7 @@ import org.wpilib.util.sendable.SendableRegistry;
* <p>Commands are run synchronously from the main robot loop; no multithreading is used, unless
* specified explicitly from the command implementation.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
@NoDiscard("Commands must be used! Did you mean to bind it to a trigger?")
public abstract class Command implements Sendable {

View File

@@ -40,7 +40,7 @@ import org.wpilib.util.sendable.SendableRegistry;
* CommandScheduler#registerSubsystem(Subsystem...)} in order for their {@link Subsystem#periodic()}
* methods to be called and for their default commands to be scheduled.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public final class CommandScheduler implements Sendable, AutoCloseable {
/** The Singleton Instance. */

View File

@@ -17,7 +17,7 @@ import org.wpilib.util.sendable.SendableBuilder;
* added to any other composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class ConditionalCommand extends Command {
private final Command m_onTrue;

View File

@@ -18,7 +18,7 @@ import org.wpilib.util.sendable.SendableBuilder;
* <p>Note that the supplier <i>must</i> create a new Command each call. For selecting one of a
* preallocated set of commands, use {@link SelectCommand}.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class DeferredCommand extends Command {
private final Command m_nullCommand =

View File

@@ -15,7 +15,7 @@ import java.util.function.Consumer;
* command is beyond a certain complexity it is usually better practice to write a proper class for
* it than to inline it.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class FunctionalCommand extends Command {
private final Runnable m_onInit;

View File

@@ -9,7 +9,7 @@ package org.wpilib.command2;
* the scheduler. Users can either pass in a Runnable and a set of requirements, or else subclass
* this command if desired.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class InstantCommand extends FunctionalCommand {
/**

View File

@@ -15,7 +15,7 @@ import org.wpilib.system.Notifier;
* code thread-safe. If you do not know what "thread-safe" means, that is a good sign that you
* should not use this class.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class NotifierCommand extends Command {
private final Notifier m_notifier;

View File

@@ -15,7 +15,7 @@ import java.util.Map;
* added to any other composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class ParallelCommandGroup extends Command {
// maps commands in this composition to whether they are still running

View File

@@ -18,7 +18,7 @@ import org.wpilib.util.sendable.SendableBuilder;
* added to any other composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class ParallelDeadlineGroup extends Command {
// maps commands in this composition to whether they are still running

View File

@@ -16,7 +16,7 @@ import java.util.Set;
* added to any other composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class ParallelRaceGroup extends Command {
// LinkedHashSet guarantees we iterate over commands in the order they were added

View File

@@ -7,7 +7,7 @@ package org.wpilib.command2;
/**
* A command that prints a string when initialized.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class PrintCommand extends InstantCommand {
/**

View File

@@ -18,7 +18,7 @@ import org.wpilib.util.sendable.SendableBuilder;
* from a subsystem already required by the composition, or else the composition will cancel itself
* when the proxy is reached. If this command is interrupted, it will cancel the command.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class ProxyCommand extends Command {
private final Supplier<Command> m_supplier;

View File

@@ -17,7 +17,7 @@ import org.wpilib.util.sendable.SendableBuilder;
* added to any other composition or scheduled individually,and the composition requires all
* subsystems its components require.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class RepeatCommand extends Command {
private final Command m_command;

View File

@@ -11,7 +11,7 @@ import java.util.function.BooleanSupplier;
* use {@link Command#withTimeout(double)} or {@link Command#until(BooleanSupplier)} to give it one.
* If you only wish to execute a Runnable once, use {@link InstantCommand}.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class RunCommand extends FunctionalCommand {
/**

View File

@@ -11,7 +11,7 @@ import java.util.Set;
* CommandGroups. Note that if run from a composition, the composition will not know about the
* status of the scheduled commands, and will treat this command as finishing instantly.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class ScheduleCommand extends Command {
private final Set<Command> m_toSchedule;

View File

@@ -18,7 +18,7 @@ import org.wpilib.util.sendable.SendableBuilder;
* added to any other composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*
* @param <K> The type of key used to select the command
*/

View File

@@ -15,7 +15,7 @@ import org.wpilib.util.sendable.SendableBuilder;
* added to any other composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class SequentialCommandGroup extends Command {
private final List<Command> m_commands = new ArrayList<>();

View File

@@ -14,7 +14,7 @@ import java.util.function.Consumer;
* end condition as-is; either subclass it or use {@link Command#withTimeout(double)} or {@link
* Command#until(java.util.function.BooleanSupplier)} to give it one.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class StartEndCommand extends FunctionalCommand {
/**

View File

@@ -22,7 +22,7 @@ import java.util.function.Supplier;
* constructor of users' Subsystem implementations. The {@link SubsystemBase} class offers a simple
* base for user implementations that handles this.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public interface Subsystem {
/**

View File

@@ -12,7 +12,7 @@ import org.wpilib.util.sendable.SendableRegistry;
* A base for subsystems that handles registration in the constructor, and provides a more intuitive
* method for setting the default command.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public abstract class SubsystemBase implements Subsystem, Sendable {
/** Constructor. Telemetry/log name defaults to the classname. */

View File

@@ -14,7 +14,7 @@ import org.wpilib.util.sendable.SendableRegistry;
/**
* A command that does nothing but takes a specified amount of time to finish.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class WaitCommand extends Command {
/** The timer used for waiting. */

View File

@@ -13,7 +13,7 @@ import org.wpilib.system.Timer;
* A command that does nothing but ends after a specified match time or condition. Useful for
* CommandGroups.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class WaitUntilCommand extends Command {
private final BooleanSupplier m_condition;

View File

@@ -11,7 +11,7 @@ import org.wpilib.driverstation.Gamepad;
/**
* A {@link Trigger} that gets its state from a {@link Gamepad}.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class GamepadButton extends Trigger {
/**

View File

@@ -10,7 +10,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* This class is intended to be used within a program. The programmer can manually set its value.
* Also includes a setting for whether it should invert its value.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class InternalButton extends Trigger {
// need to be references, so they can be mutated after being captured in the constructor.

View File

@@ -11,7 +11,7 @@ import org.wpilib.driverstation.GenericHID;
/**
* A {@link Trigger} that gets its state from a {@link GenericHID}.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class JoystickButton extends Trigger {
/**

View File

@@ -14,7 +14,7 @@ import org.wpilib.networktables.NetworkTableInstance;
/**
* A {@link Trigger} that uses a {@link NetworkTable} boolean field.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class NetworkButton extends Trigger {
/**

View File

@@ -12,7 +12,7 @@ import org.wpilib.driverstation.GenericHID;
/**
* A {@link Trigger} that gets its state from a POV on a {@link GenericHID}.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class POVButton extends Trigger {
/**

View File

@@ -22,7 +22,7 @@ import org.wpilib.math.filter.EdgeCounterFilter;
* <p>Triggers can easily be composed for advanced functionality using the {@link
* #and(BooleanSupplier)}, {@link #or(BooleanSupplier)}, {@link #negate()} operators.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
public class Trigger implements BooleanSupplier {
/** Functional interface for the body of a trigger binding. */

View File

@@ -32,7 +32,7 @@ namespace wpi::cmd {
* <p>Note: ALWAYS create a subclass by extending CommandHelper<Base, Subclass>,
* or decorators will not function!
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*
* @see CommandScheduler
* @see CommandHelper

View File

@@ -19,7 +19,7 @@ namespace wpi::cmd {
* <p>Note: ALWAYS create a subclass by extending CommandHelper<Base, Subclass>,
* or decorators will not function!
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
template <std::derived_from<Command> Base, typename CRTP>
class CommandHelper : public Base {

View File

@@ -32,7 +32,7 @@ class Subsystem;
* with the scheduler using RegisterSubsystem() in order for their Periodic()
* methods to be called and for their default commands to be scheduled.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class CommandScheduler final
: public wpi::util::Sendable,

View File

@@ -22,7 +22,7 @@ namespace wpi::cmd {
* composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*
* @see ScheduleCommand
*/

View File

@@ -21,7 +21,7 @@ namespace wpi::cmd {
* Note that the supplier <i>must</i> create a new Command each call. For
* selecting one of a preallocated set of commands, use SelectCommand.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
class DeferredCommand : public CommandHelper<Command, DeferredCommand> {
public:

View File

@@ -18,7 +18,7 @@ namespace wpi::cmd {
* complexity it is usually better practice to write a proper class for it than
* to inline it.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class FunctionalCommand : public CommandHelper<Command, FunctionalCommand> {
public:

View File

@@ -16,7 +16,7 @@ namespace wpi::cmd {
* the same iteration of the scheduler. Users can either pass in a Runnable and
* a set of requirements, or else subclass this command if desired.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class InstantCommand : public CommandHelper<FunctionalCommand, InstantCommand> {
public:

View File

@@ -23,7 +23,7 @@ namespace wpi::cmd {
* make the executed code thread-safe. If you do not know what "thread-safe"
* means, that is a good sign that you should not use this class.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class NotifierCommand : public CommandHelper<Command, NotifierCommand> {
public:

View File

@@ -27,7 +27,7 @@ namespace wpi::cmd {
* composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class ParallelCommandGroup
: public CommandHelper<Command, ParallelCommandGroup> {

View File

@@ -28,7 +28,7 @@ namespace wpi::cmd {
* composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class ParallelDeadlineGroup
: public CommandHelper<Command, ParallelDeadlineGroup> {

View File

@@ -27,7 +27,7 @@ namespace wpi::cmd {
* composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class ParallelRaceGroup : public CommandHelper<Command, ParallelRaceGroup> {
public:

View File

@@ -13,7 +13,7 @@ namespace wpi::cmd {
/**
* A command that prints a string when initialized.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class PrintCommand : public CommandHelper<InstantCommand, PrintCommand> {
public:

View File

@@ -22,7 +22,7 @@ namespace wpi::cmd {
* else the composition will cancel itself when the proxy is reached. If this
* command is interrupted, it will cancel the command.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
class ProxyCommand : public CommandHelper<Command, ProxyCommand> {
public:

View File

@@ -27,7 +27,7 @@ namespace wpi::cmd {
* composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
class RepeatCommand : public CommandHelper<Command, RepeatCommand> {
public:

View File

@@ -17,7 +17,7 @@ namespace wpi::cmd {
* Command.Until() to give it one. If you only wish
* to execute a Runnable once, use InstantCommand.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class RunCommand : public CommandHelper<FunctionalCommand, RunCommand> {
public:

View File

@@ -17,7 +17,7 @@ namespace wpi::cmd {
* composition will not know about the status of the scheduled commands, and
* will treat this command as finishing instantly.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class ScheduleCommand : public CommandHelper<Command, ScheduleCommand> {
public:

View File

@@ -31,7 +31,7 @@ namespace wpi::cmd {
* composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
template <typename Key>
class SelectCommand : public CommandHelper<Command, SelectCommand<Key>> {

View File

@@ -30,7 +30,7 @@ const size_t invalid_index = std::numeric_limits<size_t>::max();
* composition or scheduled individually, and the composition requires all
* subsystems its components require.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class SequentialCommandGroup
: public CommandHelper<Command, SequentialCommandGroup> {

View File

@@ -18,7 +18,7 @@ namespace wpi::cmd {
* subclass it or use Command.WithTimeout() or Command.Until() to give
* it one.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class StartEndCommand
: public CommandHelper<FunctionalCommand, StartEndCommand> {

View File

@@ -33,7 +33,7 @@ class CommandPtr;
* SubsystemBase class offers a simple base for user implementations
* that handles this.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*
* @see Command
* @see CommandScheduler

View File

@@ -16,7 +16,7 @@ namespace wpi::cmd {
* A base for subsystems that handles registration in the constructor, and
* provides a more intuitive method for setting the default command.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class SubsystemBase : public Subsystem,
public wpi::util::Sendable,

View File

@@ -13,7 +13,7 @@ namespace wpi::cmd {
/**
* A command that does nothing but takes a specified amount of time to finish.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class WaitCommand : public CommandHelper<Command, WaitCommand> {
public:

View File

@@ -15,7 +15,7 @@ namespace wpi::cmd {
* A command that does nothing but ends after a specified match time or
* condition. Useful for CommandGroups.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class WaitUntilCommand : public CommandHelper<Command, WaitUntilCommand> {
public:

View File

@@ -11,7 +11,7 @@ namespace wpi::cmd {
* A class used to bind command scheduling to gamepad button presses. Can be
* composed with other buttons with the operators in Trigger.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*
* @see Trigger
*/

View File

@@ -11,7 +11,7 @@ namespace wpi::cmd {
* A class used to bind command scheduling to joystick button presses. Can be
* composed with other buttons with the operators in Trigger.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*
* @see Trigger
*/

View File

@@ -16,7 +16,7 @@ namespace wpi::cmd {
/**
* A Button that uses a NetworkTable boolean field.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*/
class NetworkButton : public Trigger {
public:

View File

@@ -13,7 +13,7 @@ namespace wpi::cmd {
* A class used to bind command scheduling to joystick POV presses. Can be
* composed with other buttons with the operators in Trigger.
*
* This class is provided by the NewCommands VendorDep
* This class is provided by the Commands v2 VendorDep
*
* @see Trigger
*/

View File

@@ -26,7 +26,7 @@ class Command;
* <p>Triggers can easily be composed for advanced functionality using the
* {@link #operator!}, {@link #operator||}, {@link #operator&&} operators.
*
* <p>This class is provided by the NewCommands VendorDep
* <p>This class is provided by the Commands v2 VendorDep
*/
class Trigger {
public:

View File

@@ -19,8 +19,6 @@ class NetworkTableInstance;
namespace wpi {
/**
* A Button that uses a NetworkTable boolean field.
*
* This class is provided by the NewCommands VendorDep
*/
class NetworkBooleanEvent : public BooleanEvent {
public: