From b28aeeec83d34077c0c43be3c073c391c0c96db3 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:19:02 -0400 Subject: [PATCH] [cmd] Deprecate control commands and subsystems --- .../main/java/edu/wpi/first/wpilibj2/command/PIDCommand.java | 3 +++ .../java/edu/wpi/first/wpilibj2/command/PIDSubsystem.java | 3 +++ .../edu/wpi/first/wpilibj2/command/ProfiledPIDCommand.java | 3 +++ .../edu/wpi/first/wpilibj2/command/ProfiledPIDSubsystem.java | 4 ++++ .../wpi/first/wpilibj2/command/TrapezoidProfileCommand.java | 4 +++- .../wpi/first/wpilibj2/command/TrapezoidProfileSubsystem.java | 3 +++ .../src/main/native/include/frc2/command/PIDCommand.h | 4 +++- .../src/main/native/include/frc2/command/PIDSubsystem.h | 4 +++- .../src/main/native/include/frc2/command/ProfiledPIDCommand.h | 3 ++- .../main/native/include/frc2/command/ProfiledPIDSubsystem.h | 4 +++- .../native/include/frc2/command/TrapezoidProfileCommand.h | 3 ++- .../native/include/frc2/command/TrapezoidProfileSubsystem.h | 4 +++- 12 files changed, 35 insertions(+), 7 deletions(-) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PIDCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PIDCommand.java index 360e15bf9d4..0a84d37c259 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PIDCommand.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PIDCommand.java @@ -16,7 +16,10 @@ * are performed synchronously in the command's execute() method. * *

