From 3b79cb6ed359295b62ed2a2f2f81c6441b24d26f Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Thu, 14 Sep 2023 23:56:48 -0400 Subject: [PATCH] [commands] Revert SubsystemBase deprecation/removal (#5634) --- .../first/wpilibj2/command/PIDSubsystem.java | 2 +- .../command/ProfiledPIDSubsystem.java | 2 +- .../wpi/first/wpilibj2/command/Subsystem.java | 105 +++--------------- .../first/wpilibj2/command/SubsystemBase.java | 81 +++++++++++++- .../command/TrapezoidProfileSubsystem.java | 2 +- .../native/cpp/frc2/command/Subsystem.cpp | 56 ---------- .../native/cpp/frc2/command/SubsystemBase.cpp | 55 ++++++++- .../include/frc2/command/PIDSubsystem.h | 4 +- .../frc2/command/ProfiledPIDSubsystem.h | 4 +- .../native/include/frc2/command/Subsystem.h | 58 ++-------- .../include/frc2/command/SubsystemBase.h | 54 ++++++++- .../frc2/command/TrapezoidProfileSubsystem.h | 4 +- .../command/CommandRequirementsTest.java | 6 +- .../command/ConditionalCommandTest.java | 6 +- .../wpilibj2/command/DefaultCommandTest.java | 6 +- .../command/ParallelCommandGroupTest.java | 14 +-- .../command/ParallelDeadlineGroupTest.java | 14 +-- .../command/ParallelRaceGroupTest.java | 18 +-- .../first/wpilibj2/command/SchedulerTest.java | 4 +- .../command/SchedulingRecursionTest.java | 10 +- .../wpilibj2/command/SelectCommandTest.java | 8 +- .../command/SequentialCommandGroupTest.java | 8 +- .../native/cpp/frc2/command/CommandTestBase.h | 4 +- .../commands/subsystem2/ReplaceMeSubsystem2.h | 4 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../GearsBot/include/subsystems/Claw.h | 4 +- .../GearsBot/include/subsystems/Drivetrain.h | 4 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../cpp/subsystems/DriveSubsystem.cpp | 2 +- .../cpp/subsystems/HatchSubsystem.cpp | 2 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../include/subsystems/HatchSubsystem.h | 4 +- .../cpp/subsystems/DriveSubsystem.cpp | 2 +- .../cpp/subsystems/HatchSubsystem.cpp | 2 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../include/subsystems/HatchSubsystem.h | 4 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../include/subsystems/Drive.h | 4 +- .../include/subsystems/Intake.h | 4 +- .../include/subsystems/Pneumatics.h | 4 +- .../include/subsystems/Shooter.h | 4 +- .../include/subsystems/Storage.h | 4 +- .../include/subsystems/Drivetrain.h | 4 +- .../include/subsystems/OnBoardIO.h | 4 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../include/subsystems/DriveSubsystem.h | 4 +- .../include/subsystems/ExampleSubsystem.h | 4 +- .../subsystem2/ReplaceMeSubsystem.java | 4 +- .../armbot/subsystems/DriveSubsystem.java | 4 +- .../subsystems/DriveSubsystem.java | 4 +- .../subsystems/DriveSubsystem.java | 4 +- .../frisbeebot/subsystems/DriveSubsystem.java | 4 +- .../examples/gearsbot/subsystems/Claw.java | 4 +- .../gearsbot/subsystems/Drivetrain.java | 4 +- .../subsystems/DriveSubsystem.java | 4 +- .../subsystems/DriveSubsystem.java | 4 +- .../subsystems/HatchSubsystem.java | 4 +- .../subsystems/DriveSubsystem.java | 4 +- .../subsystems/HatchSubsystem.java | 4 +- .../subsystems/DriveSubsystem.java | 4 +- .../subsystems/DriveSubsystem.java | 4 +- .../subsystems/Drive.java | 4 +- .../subsystems/Intake.java | 4 +- .../subsystems/Pneumatics.java | 4 +- .../subsystems/Shooter.java | 4 +- .../subsystems/Storage.java | 4 +- .../romireference/subsystems/Drivetrain.java | 4 +- .../romireference/subsystems/OnBoardIO.java | 4 +- .../subsystems/DriveSubsystem.java | 4 +- .../subsystems/DriveSubsystem.java | 4 +- .../examples/xrpreference/subsystems/Arm.java | 4 +- .../xrpreference/subsystems/Drivetrain.java | 4 +- .../xrpreference/subsystems/XRPOnBoardIO.java | 4 +- .../subsystems/ExampleSubsystem.java | 4 +- .../subsystems/RomiDrivetrain.java | 4 +- .../subsystems/XRPDrivetrain.java | 4 +- 80 files changed, 370 insertions(+), 375 deletions(-) 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 d7ece4aa87..84318de14a 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 @@ -14,7 +14,7 @@ import edu.wpi.first.math.controller.PIDController; * *

This class is provided by the NewCommands VendorDep */ -public abstract class PIDSubsystem extends Subsystem { +public abstract class PIDSubsystem extends SubsystemBase { protected final PIDController m_controller; protected boolean m_enabled; 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 e58a77b402..283b4bfd46 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 @@ -16,7 +16,7 @@ import edu.wpi.first.math.trajectory.TrapezoidProfile; * *

This class is provided by the NewCommands VendorDep */ -public abstract class ProfiledPIDSubsystem extends Subsystem { +public abstract class ProfiledPIDSubsystem extends SubsystemBase { protected final ProfiledPIDController m_controller; protected boolean m_enabled; diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Subsystem.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Subsystem.java index a14192521d..ef7c4c99d9 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Subsystem.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Subsystem.java @@ -4,10 +4,6 @@ package edu.wpi.first.wpilibj2.command; -import edu.wpi.first.util.sendable.Sendable; -import edu.wpi.first.util.sendable.SendableBuilder; -import edu.wpi.first.util.sendable.SendableRegistry; - /** * A robot subsystem. Subsystems are the basic unit of robot organization in the Command-based * framework; they encapsulate low-level hardware objects (motor controllers, sensors, etc.) and @@ -17,34 +13,29 @@ import edu.wpi.first.util.sendable.SendableRegistry; * their {@link Command#getRequirements()} method, and resources used within a subsystem should * generally remain encapsulated and not be shared by other parts of the robot. * - *

Subsystems are automatically registered with the default scheduler in order for the {@link - * Subsystem#periodic()} method to be called. + *

Subsystems must be registered with the scheduler with the {@link + * CommandScheduler#registerSubsystem(Subsystem...)} method in order for the {@link + * Subsystem#periodic()} method to be called. It is recommended that this method be called from the + * constructor of users' Subsystem implementations. The {@link SubsystemBase} class offers a simple + * base for user implementations that handles this. * *

This class is provided by the NewCommands VendorDep */ -public abstract class Subsystem implements Sendable { - /** Constructor. */ - public Subsystem() { - String name = this.getClass().getSimpleName(); - name = name.substring(name.lastIndexOf('.') + 1); - SendableRegistry.addLW(this, name, name); - CommandScheduler.getInstance().registerSubsystem(this); - } - +public interface Subsystem { /** * This method is called periodically by the {@link CommandScheduler}. Useful for updating * subsystem-specific state that you don't want to offload to a {@link Command}. Teams should try * to be consistent within their own codebases about which responsibilities will be handled by * Commands, and which will be handled here. */ - public void periodic() {} + default void periodic() {} /** * This method is called periodically by the {@link CommandScheduler}. Useful for updating * subsystem-specific state that needs to be maintained for simulations, such as for updating * {@link edu.wpi.first.wpilibj.simulation} classes and setting simulated sensor readings. */ - public void simulationPeriodic() {} + default void simulationPeriodic() {} /** * Sets the default {@link Command} of the subsystem. The default command will be automatically @@ -55,7 +46,7 @@ public abstract class Subsystem implements Sendable { * * @param defaultCommand the default command to associate with this subsystem */ - public void setDefaultCommand(Command defaultCommand) { + default void setDefaultCommand(Command defaultCommand) { CommandScheduler.getInstance().setDefaultCommand(this, defaultCommand); } @@ -63,7 +54,7 @@ public abstract class Subsystem implements Sendable { * Removes the default command for the subsystem. This will not cancel the default command if it * is currently running. */ - public void removeDefaultCommand() { + default void removeDefaultCommand() { CommandScheduler.getInstance().removeDefaultCommand(this); } @@ -73,7 +64,7 @@ public abstract class Subsystem implements Sendable { * * @return the default command associated with this subsystem */ - public Command getDefaultCommand() { + default Command getDefaultCommand() { return CommandScheduler.getInstance().getDefaultCommand(this); } @@ -83,51 +74,15 @@ public abstract class Subsystem implements Sendable { * * @return the scheduled command currently requiring this subsystem */ - public Command getCurrentCommand() { + default Command getCurrentCommand() { return CommandScheduler.getInstance().requiring(this); } - /** - * Gets the name of this Subsystem. - * - * @return Name - */ - public String getName() { - return SendableRegistry.getName(this); - } - - /** - * Sets the name of this Subsystem. - * - * @param name name - */ - public void setName(String name) { - SendableRegistry.setName(this, name); - } - - /** - * Gets the subsystem name of this Subsystem. - * - * @return Subsystem name - */ - public String getSubsystem() { - return SendableRegistry.getSubsystem(this); - } - - /** - * Sets the subsystem name of this Subsystem. - * - * @param subsystem subsystem name - */ - public void setSubsystem(String subsystem) { - SendableRegistry.setSubsystem(this, subsystem); - } - /** * Registers this subsystem with the {@link CommandScheduler}, allowing its {@link * Subsystem#periodic()} method to be called when the scheduler runs. */ - public void register() { + default void register() { CommandScheduler.getInstance().registerSubsystem(this); } @@ -138,7 +93,7 @@ public abstract class Subsystem implements Sendable { * @return the command * @see InstantCommand */ - public Command runOnce(Runnable action) { + default Command runOnce(Runnable action) { return Commands.runOnce(action, this); } @@ -150,7 +105,7 @@ public abstract class Subsystem implements Sendable { * @return the command * @see RunCommand */ - public Command run(Runnable action) { + default Command run(Runnable action) { return Commands.run(action, this); } @@ -163,7 +118,7 @@ public abstract class Subsystem implements Sendable { * @return the command * @see StartEndCommand */ - public Command startEnd(Runnable start, Runnable end) { + default Command startEnd(Runnable start, Runnable end) { return Commands.startEnd(start, end, this); } @@ -175,33 +130,7 @@ public abstract class Subsystem implements Sendable { * @param end the action to run on interrupt * @return the command */ - public Command runEnd(Runnable run, Runnable end) { + default Command runEnd(Runnable run, Runnable end) { return Commands.runEnd(run, end, this); } - - /** - * Associates a {@link Sendable} with this Subsystem. Also update the child's name. - * - * @param name name to give child - * @param child sendable - */ - public void addChild(String name, Sendable child) { - SendableRegistry.addLW(child, getSubsystem(), name); - } - - @Override - public void initSendable(SendableBuilder builder) { - builder.setSmartDashboardType("Subsystem"); - - builder.addBooleanProperty(".hasDefault", () -> getDefaultCommand() != null, null); - builder.addStringProperty( - ".default", - () -> getDefaultCommand() != null ? getDefaultCommand().getName() : "none", - null); - builder.addBooleanProperty(".hasCommand", () -> getCurrentCommand() != null, null); - builder.addStringProperty( - ".command", - () -> getCurrentCommand() != null ? getCurrentCommand().getName() : "none", - null); - } } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SubsystemBase.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SubsystemBase.java index c087f97541..6cf926ee23 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SubsystemBase.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SubsystemBase.java @@ -4,15 +4,84 @@ package edu.wpi.first.wpilibj2.command; +import edu.wpi.first.util.sendable.Sendable; +import edu.wpi.first.util.sendable.SendableBuilder; +import edu.wpi.first.util.sendable.SendableRegistry; + /** * 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 - * - * @deprecated All functionality provided by {@link SubsystemBase} has been merged into {@link - * Subsystem}. Use {@link Subsystem} instead. */ -@Deprecated(since = "2024", forRemoval = true) -@SuppressWarnings("PMD.AbstractClassWithoutAnyMethod") -public abstract class SubsystemBase extends Subsystem {} +public abstract class SubsystemBase implements Subsystem, Sendable { + /** Constructor. */ + public SubsystemBase() { + String name = this.getClass().getSimpleName(); + name = name.substring(name.lastIndexOf('.') + 1); + SendableRegistry.addLW(this, name, name); + CommandScheduler.getInstance().registerSubsystem(this); + } + + /** + * Gets the name of this Subsystem. + * + * @return Name + */ + public String getName() { + return SendableRegistry.getName(this); + } + + /** + * Sets the name of this Subsystem. + * + * @param name name + */ + public void setName(String name) { + SendableRegistry.setName(this, name); + } + + /** + * Gets the subsystem name of this Subsystem. + * + * @return Subsystem name + */ + public String getSubsystem() { + return SendableRegistry.getSubsystem(this); + } + + /** + * Sets the subsystem name of this Subsystem. + * + * @param subsystem subsystem name + */ + public void setSubsystem(String subsystem) { + SendableRegistry.setSubsystem(this, subsystem); + } + + /** + * Associates a {@link Sendable} with this Subsystem. Also update the child's name. + * + * @param name name to give child + * @param child sendable + */ + public void addChild(String name, Sendable child) { + SendableRegistry.addLW(child, getSubsystem(), name); + } + + @Override + public void initSendable(SendableBuilder builder) { + builder.setSmartDashboardType("Subsystem"); + + builder.addBooleanProperty(".hasDefault", () -> getDefaultCommand() != null, null); + builder.addStringProperty( + ".default", + () -> getDefaultCommand() != null ? getDefaultCommand().getName() : "none", + null); + builder.addBooleanProperty(".hasCommand", () -> getCurrentCommand() != null, null); + builder.addStringProperty( + ".command", + () -> getCurrentCommand() != null ? getCurrentCommand().getName() : "none", + null); + } +} 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 4362a5e4e6..35c02e6ee6 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 @@ -14,7 +14,7 @@ import edu.wpi.first.math.trajectory.TrapezoidProfile; * *

This class is provided by the NewCommands VendorDep */ -public abstract class TrapezoidProfileSubsystem extends Subsystem { +public abstract class TrapezoidProfileSubsystem extends SubsystemBase { private final double m_period; private final TrapezoidProfile m_profile; diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/Subsystem.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/Subsystem.cpp index 9fc6e8adac..d1d50e1de0 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/Subsystem.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/Subsystem.cpp @@ -8,12 +8,6 @@ #include "frc2/command/Commands.h" using namespace frc2; - -Subsystem::Subsystem() { - wpi::SendableRegistry::AddLW(this, GetTypeName(*this)); - CommandScheduler::GetInstance().RegisterSubsystem({this}); -} - Subsystem::~Subsystem() { CommandScheduler::GetInstance().UnregisterSubsystem(this); } @@ -39,26 +33,6 @@ Command* Subsystem::GetCurrentCommand() const { return CommandScheduler::GetInstance().Requiring(this); } -std::string Subsystem::GetName() const { - return wpi::SendableRegistry::GetName(this); -} - -void Subsystem::SetName(std::string_view name) { - wpi::SendableRegistry::SetName(this, name); -} - -std::string Subsystem::GetSubsystem() const { - return wpi::SendableRegistry::GetSubsystem(this); -} - -void Subsystem::SetSubsystem(std::string_view name) { - wpi::SendableRegistry::SetSubsystem(this, name); -} - -void Subsystem::AddChild(std::string name, wpi::Sendable* child) { - wpi::SendableRegistry::AddLW(child, GetSubsystem(), name); -} - void Subsystem::Register() { return CommandScheduler::GetInstance().RegisterSubsystem(this); } @@ -80,33 +54,3 @@ CommandPtr Subsystem::RunEnd(std::function run, std::function end) { return cmd::RunEnd(std::move(run), std::move(end), {this}); } - -void Subsystem::InitSendable(wpi::SendableBuilder& builder) { - builder.SetSmartDashboardType("Subsystem"); - builder.AddBooleanProperty( - ".hasDefault", [this] { return GetDefaultCommand() != nullptr; }, - nullptr); - builder.AddStringProperty( - ".default", - [this]() -> std::string { - auto command = GetDefaultCommand(); - if (command == nullptr) { - return "none"; - } - return command->GetName(); - }, - nullptr); - builder.AddBooleanProperty( - ".hasCommand", [this] { return GetCurrentCommand() != nullptr; }, - nullptr); - builder.AddStringProperty( - ".command", - [this]() -> std::string { - auto command = GetCurrentCommand(); - if (command == nullptr) { - return "none"; - } - return command->GetName(); - }, - nullptr); -} diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/SubsystemBase.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/SubsystemBase.cpp index 71e411999e..8216a07582 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/SubsystemBase.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/SubsystemBase.cpp @@ -12,4 +12,57 @@ using namespace frc2; -SubsystemBase::SubsystemBase() {} +SubsystemBase::SubsystemBase() { + wpi::SendableRegistry::AddLW(this, GetTypeName(*this)); + CommandScheduler::GetInstance().RegisterSubsystem({this}); +} + +void SubsystemBase::InitSendable(wpi::SendableBuilder& builder) { + builder.SetSmartDashboardType("Subsystem"); + builder.AddBooleanProperty( + ".hasDefault", [this] { return GetDefaultCommand() != nullptr; }, + nullptr); + builder.AddStringProperty( + ".default", + [this]() -> std::string { + auto command = GetDefaultCommand(); + if (command == nullptr) { + return "none"; + } + return command->GetName(); + }, + nullptr); + builder.AddBooleanProperty( + ".hasCommand", [this] { return GetCurrentCommand() != nullptr; }, + nullptr); + builder.AddStringProperty( + ".command", + [this]() -> std::string { + auto command = GetCurrentCommand(); + if (command == nullptr) { + return "none"; + } + return command->GetName(); + }, + nullptr); +} + +std::string SubsystemBase::GetName() const { + return wpi::SendableRegistry::GetName(this); +} + +void SubsystemBase::SetName(std::string_view name) { + wpi::SendableRegistry::SetName(this, name); +} + +std::string SubsystemBase::GetSubsystem() const { + return wpi::SendableRegistry::GetSubsystem(this); +} + +void SubsystemBase::SetSubsystem(std::string_view name) { + wpi::SendableRegistry::SetSubsystem(this, name); +} + +void SubsystemBase::AddChild(std::string name, wpi::Sendable* child) { + wpi::SendableRegistry::AddLW(child, GetSubsystem(), name); +} diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/PIDSubsystem.h b/wpilibNewCommands/src/main/native/include/frc2/command/PIDSubsystem.h index 27683ed36d..426e3ecc63 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/PIDSubsystem.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/PIDSubsystem.h @@ -6,7 +6,7 @@ #include -#include "frc2/command/Subsystem.h" +#include "frc2/command/SubsystemBase.h" namespace frc2 { /** @@ -17,7 +17,7 @@ namespace frc2 { * * @see PIDController */ -class PIDSubsystem : public Subsystem { +class PIDSubsystem : public SubsystemBase { public: /** * Creates a new PIDSubsystem. diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDSubsystem.h b/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDSubsystem.h index b78f081bc3..cfdfc6b631 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDSubsystem.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDSubsystem.h @@ -7,7 +7,7 @@ #include #include -#include "frc2/command/Subsystem.h" +#include "frc2/command/SubsystemBase.h" namespace frc2 { /** @@ -19,7 +19,7 @@ namespace frc2 { * @see ProfiledPIDController */ template -class ProfiledPIDSubsystem : public Subsystem { +class ProfiledPIDSubsystem : public SubsystemBase { using Distance_t = units::unit_t; using Velocity = units::compound_unit>; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/Subsystem.h b/wpilibNewCommands/src/main/native/include/frc2/command/Subsystem.h index 791db7096c..dbad8c32f2 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/Subsystem.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/Subsystem.h @@ -6,11 +6,8 @@ #include #include -#include #include -#include - #include "frc2/command/CommandScheduler.h" namespace frc2 { @@ -27,19 +24,22 @@ class CommandPtr; * subsystem should generally remain encapsulated and not be shared by other * parts of the robot. * - *

Subsystems are automatically registered with the scheduler with the + *

Subsystems must be registered with the scheduler with the * CommandScheduler.RegisterSubsystem() method in order for the - * Periodic() method to be called. + * Periodic() method to be called. It is recommended that this method be called + * from the constructor of users' Subsystem implementations. The + * SubsystemBase class offers a simple base for user implementations + * that handles this. * * This class is provided by the NewCommands VendorDep * * @see Command * @see CommandScheduler + * @see SubsystemBase */ -class Subsystem : public wpi::Sendable, public wpi::SendableHelper { +class Subsystem { public: - ~Subsystem() override; - + virtual ~Subsystem(); /** * This method is called periodically by the CommandScheduler. Useful for * updating subsystem-specific state that you don't want to offload to a @@ -111,43 +111,6 @@ class Subsystem : public wpi::Sendable, public wpi::SendableHelper { */ void Register(); - /** - * Gets the name of this Subsystem. - * - * @return Name - */ - std::string GetName() const; - - /** - * Sets the name of this Subsystem. - * - * @param name name - */ - void SetName(std::string_view name); - - /** - * Gets the subsystem name of this Subsystem. - * - * @return Subsystem name - */ - std::string GetSubsystem() const; - - /** - * Sets the subsystem name of this Subsystem. - * - * @param name subsystem name - */ - void SetSubsystem(std::string_view name); - - /** - * Associate a Sendable with this Subsystem. - * Also update the child's name. - * - * @param name name to give child - * @param child sendable - */ - void AddChild(std::string name, wpi::Sendable* child); - /** * Constructs a command that runs an action once and finishes. Requires this * subsystem. @@ -185,10 +148,5 @@ class Subsystem : public wpi::Sendable, public wpi::SendableHelper { */ [[nodiscard]] CommandPtr RunEnd(std::function run, std::function end); - - void InitSendable(wpi::SendableBuilder& builder) override; - - protected: - Subsystem(); }; } // namespace frc2 diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/SubsystemBase.h b/wpilibNewCommands/src/main/native/include/frc2/command/SubsystemBase.h index 7af5463699..86fb026fc1 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/SubsystemBase.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/SubsystemBase.h @@ -4,7 +4,11 @@ #pragma once -#include +#include +#include + +#include +#include #include "frc2/command/Subsystem.h" @@ -14,13 +18,51 @@ namespace frc2 { * provides a more intuitive method for setting the default command. * * This class is provided by the NewCommands VendorDep - * - * @deprecated All functionality provided by SubsystemBase has been merged into - * Subsystem. Use Subsystem instead. */ -class [[deprecated("Use Subsystem instead")]] SubsystemBase : public Subsystem { +class SubsystemBase : public Subsystem, + public wpi::Sendable, + public wpi::SendableHelper { + public: + void InitSendable(wpi::SendableBuilder& builder) override; + + /** + * Gets the name of this Subsystem. + * + * @return Name + */ + std::string GetName() const; + + /** + * Sets the name of this Subsystem. + * + * @param name name + */ + void SetName(std::string_view name); + + /** + * Gets the subsystem name of this Subsystem. + * + * @return Subsystem name + */ + std::string GetSubsystem() const; + + /** + * Sets the subsystem name of this Subsystem. + * + * @param name subsystem name + */ + void SetSubsystem(std::string_view name); + + /** + * Associate a Sendable with this Subsystem. + * Also update the child's name. + * + * @param name name to give child + * @param child sendable + */ + void AddChild(std::string name, wpi::Sendable* child); + protected: - WPI_DEPRECATED("Use Subsystem instead") SubsystemBase(); }; } // namespace frc2 diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileSubsystem.h b/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileSubsystem.h index adfc7f1fe4..344aefc77e 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileSubsystem.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileSubsystem.h @@ -7,7 +7,7 @@ #include #include -#include "frc2/command/Subsystem.h" +#include "frc2/command/SubsystemBase.h" namespace frc2 { /** @@ -18,7 +18,7 @@ namespace frc2 { * This class is provided by the NewCommands VendorDep */ template -class TrapezoidProfileSubsystem : public Subsystem { +class TrapezoidProfileSubsystem : public SubsystemBase { using Distance_t = units::unit_t; using Velocity = units::compound_unit>; diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandRequirementsTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandRequirementsTest.java index a56f62ae48..47657e19ed 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandRequirementsTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandRequirementsTest.java @@ -15,7 +15,7 @@ class CommandRequirementsTest extends CommandTestBase { @Test void requirementInterruptTest() { try (CommandScheduler scheduler = new CommandScheduler()) { - Subsystem requirement = new Subsystem() {}; + Subsystem requirement = new SubsystemBase() {}; MockCommandHolder interruptedHolder = new MockCommandHolder(true, requirement); Command interrupted = interruptedHolder.getMock(); @@ -42,7 +42,7 @@ class CommandRequirementsTest extends CommandTestBase { @Test void requirementUninterruptibleTest() { try (CommandScheduler scheduler = new CommandScheduler()) { - Subsystem requirement = new Subsystem() {}; + Subsystem requirement = new SubsystemBase() {}; Command notInterrupted = new RunCommand(() -> {}, requirement) @@ -61,7 +61,7 @@ class CommandRequirementsTest extends CommandTestBase { @Test void defaultCommandRequirementErrorTest() { try (CommandScheduler scheduler = new CommandScheduler()) { - Subsystem system = new Subsystem() {}; + Subsystem system = new SubsystemBase() {}; Command missingRequirement = new WaitUntilCommand(() -> false); diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ConditionalCommandTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ConditionalCommandTest.java index b24f948ebf..4659f0ec3d 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ConditionalCommandTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ConditionalCommandTest.java @@ -46,9 +46,9 @@ class ConditionalCommandTest extends CommandTestBase { @Test void conditionalCommandRequirementTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; - Subsystem system3 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; + Subsystem system3 = new SubsystemBase() {}; try (CommandScheduler scheduler = new CommandScheduler()) { MockCommandHolder command1Holder = new MockCommandHolder(true, system1, system2); diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/DefaultCommandTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/DefaultCommandTest.java index 9b93fffe8a..23ae47d648 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/DefaultCommandTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/DefaultCommandTest.java @@ -14,7 +14,7 @@ class DefaultCommandTest extends CommandTestBase { @Test void defaultCommandScheduleTest() { try (CommandScheduler scheduler = new CommandScheduler()) { - Subsystem hasDefaultCommand = new Subsystem() {}; + Subsystem hasDefaultCommand = new SubsystemBase() {}; MockCommandHolder defaultHolder = new MockCommandHolder(true, hasDefaultCommand); Command defaultCommand = defaultHolder.getMock(); @@ -29,7 +29,7 @@ class DefaultCommandTest extends CommandTestBase { @Test void defaultCommandInterruptResumeTest() { try (CommandScheduler scheduler = new CommandScheduler()) { - Subsystem hasDefaultCommand = new Subsystem() {}; + Subsystem hasDefaultCommand = new SubsystemBase() {}; MockCommandHolder defaultHolder = new MockCommandHolder(true, hasDefaultCommand); Command defaultCommand = defaultHolder.getMock(); @@ -54,7 +54,7 @@ class DefaultCommandTest extends CommandTestBase { @Test void defaultCommandDisableResumeTest() { try (CommandScheduler scheduler = new CommandScheduler()) { - Subsystem hasDefaultCommand = new Subsystem() {}; + Subsystem hasDefaultCommand = new SubsystemBase() {}; MockCommandHolder defaultHolder = new MockCommandHolder(false, hasDefaultCommand); Command defaultCommand = defaultHolder.getMock(); diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroupTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroupTest.java index 7b7bc2e243..7dc91106ee 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroupTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroupTest.java @@ -90,10 +90,10 @@ class ParallelCommandGroupTest extends CommandTestBase @Test void parallelGroupRequirementTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; - Subsystem system3 = new Subsystem() {}; - Subsystem system4 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; + Subsystem system3 = new SubsystemBase() {}; + Subsystem system4 = new SubsystemBase() {}; try (CommandScheduler scheduler = new CommandScheduler()) { MockCommandHolder command1Holder = new MockCommandHolder(true, system1, system2); @@ -115,9 +115,9 @@ class ParallelCommandGroupTest extends CommandTestBase @Test void parallelGroupRequirementErrorTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; - Subsystem system3 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; + Subsystem system3 = new SubsystemBase() {}; MockCommandHolder command1Holder = new MockCommandHolder(true, system1, system2); Command command1 = command1Holder.getMock(); diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelDeadlineGroupTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelDeadlineGroupTest.java index 31a593fced..6fa644bb24 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelDeadlineGroupTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelDeadlineGroupTest.java @@ -87,10 +87,10 @@ class ParallelDeadlineGroupTest extends CommandTestBase @Test void parallelDeadlineRequirementTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; - Subsystem system3 = new Subsystem() {}; - Subsystem system4 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; + Subsystem system3 = new SubsystemBase() {}; + Subsystem system4 = new SubsystemBase() {}; try (CommandScheduler scheduler = new CommandScheduler()) { MockCommandHolder command1Holder = new MockCommandHolder(true, system1, system2); @@ -112,9 +112,9 @@ class ParallelDeadlineGroupTest extends CommandTestBase @Test void parallelDeadlineRequirementErrorTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; - Subsystem system3 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; + Subsystem system3 = new SubsystemBase() {}; MockCommandHolder command1Holder = new MockCommandHolder(true, system1, system2); Command command1 = command1Holder.getMock(); diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelRaceGroupTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelRaceGroupTest.java index 54785ca1b5..67524960ca 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelRaceGroupTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/ParallelRaceGroupTest.java @@ -92,10 +92,10 @@ class ParallelRaceGroupTest extends CommandTestBase @Test void parallelRaceRequirementTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; - Subsystem system3 = new Subsystem() {}; - Subsystem system4 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; + Subsystem system3 = new SubsystemBase() {}; + Subsystem system4 = new SubsystemBase() {}; try (CommandScheduler scheduler = new CommandScheduler()) { MockCommandHolder command1Holder = new MockCommandHolder(true, system1, system2); @@ -117,9 +117,9 @@ class ParallelRaceGroupTest extends CommandTestBase @Test void parallelRaceRequirementErrorTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; - Subsystem system3 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; + Subsystem system3 = new SubsystemBase() {}; MockCommandHolder command1Holder = new MockCommandHolder(true, system1, system2); Command command1 = command1Holder.getMock(); @@ -131,8 +131,8 @@ class ParallelRaceGroupTest extends CommandTestBase @Test void parallelRaceOnlyCallsEndOnceTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; MockCommandHolder command1Holder = new MockCommandHolder(true, system1); Command command1 = command1Holder.getMock(); diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SchedulerTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SchedulerTest.java index 5d79c447d8..ee1f8eb37c 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SchedulerTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SchedulerTest.java @@ -48,7 +48,7 @@ class SchedulerTest extends CommandTestBase { try (CommandScheduler scheduler = new CommandScheduler()) { AtomicInteger counter = new AtomicInteger(0); Subsystem system = - new Subsystem() { + new SubsystemBase() { @Override public void periodic() { counter.incrementAndGet(); @@ -67,7 +67,7 @@ class SchedulerTest extends CommandTestBase { try (CommandScheduler scheduler = new CommandScheduler()) { AtomicInteger counter = new AtomicInteger(0); Subsystem system = - new Subsystem() { + new SubsystemBase() { @Override public void periodic() { counter.incrementAndGet(); diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SchedulingRecursionTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SchedulingRecursionTest.java index 79ee60c7ae..4b14b25cd8 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SchedulingRecursionTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SchedulingRecursionTest.java @@ -25,7 +25,7 @@ class SchedulingRecursionTest extends CommandTestBase { void cancelFromInitialize(InterruptionBehavior interruptionBehavior) { try (CommandScheduler scheduler = new CommandScheduler()) { AtomicBoolean hasOtherRun = new AtomicBoolean(); - Subsystem requirement = new Subsystem() {}; + Subsystem requirement = new SubsystemBase() {}; Command selfCancels = new Command() { { @@ -62,7 +62,7 @@ class SchedulingRecursionTest extends CommandTestBase { void defaultCommandGetsRescheduledAfterSelfCanceling(InterruptionBehavior interruptionBehavior) { try (CommandScheduler scheduler = new CommandScheduler()) { AtomicBoolean hasOtherRun = new AtomicBoolean(); - Subsystem requirement = new Subsystem() {}; + Subsystem requirement = new SubsystemBase() {}; Command selfCancels = new Command() { { @@ -119,7 +119,7 @@ class SchedulingRecursionTest extends CommandTestBase { void scheduleFromEndCancel() { try (CommandScheduler scheduler = new CommandScheduler()) { AtomicInteger counter = new AtomicInteger(); - Subsystem requirement = new Subsystem() {}; + Subsystem requirement = new SubsystemBase() {}; InstantCommand other = new InstantCommand(() -> {}, requirement); Command selfCancels = new Command() { @@ -146,7 +146,7 @@ class SchedulingRecursionTest extends CommandTestBase { void scheduleFromEndInterrupt() { try (CommandScheduler scheduler = new CommandScheduler()) { AtomicInteger counter = new AtomicInteger(); - Subsystem requirement = new Subsystem() {}; + Subsystem requirement = new SubsystemBase() {}; InstantCommand other = new InstantCommand(() -> {}, requirement); Command selfCancels = new Command() { @@ -175,7 +175,7 @@ class SchedulingRecursionTest extends CommandTestBase { void scheduleInitializeFromDefaultCommand(InterruptionBehavior interruptionBehavior) { try (CommandScheduler scheduler = new CommandScheduler()) { AtomicInteger counter = new AtomicInteger(); - Subsystem requirement = new Subsystem() {}; + Subsystem requirement = new SubsystemBase() {}; Command other = new InstantCommand(() -> {}, requirement).withInterruptBehavior(interruptionBehavior); Command defaultCommand = diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SelectCommandTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SelectCommandTest.java index 0bca07e0ca..736f120a97 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SelectCommandTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SelectCommandTest.java @@ -75,10 +75,10 @@ class SelectCommandTest extends CommandTestBase implements MultiCompositionTestB @Test void selectCommandRequirementTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; - Subsystem system3 = new Subsystem() {}; - Subsystem system4 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; + Subsystem system3 = new SubsystemBase() {}; + Subsystem system4 = new SubsystemBase() {}; try (CommandScheduler scheduler = new CommandScheduler()) { MockCommandHolder command1Holder = new MockCommandHolder(true, system1, system2); diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SequentialCommandGroupTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SequentialCommandGroupTest.java index a9e5120be6..ff578f45d4 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SequentialCommandGroupTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SequentialCommandGroupTest.java @@ -100,10 +100,10 @@ class SequentialCommandGroupTest extends CommandTestBase @Test void sequentialGroupRequirementTest() { - Subsystem system1 = new Subsystem() {}; - Subsystem system2 = new Subsystem() {}; - Subsystem system3 = new Subsystem() {}; - Subsystem system4 = new Subsystem() {}; + Subsystem system1 = new SubsystemBase() {}; + Subsystem system2 = new SubsystemBase() {}; + Subsystem system3 = new SubsystemBase() {}; + Subsystem system4 = new SubsystemBase() {}; try (CommandScheduler scheduler = new CommandScheduler()) { MockCommandHolder command1Holder = new MockCommandHolder(true, system1, system2); diff --git a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandTestBase.h b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandTestBase.h index f7261c66d8..8fb507072e 100644 --- a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandTestBase.h +++ b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandTestBase.h @@ -13,13 +13,13 @@ #include "frc2/command/CommandHelper.h" #include "frc2/command/CommandScheduler.h" -#include "frc2/command/Subsystem.h" +#include "frc2/command/SubsystemBase.h" #include "gmock/gmock.h" #include "make_vector.h" namespace frc2 { -class TestSubsystem : public Subsystem { +class TestSubsystem : public SubsystemBase { public: explicit TestSubsystem(std::function periodic = [] {}) : m_periodic{periodic} {} diff --git a/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.h b/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.h index e3f455f2e6..ca11456d43 100644 --- a/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.h +++ b/wpilibcExamples/src/main/cpp/commands/subsystem2/ReplaceMeSubsystem2.h @@ -4,9 +4,9 @@ #pragma once -#include +#include -class ReplaceMeSubsystem2 : public frc2::Subsystem { +class ReplaceMeSubsystem2 : public frc2::SubsystemBase { public: ReplaceMeSubsystem2(); diff --git a/wpilibcExamples/src/main/cpp/examples/ArmBot/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/ArmBot/include/subsystems/DriveSubsystem.h index 9146454b03..47bf28e4d9 100644 --- a/wpilibcExamples/src/main/cpp/examples/ArmBot/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/ArmBot/include/subsystems/DriveSubsystem.h @@ -8,11 +8,11 @@ #include #include #include -#include +#include #include "Constants.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/ArmBotOffboard/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/ArmBotOffboard/include/subsystems/DriveSubsystem.h index 054c819d68..6830b960d0 100644 --- a/wpilibcExamples/src/main/cpp/examples/ArmBotOffboard/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/ArmBotOffboard/include/subsystems/DriveSubsystem.h @@ -11,11 +11,11 @@ #include #include #include -#include +#include #include "Constants.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/DriveDistanceOffboard/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/DriveDistanceOffboard/include/subsystems/DriveSubsystem.h index 5e64e53837..9086353bf9 100644 --- a/wpilibcExamples/src/main/cpp/examples/DriveDistanceOffboard/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/DriveDistanceOffboard/include/subsystems/DriveSubsystem.h @@ -8,13 +8,13 @@ #include #include #include -#include +#include #include #include "Constants.h" #include "ExampleSmartMotorController.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/Frisbeebot/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/Frisbeebot/include/subsystems/DriveSubsystem.h index 9146454b03..47bf28e4d9 100644 --- a/wpilibcExamples/src/main/cpp/examples/Frisbeebot/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/Frisbeebot/include/subsystems/DriveSubsystem.h @@ -8,11 +8,11 @@ #include #include #include -#include +#include #include "Constants.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/include/subsystems/Claw.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/include/subsystems/Claw.h index 048ffb568a..c6f17d84a2 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/include/subsystems/Claw.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/include/subsystems/Claw.h @@ -6,14 +6,14 @@ #include #include -#include +#include /** * The claw subsystem is a simple system with a motor for opening and closing. * If using stronger motors, you should probably use a sensor so that the * motors don't stall. */ -class Claw : public frc2::Subsystem { +class Claw : public frc2::SubsystemBase { public: Claw(); diff --git a/wpilibcExamples/src/main/cpp/examples/GearsBot/include/subsystems/Drivetrain.h b/wpilibcExamples/src/main/cpp/examples/GearsBot/include/subsystems/Drivetrain.h index 7a84dbef4b..9e739c4dbc 100644 --- a/wpilibcExamples/src/main/cpp/examples/GearsBot/include/subsystems/Drivetrain.h +++ b/wpilibcExamples/src/main/cpp/examples/GearsBot/include/subsystems/Drivetrain.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace frc { class Joystick; @@ -21,7 +21,7 @@ class Joystick; * the robots chassis. These include four drive motors, a left and right encoder * and a gyro. */ -class Drivetrain : public frc2::Subsystem { +class Drivetrain : public frc2::SubsystemBase { public: Drivetrain(); diff --git a/wpilibcExamples/src/main/cpp/examples/GyroDriveCommands/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/GyroDriveCommands/include/subsystems/DriveSubsystem.h index 5ea5db37d0..96174dd4f7 100644 --- a/wpilibcExamples/src/main/cpp/examples/GyroDriveCommands/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/GyroDriveCommands/include/subsystems/DriveSubsystem.h @@ -9,12 +9,12 @@ #include #include #include -#include +#include #include #include "Constants.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/subsystems/DriveSubsystem.cpp b/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/subsystems/DriveSubsystem.cpp index 0ed075a7af..3372a4dca9 100644 --- a/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/subsystems/DriveSubsystem.cpp +++ b/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/subsystems/DriveSubsystem.cpp @@ -47,7 +47,7 @@ void DriveSubsystem::SetMaxOutput(double maxOutput) { } void DriveSubsystem::InitSendable(wpi::SendableBuilder& builder) { - Subsystem::InitSendable(builder); + SubsystemBase::InitSendable(builder); // Publish encoder distances to telemetry. builder.AddDoubleProperty( diff --git a/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/subsystems/HatchSubsystem.cpp b/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/subsystems/HatchSubsystem.cpp index bd79d2b074..449465bb49 100644 --- a/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/subsystems/HatchSubsystem.cpp +++ b/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/subsystems/HatchSubsystem.cpp @@ -25,7 +25,7 @@ frc2::CommandPtr HatchSubsystem::ReleaseHatchCommand() { } void HatchSubsystem::InitSendable(wpi::SendableBuilder& builder) { - Subsystem::InitSendable(builder); + SubsystemBase::InitSendable(builder); // Publish the solenoid state to telemetry. builder.AddBooleanProperty( diff --git a/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/include/subsystems/DriveSubsystem.h index 72c88e299f..5984a1a4f3 100644 --- a/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/include/subsystems/DriveSubsystem.h @@ -8,11 +8,11 @@ #include #include #include -#include +#include #include "Constants.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/include/subsystems/HatchSubsystem.h b/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/include/subsystems/HatchSubsystem.h index 9d0c9b5559..e81f3b2d79 100644 --- a/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/include/subsystems/HatchSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/include/subsystems/HatchSubsystem.h @@ -7,11 +7,11 @@ #include #include #include -#include +#include #include "Constants.h" -class HatchSubsystem : public frc2::Subsystem { +class HatchSubsystem : public frc2::SubsystemBase { public: HatchSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/cpp/subsystems/DriveSubsystem.cpp b/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/cpp/subsystems/DriveSubsystem.cpp index 0ed075a7af..3372a4dca9 100644 --- a/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/cpp/subsystems/DriveSubsystem.cpp +++ b/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/cpp/subsystems/DriveSubsystem.cpp @@ -47,7 +47,7 @@ void DriveSubsystem::SetMaxOutput(double maxOutput) { } void DriveSubsystem::InitSendable(wpi::SendableBuilder& builder) { - Subsystem::InitSendable(builder); + SubsystemBase::InitSendable(builder); // Publish encoder distances to telemetry. builder.AddDoubleProperty( diff --git a/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/cpp/subsystems/HatchSubsystem.cpp b/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/cpp/subsystems/HatchSubsystem.cpp index ae1b26c150..975141fe1c 100644 --- a/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/cpp/subsystems/HatchSubsystem.cpp +++ b/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/cpp/subsystems/HatchSubsystem.cpp @@ -21,7 +21,7 @@ void HatchSubsystem::ReleaseHatch() { } void HatchSubsystem::InitSendable(wpi::SendableBuilder& builder) { - Subsystem::InitSendable(builder); + SubsystemBase::InitSendable(builder); // Publish the solenoid state to telemetry. builder.AddBooleanProperty( diff --git a/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/include/subsystems/DriveSubsystem.h index 72c88e299f..5984a1a4f3 100644 --- a/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/include/subsystems/DriveSubsystem.h @@ -8,11 +8,11 @@ #include #include #include -#include +#include #include "Constants.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/include/subsystems/HatchSubsystem.h b/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/include/subsystems/HatchSubsystem.h index 61ef97f6d0..392e9b20ab 100644 --- a/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/include/subsystems/HatchSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional/include/subsystems/HatchSubsystem.h @@ -6,11 +6,11 @@ #include #include -#include +#include #include "Constants.h" -class HatchSubsystem : public frc2::Subsystem { +class HatchSubsystem : public frc2::SubsystemBase { public: HatchSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/include/subsystems/DriveSubsystem.h index 2ecf9ea85d..579a3950ea 100644 --- a/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/MecanumControllerCommand/include/subsystems/DriveSubsystem.h @@ -13,11 +13,11 @@ #include #include #include -#include +#include #include "Constants.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/RamseteCommand/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/RamseteCommand/include/subsystems/DriveSubsystem.h index 49f717214c..8ea14dad39 100644 --- a/wpilibcExamples/src/main/cpp/examples/RamseteCommand/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/RamseteCommand/include/subsystems/DriveSubsystem.h @@ -11,12 +11,12 @@ #include #include #include -#include +#include #include #include "Constants.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Drive.h b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Drive.h index 0d98091ab8..ac96c52839 100644 --- a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Drive.h +++ b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Drive.h @@ -11,12 +11,12 @@ #include #include #include -#include +#include #include #include "Constants.h" -class Drive : public frc2::Subsystem { +class Drive : public frc2::SubsystemBase { public: Drive(); /** diff --git a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Intake.h b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Intake.h index be5aa43f9b..111353a0f5 100644 --- a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Intake.h +++ b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Intake.h @@ -9,11 +9,11 @@ #include #include #include -#include +#include #include "Constants.h" -class Intake : public frc2::Subsystem { +class Intake : public frc2::SubsystemBase { public: Intake() = default; diff --git a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Pneumatics.h b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Pneumatics.h index dfd37b8cdf..0c1fee92a9 100644 --- a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Pneumatics.h +++ b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Pneumatics.h @@ -8,12 +8,12 @@ #include #include #include -#include +#include #include #include "Constants.h" -class Pneumatics : frc2::Subsystem { +class Pneumatics : frc2::SubsystemBase { public: Pneumatics(); /** Returns a command that disables the compressor indefinitely. */ diff --git a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h index d3d98fc81d..b31155934f 100644 --- a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h +++ b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h @@ -11,13 +11,13 @@ #include #include #include -#include +#include #include #include #include "Constants.h" -class Shooter : public frc2::Subsystem { +class Shooter : public frc2::SubsystemBase { public: Shooter(); diff --git a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Storage.h b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Storage.h index 5f0340f4bd..58694b3035 100644 --- a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Storage.h +++ b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Storage.h @@ -7,11 +7,11 @@ #include #include #include -#include +#include #include "Constants.h" -class Storage : frc2::Subsystem { +class Storage : frc2::SubsystemBase { public: Storage(); /** Returns a command that runs the storage motor indefinitely. */ diff --git a/wpilibcExamples/src/main/cpp/examples/RomiReference/include/subsystems/Drivetrain.h b/wpilibcExamples/src/main/cpp/examples/RomiReference/include/subsystems/Drivetrain.h index 055d6eefa3..98ae9574b0 100644 --- a/wpilibcExamples/src/main/cpp/examples/RomiReference/include/subsystems/Drivetrain.h +++ b/wpilibcExamples/src/main/cpp/examples/RomiReference/include/subsystems/Drivetrain.h @@ -8,12 +8,12 @@ #include #include #include -#include +#include #include #include "sensors/RomiGyro.h" -class Drivetrain : public frc2::Subsystem { +class Drivetrain : public frc2::SubsystemBase { public: static constexpr double kCountsPerRevolution = 1440.0; static constexpr units::meter_t kWheelDiameter = 70_mm; diff --git a/wpilibcExamples/src/main/cpp/examples/RomiReference/include/subsystems/OnBoardIO.h b/wpilibcExamples/src/main/cpp/examples/RomiReference/include/subsystems/OnBoardIO.h index 8dd8e0b87d..0bb5225bc9 100644 --- a/wpilibcExamples/src/main/cpp/examples/RomiReference/include/subsystems/OnBoardIO.h +++ b/wpilibcExamples/src/main/cpp/examples/RomiReference/include/subsystems/OnBoardIO.h @@ -8,7 +8,7 @@ #include #include -#include +#include /** * This class represents the onboard IO of the Romi @@ -20,7 +20,7 @@ * DIO 2 - Button C (input) or Red LED (output) * DIO 3 - Yellow LED (output only) */ -class OnBoardIO : public frc2::Subsystem { +class OnBoardIO : public frc2::SubsystemBase { public: enum ChannelMode { INPUT, OUTPUT }; OnBoardIO(OnBoardIO::ChannelMode dio1, OnBoardIO::ChannelMode dio2); diff --git a/wpilibcExamples/src/main/cpp/examples/StateSpaceDifferentialDriveSimulation/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/StateSpaceDifferentialDriveSimulation/include/subsystems/DriveSubsystem.h index 63bac54f75..57392c723b 100644 --- a/wpilibcExamples/src/main/cpp/examples/StateSpaceDifferentialDriveSimulation/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/StateSpaceDifferentialDriveSimulation/include/subsystems/DriveSubsystem.h @@ -15,12 +15,12 @@ #include #include #include -#include +#include #include #include "Constants.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/include/subsystems/DriveSubsystem.h b/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/include/subsystems/DriveSubsystem.h index f3cad50dbd..b7b47fc128 100644 --- a/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/include/subsystems/DriveSubsystem.h +++ b/wpilibcExamples/src/main/cpp/examples/SwerveControllerCommand/include/subsystems/DriveSubsystem.h @@ -14,12 +14,12 @@ #include #include #include -#include +#include #include "Constants.h" #include "SwerveModule.h" -class DriveSubsystem : public frc2::Subsystem { +class DriveSubsystem : public frc2::SubsystemBase { public: DriveSubsystem(); diff --git a/wpilibcExamples/src/main/cpp/templates/commandbased/include/subsystems/ExampleSubsystem.h b/wpilibcExamples/src/main/cpp/templates/commandbased/include/subsystems/ExampleSubsystem.h index 2dd60e233b..669f2eda06 100644 --- a/wpilibcExamples/src/main/cpp/templates/commandbased/include/subsystems/ExampleSubsystem.h +++ b/wpilibcExamples/src/main/cpp/templates/commandbased/include/subsystems/ExampleSubsystem.h @@ -5,9 +5,9 @@ #pragma once #include -#include +#include -class ExampleSubsystem : public frc2::Subsystem { +class ExampleSubsystem : public frc2::SubsystemBase { public: ExampleSubsystem(); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/commands/subsystem2/ReplaceMeSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/commands/subsystem2/ReplaceMeSubsystem.java index c87ca2bfc0..f72539d712 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/commands/subsystem2/ReplaceMeSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/commands/subsystem2/ReplaceMeSubsystem.java @@ -4,9 +4,9 @@ package edu.wpi.first.wpilibj.commands.subsystem2; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class ReplaceMeSubsystem extends Subsystem { +public class ReplaceMeSubsystem extends SubsystemBase { /** Creates a new ReplaceMeSubsystem. */ public ReplaceMeSubsystem() {} diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/armbot/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/armbot/subsystems/DriveSubsystem.java index 86b28c69a2..4ecaa77231 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/armbot/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/armbot/subsystems/DriveSubsystem.java @@ -9,9 +9,9 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.examples.armbot.Constants.DriveConstants; import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // The motors on the left side of the drive. private final MotorControllerGroup m_leftMotors = new MotorControllerGroup( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/armbotoffboard/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/armbotoffboard/subsystems/DriveSubsystem.java index 805fe91769..e3c9159537 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/armbotoffboard/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/armbotoffboard/subsystems/DriveSubsystem.java @@ -11,10 +11,10 @@ import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; import java.util.function.DoubleSupplier; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // The motors on the left side of the drive. private final MotorControllerGroup m_leftMotors = new MotorControllerGroup( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/drivedistanceoffboard/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/drivedistanceoffboard/subsystems/DriveSubsystem.java index 687448fc6f..520261d402 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/drivedistanceoffboard/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/drivedistanceoffboard/subsystems/DriveSubsystem.java @@ -9,9 +9,9 @@ import edu.wpi.first.math.trajectory.TrapezoidProfile; import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.examples.drivedistanceoffboard.Constants.DriveConstants; import edu.wpi.first.wpilibj.examples.drivedistanceoffboard.ExampleSmartMotorController; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // The motors on the left side of the drive. private final ExampleSmartMotorController m_leftLeader = new ExampleSmartMotorController(DriveConstants.kLeftMotor1Port); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/frisbeebot/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/frisbeebot/subsystems/DriveSubsystem.java index 201e94c756..5773da182d 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/frisbeebot/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/frisbeebot/subsystems/DriveSubsystem.java @@ -9,9 +9,9 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.examples.frisbeebot.Constants.DriveConstants; import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // The motors on the left side of the drive. private final MotorControllerGroup m_leftMotors = new MotorControllerGroup( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Claw.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Claw.java index 092c01a411..06c627e480 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Claw.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Claw.java @@ -8,13 +8,13 @@ import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.examples.gearsbot.Constants.ClawConstants; import edu.wpi.first.wpilibj.motorcontrol.Victor; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; /** * The claw subsystem is a simple system with a motor for opening and closing. If using stronger * motors, you should probably use a sensor so that the motors don't stall. */ -public class Claw extends Subsystem { +public class Claw extends SubsystemBase { private final Victor m_motor = new Victor(ClawConstants.kMotorPort); private final DigitalInput m_contact = new DigitalInput(ClawConstants.kContactPort); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Drivetrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Drivetrain.java index b95adacac9..ffde63d402 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Drivetrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot/subsystems/Drivetrain.java @@ -14,9 +14,9 @@ import edu.wpi.first.wpilibj.motorcontrol.MotorController; import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class Drivetrain extends Subsystem { +public class Drivetrain extends SubsystemBase { /** * The Drivetrain subsystem incorporates the sensors and actuators attached to the robots chassis. * These include four drive motors, a left and right encoder and a gyro. diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyrodrivecommands/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyrodrivecommands/subsystems/DriveSubsystem.java index 8084ed0c85..9adb6ec0f9 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyrodrivecommands/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyrodrivecommands/subsystems/DriveSubsystem.java @@ -10,9 +10,9 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.examples.gyrodrivecommands.Constants.DriveConstants; import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // The motors on the left side of the drive. private final MotorControllerGroup m_leftMotors = new MotorControllerGroup( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/subsystems/DriveSubsystem.java index 2087cf82bc..1376195dc1 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/subsystems/DriveSubsystem.java @@ -10,9 +10,9 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.examples.hatchbotinlined.Constants.DriveConstants; import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // The motors on the left side of the drive. private final MotorControllerGroup m_leftMotors = new MotorControllerGroup( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/subsystems/HatchSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/subsystems/HatchSubsystem.java index 37de6a386b..ec489be1ed 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/subsystems/HatchSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/subsystems/HatchSubsystem.java @@ -12,10 +12,10 @@ import edu.wpi.first.wpilibj.DoubleSolenoid; import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj.examples.hatchbotinlined.Constants.HatchConstants; import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; /** A hatch mechanism actuated by a single {@link edu.wpi.first.wpilibj.DoubleSolenoid}. */ -public class HatchSubsystem extends Subsystem { +public class HatchSubsystem extends SubsystemBase { private final DoubleSolenoid m_hatchSolenoid = new DoubleSolenoid( PneumaticsModuleType.CTREPCM, diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbottraditional/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbottraditional/subsystems/DriveSubsystem.java index 8eab2b4f00..8a5296d860 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbottraditional/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbottraditional/subsystems/DriveSubsystem.java @@ -10,9 +10,9 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.examples.hatchbottraditional.Constants.DriveConstants; import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // The motors on the left side of the drive. private final MotorControllerGroup m_leftMotors = new MotorControllerGroup( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbottraditional/subsystems/HatchSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbottraditional/subsystems/HatchSubsystem.java index c5c026df83..fcef9e244f 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbottraditional/subsystems/HatchSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbottraditional/subsystems/HatchSubsystem.java @@ -11,10 +11,10 @@ import edu.wpi.first.util.sendable.SendableBuilder; import edu.wpi.first.wpilibj.DoubleSolenoid; import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj.examples.hatchbottraditional.Constants.HatchConstants; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; /** A hatch mechanism actuated by a single {@link DoubleSolenoid}. */ -public class HatchSubsystem extends Subsystem { +public class HatchSubsystem extends SubsystemBase { private final DoubleSolenoid m_hatchSolenoid = new DoubleSolenoid( PneumaticsModuleType.CTREPCM, diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumcontrollercommand/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumcontrollercommand/subsystems/DriveSubsystem.java index 8edf323c07..6d731bad42 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumcontrollercommand/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumcontrollercommand/subsystems/DriveSubsystem.java @@ -14,9 +14,9 @@ import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.drive.MecanumDrive; import edu.wpi.first.wpilibj.examples.mecanumcontrollercommand.Constants.DriveConstants; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { private final PWMSparkMax m_frontLeft = new PWMSparkMax(DriveConstants.kFrontLeftMotorPort); private final PWMSparkMax m_rearLeft = new PWMSparkMax(DriveConstants.kRearLeftMotorPort); private final PWMSparkMax m_frontRight = new PWMSparkMax(DriveConstants.kFrontRightMotorPort); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ramsetecommand/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ramsetecommand/subsystems/DriveSubsystem.java index e3d5968461..288baeda4b 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ramsetecommand/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ramsetecommand/subsystems/DriveSubsystem.java @@ -13,9 +13,9 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.examples.ramsetecommand.Constants.DriveConstants; import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // The motors on the left side of the drive. private final MotorControllerGroup m_leftMotors = new MotorControllerGroup( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Drive.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Drive.java index 4bb7f8c9bb..736ff446da 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Drive.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Drive.java @@ -10,10 +10,10 @@ import edu.wpi.first.wpilibj.examples.rapidreactcommandbot.Constants.DriveConsta import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; import java.util.function.DoubleSupplier; -public class Drive extends Subsystem { +public class Drive extends SubsystemBase { // The motors on the left side of the drive. private final MotorControllerGroup m_leftMotors = new MotorControllerGroup( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Intake.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Intake.java index e419f753fd..0f242dfae0 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Intake.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Intake.java @@ -10,9 +10,9 @@ import edu.wpi.first.wpilibj.DoubleSolenoid; import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class Intake extends Subsystem { +public class Intake extends SubsystemBase { private final PWMSparkMax m_motor = new PWMSparkMax(IntakeConstants.kMotorPort); // Double solenoid connected to two channels of a PCM with the default CAN ID diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Pneumatics.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Pneumatics.java index b62f12fce9..69ec023543 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Pneumatics.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Pneumatics.java @@ -9,10 +9,10 @@ import edu.wpi.first.wpilibj.Compressor; import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; /** Subsystem for managing the compressor, pressure sensor, etc. */ -public class Pneumatics extends Subsystem { +public class Pneumatics extends SubsystemBase { // External analog pressure sensor // product-specific voltage->pressure conversion, see product manual // in this case, 250(V/5)-25 diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Shooter.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Shooter.java index fc34af6914..0e7f9b56ce 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Shooter.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Shooter.java @@ -13,9 +13,9 @@ import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.examples.frisbeebot.Constants.ShooterConstants; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class Shooter extends Subsystem { +public class Shooter extends SubsystemBase { private final PWMSparkMax m_shooterMotor = new PWMSparkMax(ShooterConstants.kShooterMotorPort); private final PWMSparkMax m_feederMotor = new PWMSparkMax(ShooterConstants.kFeederMotorPort); private final Encoder m_shooterEncoder = diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Storage.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Storage.java index 89683ee35c..dac61a43fc 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Storage.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/subsystems/Storage.java @@ -9,9 +9,9 @@ import static edu.wpi.first.wpilibj.examples.rapidreactcommandbot.Constants.Stor import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class Storage extends Subsystem { +public class Storage extends SubsystemBase { private final PWMSparkMax m_motor = new PWMSparkMax(StorageConstants.kMotorPort); private final DigitalInput m_ballSensor = new DigitalInput(StorageConstants.kBallSensorPort); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/romireference/subsystems/Drivetrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/romireference/subsystems/Drivetrain.java index 98b43d6c53..a7c84320a6 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/romireference/subsystems/Drivetrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/romireference/subsystems/Drivetrain.java @@ -9,9 +9,9 @@ import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.examples.romireference.sensors.RomiGyro; import edu.wpi.first.wpilibj.motorcontrol.Spark; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class Drivetrain extends Subsystem { +public class Drivetrain extends SubsystemBase { private static final double kCountsPerRevolution = 1440.0; private static final double kWheelDiameterInch = 2.75591; // 70 mm diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/romireference/subsystems/OnBoardIO.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/romireference/subsystems/OnBoardIO.java index 4c16953862..0199f6a8ba 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/romireference/subsystems/OnBoardIO.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/romireference/subsystems/OnBoardIO.java @@ -8,7 +8,7 @@ import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.DigitalOutput; import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj.Timer; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; /** * This class represents the onboard IO of the Romi reference robot. This includes the pushbuttons @@ -17,7 +17,7 @@ import edu.wpi.first.wpilibj2.command.Subsystem; *

DIO 0 - Button A (input only) DIO 1 - Button B (input) or Green LED (output) DIO 2 - Button C * (input) or Red LED (output) DIO 3 - Yellow LED (output only) */ -public class OnBoardIO extends Subsystem { +public class OnBoardIO extends SubsystemBase { private final DigitalInput m_buttonA = new DigitalInput(0); private final DigitalOutput m_yellowLed = new DigitalOutput(3); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespacedifferentialdrivesimulation/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespacedifferentialdrivesimulation/subsystems/DriveSubsystem.java index cd33abbbb2..406178a8ab 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespacedifferentialdrivesimulation/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespacedifferentialdrivesimulation/subsystems/DriveSubsystem.java @@ -22,9 +22,9 @@ import edu.wpi.first.wpilibj.simulation.DifferentialDrivetrainSim; import edu.wpi.first.wpilibj.simulation.EncoderSim; import edu.wpi.first.wpilibj.smartdashboard.Field2d; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // The motors on the left side of the drive. private final MotorControllerGroup m_leftMotors = new MotorControllerGroup( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervecontrollercommand/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervecontrollercommand/subsystems/DriveSubsystem.java index e1f8528a26..04ee2998df 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervecontrollercommand/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervecontrollercommand/subsystems/DriveSubsystem.java @@ -12,9 +12,9 @@ import edu.wpi.first.math.kinematics.SwerveModulePosition; import edu.wpi.first.math.kinematics.SwerveModuleState; import edu.wpi.first.wpilibj.ADXRS450_Gyro; import edu.wpi.first.wpilibj.examples.swervecontrollercommand.Constants.DriveConstants; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class DriveSubsystem extends Subsystem { +public class DriveSubsystem extends SubsystemBase { // Robot swerve modules private final SwerveModule m_frontLeft = new SwerveModule( diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/Arm.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/Arm.java index e3082ba573..61b1d5b226 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/Arm.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/Arm.java @@ -5,9 +5,9 @@ package edu.wpi.first.wpilibj.examples.xrpreference.subsystems; import edu.wpi.first.wpilibj.examples.xrpreference.devices.XRPServo; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class Arm extends Subsystem { +public class Arm extends SubsystemBase { private final XRPServo m_armServo; /** Creates a new Arm. */ diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/Drivetrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/Drivetrain.java index a5082c016d..e15ea6cf4f 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/Drivetrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/Drivetrain.java @@ -9,9 +9,9 @@ import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.examples.xrpreference.devices.XRPMotor; import edu.wpi.first.wpilibj.examples.xrpreference.sensors.XRPGyro; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class Drivetrain extends Subsystem { +public class Drivetrain extends SubsystemBase { private static final double kGearRatio = (30.0 / 14.0) * (28.0 / 16.0) * (36.0 / 9.0) * (26.0 / 8.0); // 48.75:1 private static final double kCountsPerMotorShaftRev = 12.0; diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/XRPOnBoardIO.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/XRPOnBoardIO.java index f647728009..c52ebc08fa 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/XRPOnBoardIO.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference/subsystems/XRPOnBoardIO.java @@ -6,13 +6,13 @@ package edu.wpi.first.wpilibj.examples.xrpreference.subsystems; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.DigitalOutput; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; /** * This class represents the onboard IO of the XRP Reference Robot. This includes the USER * pushbutton and LED */ -public class XRPOnBoardIO extends Subsystem { +public class XRPOnBoardIO extends SubsystemBase { private final DigitalInput m_button = new DigitalInput(0); private final DigitalOutput m_led = new DigitalOutput(1); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/subsystems/ExampleSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/subsystems/ExampleSubsystem.java index 76e8020e1f..1c62fdbef2 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/subsystems/ExampleSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/commandbased/subsystems/ExampleSubsystem.java @@ -5,9 +5,9 @@ package edu.wpi.first.wpilibj.templates.commandbased.subsystems; import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class ExampleSubsystem extends Subsystem { +public class ExampleSubsystem extends SubsystemBase { /** Creates a new ExampleSubsystem. */ public ExampleSubsystem() {} diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/romicommandbased/subsystems/RomiDrivetrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/romicommandbased/subsystems/RomiDrivetrain.java index 0b99a94a25..276e5cee7d 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/romicommandbased/subsystems/RomiDrivetrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/romicommandbased/subsystems/RomiDrivetrain.java @@ -7,9 +7,9 @@ package edu.wpi.first.wpilibj.templates.romicommandbased.subsystems; import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.motorcontrol.Spark; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class RomiDrivetrain extends Subsystem { +public class RomiDrivetrain extends SubsystemBase { private static final double kCountsPerRevolution = 1440.0; private static final double kWheelDiameterInch = 2.75591; // 70 mm diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/xrpcommandbased/subsystems/XRPDrivetrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/xrpcommandbased/subsystems/XRPDrivetrain.java index ed8b0f6c0f..e8e6eb63f4 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/xrpcommandbased/subsystems/XRPDrivetrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/templates/xrpcommandbased/subsystems/XRPDrivetrain.java @@ -7,9 +7,9 @@ package edu.wpi.first.wpilibj.templates.xrpcommandbased.subsystems; import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.templates.xrpcommandbased.devices.XRPMotor; -import edu.wpi.first.wpilibj2.command.Subsystem; +import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class XRPDrivetrain extends Subsystem { +public class XRPDrivetrain extends SubsystemBase { private static final double kGearRatio = (30.0 / 14.0) * (28.0 / 16.0) * (36.0 / 9.0) * (26.0 / 8.0); // 48.75:1 private static final double kCountsPerMotorShaftRev = 12.0;