[commands] Revert SubsystemBase deprecation/removal (#5634)

This commit is contained in:
Ryan Blue
2023-09-14 23:56:48 -04:00
committed by GitHub
parent bc7f23a632
commit 3b79cb6ed3
80 changed files with 370 additions and 375 deletions

View File

@@ -6,11 +6,8 @@
#include <concepts>
#include <functional>
#include <string>
#include <utility>
#include <wpi/sendable/Sendable.h>
#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.
*
* <p>Subsystems are automatically registered with the scheduler with the
* <p>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<Subsystem> {
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<Subsystem> {
*/
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<Subsystem> {
*/
[[nodiscard]]
CommandPtr RunEnd(std::function<void()> run, std::function<void()> end);
void InitSendable(wpi::SendableBuilder& builder) override;
protected:
Subsystem();
};
} // namespace frc2