![]() |
WPILibC++ 2027.0.0-alpha-2
|
A base for subsystems that handles registration in the constructor, and provides a more intuitive method for setting the default command. More...
#include <frc2/command/SubsystemBase.h>
Public Member Functions | |
| void | InitSendable (wpi::SendableBuilder &builder) override |
| Initializes this Sendable object. | |
| std::string | GetName () const override |
| Gets the name of this Subsystem. | |
| void | SetName (std::string_view name) |
| Sets the name of this Subsystem. | |
| std::string | GetSubsystem () const |
| Gets the subsystem name of this Subsystem. | |
| void | SetSubsystem (std::string_view name) |
| Sets the subsystem name of this Subsystem. | |
| void | AddChild (std::string name, wpi::Sendable *child) |
| Associate a Sendable with this Subsystem. | |
Public Member Functions inherited from frc2::Subsystem | |
| virtual | ~Subsystem () |
| virtual void | Periodic () |
| This method is called periodically by the CommandScheduler. | |
| virtual void | SimulationPeriodic () |
| This method is called periodically by the CommandScheduler. | |
| template<std::derived_from< Command > T> | |
| void | SetDefaultCommand (T &&defaultCommand) |
| Sets the default Command of the subsystem. | |
| void | SetDefaultCommand (CommandPtr &&defaultCommand) |
| Sets the default Command of the subsystem. | |
| void | RemoveDefaultCommand () |
| Removes the default command for the subsystem. | |
| Command * | GetDefaultCommand () const |
| Gets the default command for this subsystem. | |
| Command * | GetCurrentCommand () const |
| Returns the command currently running on this subsystem. | |
| void | Register () |
| Registers this subsystem with the CommandScheduler, allowing its Periodic() method to be called when the scheduler runs. | |
| CommandPtr | RunOnce (std::function< void()> action) |
| Constructs a command that runs an action once and finishes. | |
| CommandPtr | Run (std::function< void()> action) |
| Constructs a command that runs an action every iteration until interrupted. | |
| CommandPtr | StartEnd (std::function< void()> start, std::function< void()> end) |
| Constructs a command that runs an action once and another action when the command is interrupted. | |
| CommandPtr | RunEnd (std::function< void()> run, std::function< void()> end) |
| Constructs a command that runs an action every iteration until interrupted, and then runs a second action. | |
| CommandPtr | StartRun (std::function< void()> start, std::function< void()> run) |
| Constructs a command that runs an action once, and then runs an action every iteration until interrupted. | |
| CommandPtr | Defer (wpi::unique_function< CommandPtr()> supplier) |
| Constructs a DeferredCommand with the provided supplier. | |
Public Member Functions inherited from wpi::Sendable | |
| virtual constexpr | ~Sendable ()=default |
Public Member Functions inherited from wpi::SendableHelper< SubsystemBase > | |
| constexpr | SendableHelper (const SendableHelper &rhs)=default |
| constexpr | SendableHelper (SendableHelper &&rhs) |
| constexpr SendableHelper & | operator= (const SendableHelper &rhs)=default |
| constexpr SendableHelper & | operator= (SendableHelper &&rhs) |
Protected Member Functions | |
| SubsystemBase () | |
| Constructor. | |
| SubsystemBase (std::string_view name) | |
| Constructor. | |
Protected Member Functions inherited from wpi::SendableHelper< SubsystemBase > | |
| constexpr | SendableHelper ()=default |
| constexpr | ~SendableHelper () |
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
|
protected |
Constructor.
Telemetry/log name defaults to the classname.
|
explicitprotected |
Constructor.
| name | Name of the subsystem for telemetry and logging. |
| void frc2::SubsystemBase::AddChild | ( | std::string | name, |
| wpi::Sendable * | child ) |
Associate a Sendable with this Subsystem.
Also update the child's name.
| name | name to give child |
| child | sendable |
|
overridevirtual |
| std::string frc2::SubsystemBase::GetSubsystem | ( | ) | const |
|
overridevirtual |
| void frc2::SubsystemBase::SetName | ( | std::string_view | name | ) |
Sets the name of this Subsystem.
| name | name |
| void frc2::SubsystemBase::SetSubsystem | ( | std::string_view | name | ) |
Sets the subsystem name of this Subsystem.
| name | subsystem name |