This class is provided by the NewCommands VendorDep + * + * @deprecated Use a PIDController instead */ +@Deprecated(forRemoval = true, since = "2025") public class PIDCommand extends Command { /** PID controller. */ protected final PIDController m_controller; diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PIDSubsystem.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PIDSubsystem.java index 8146ca4d7b0..3be70d7a1f5 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PIDSubsystem.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/PIDSubsystem.java @@ -13,7 +13,10 @@ * synchronously from the subsystem's periodic() method. * *

This class is provided by the NewCommands VendorDep + * + * @deprecated Use a PIDController instead */ +@Deprecated(forRemoval = true, since = "2025") public abstract class PIDSubsystem extends SubsystemBase { /** PID controller. */ protected final PIDController m_controller; diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProfiledPIDCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProfiledPIDCommand.java index b22ff51c4a3..428aabc7d11 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProfiledPIDCommand.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProfiledPIDCommand.java @@ -18,7 +18,10 @@ * output are performed synchronously in the command's execute() method. * *

This class is provided by the NewCommands VendorDep + * + * @deprecated Use a ProfiledPIDController instead */ +@Deprecated(forRemoval = true, since = "2025") public class ProfiledPIDCommand extends Command { /** Profiled PID controller. */ protected final ProfiledPIDController m_controller; diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProfiledPIDSubsystem.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProfiledPIDSubsystem.java index 05318edc611..7dcc694d54f 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProfiledPIDSubsystem.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ProfiledPIDSubsystem.java @@ -9,13 +9,17 @@ import edu.wpi.first.math.controller.ProfiledPIDController; import edu.wpi.first.math.trajectory.TrapezoidProfile; +import edu.wpi.first.math.trajectory.TrapezoidProfile.State; /** * A subsystem that uses a {@link ProfiledPIDController} to control an output. The controller is run * synchronously from the subsystem's periodic() method. * *

This class is provided by the NewCommands VendorDep + * + * @deprecated Use a ProfiledPIDController instead */ +@Deprecated(forRemoval = true, since = "2025") public abstract class ProfiledPIDSubsystem extends SubsystemBase { /** Profiled PID controller. */ protected final ProfiledPIDController m_controller; diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/TrapezoidProfileCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/TrapezoidProfileCommand.java index 2fe8fa6d611..6c76bb41f58 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/TrapezoidProfileCommand.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/TrapezoidProfileCommand.java @@ -4,10 +4,10 @@ package edu.wpi.first.wpilibj2.command; -import static edu.wpi.first.math.trajectory.TrapezoidProfile.State; import static edu.wpi.first.util.ErrorMessages.requireNonNullParam; import edu.wpi.first.math.trajectory.TrapezoidProfile; +import edu.wpi.first.math.trajectory.TrapezoidProfile.State; import java.util.function.Consumer; import java.util.function.Supplier; @@ -15,6 +15,8 @@ * A command that runs a {@link TrapezoidProfile}. Useful for smoothly controlling mechanism motion. * *

This class is provided by the NewCommands VendorDep + * + * @deprecated Use a TrapezoidProfile instead */ @Deprecated(since = "2025", forRemoval = true) public class TrapezoidProfileCommand extends Command { diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/TrapezoidProfileSubsystem.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/TrapezoidProfileSubsystem.java index 44abdfc4db9..b3df8bc7721 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/TrapezoidProfileSubsystem.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/TrapezoidProfileSubsystem.java @@ -13,7 +13,10 @@ * how to use the current state of the motion profile by overriding the `useState` method. * *

This class is provided by the NewCommands VendorDep + * + * @deprecated Use a TrapezoidProfile instead */ +@Deprecated(forRemoval = true, since = "2025") public abstract class TrapezoidProfileSubsystem extends SubsystemBase { private final double m_period; private final TrapezoidProfile m_profile; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/PIDCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/PIDCommand.h index ab16e7dd25d..9d0fa9bd0e4 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/PIDCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/PIDCommand.h @@ -22,8 +22,10 @@ namespace frc2 { * This class is provided by the NewCommands VendorDep * * @see PIDController + * @deprecated Use a PIDController instead */ -class PIDCommand : public CommandHelper { +class [[deprecated("Use a PIDController instead")]] PIDCommand + : public CommandHelper { public: /** * Creates a new PIDCommand, which controls the given output with a diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/PIDSubsystem.h b/wpilibNewCommands/src/main/native/include/frc2/command/PIDSubsystem.h index af7d2980874..64eecd7e07a 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/PIDSubsystem.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/PIDSubsystem.h @@ -16,8 +16,10 @@ namespace frc2 { * This class is provided by the NewCommands VendorDep * * @see PIDController + * @deprecated Use a PIDController instead */ -class PIDSubsystem : public SubsystemBase { +class [[deprecated("Use a PIDController instead")]] PIDSubsystem + : public SubsystemBase { public: /** * Creates a new PIDSubsystem. diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDCommand.h index 6fbb12b1994..b234c3d6262 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDCommand.h @@ -24,9 +24,10 @@ namespace frc2 { * This class is provided by the NewCommands VendorDep * * @see ProfiledPIDController + * @deprecated Use a ProfiledPIDController instead */ template -class ProfiledPIDCommand +class [[deprecated("Use a ProfiledPIDController instead")]] ProfiledPIDCommand : public CommandHelper> { using Distance_t = units::unit_t; using Velocity = diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDSubsystem.h b/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDSubsystem.h index 1dac7fab276..b5786d959e7 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDSubsystem.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDSubsystem.h @@ -17,9 +17,11 @@ namespace frc2 { * This class is provided by the NewCommands VendorDep * * @see ProfiledPIDController + * @deprecated Use a ProfiledPIDController instead */ template -class ProfiledPIDSubsystem : public SubsystemBase { +class [[deprecated("Use a ProfiledPIDController instead")]] ProfiledPIDSubsystem + : public SubsystemBase { using Distance_t = units::unit_t; using Velocity = units::compound_unit>; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileCommand.h index 7b1d70214d4..35999debdd7 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileCommand.h @@ -20,9 +20,10 @@ namespace frc2 { * This class is provided by the NewCommands VendorDep * * @see TrapezoidProfile + * @deprecated Use a TrapezoidProfile instead */ template -class TrapezoidProfileCommand +class [[deprecated("Use a TrapezoidProfile instead")]] TrapezoidProfileCommand : public CommandHelper> { using Distance_t = units::unit_t; using Velocity = diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileSubsystem.h b/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileSubsystem.h index 56680103122..54b75254c8d 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileSubsystem.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileSubsystem.h @@ -16,9 +16,11 @@ namespace frc2 { * profile by overriding the `UseState` method. * * This class is provided by the NewCommands VendorDep + * @deprecated Use a TrapezoidProfile instead */ template -class TrapezoidProfileSubsystem : public SubsystemBase { +class [[deprecated("Use a TrapezoidProfile instead")]] TrapezoidProfileSubsystem + : public SubsystemBase { using Distance_t = units::unit_t; using Velocity = units::compound_unit>;