mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
[commands] SubsystemBase: allow setting name in constructor (#6052)
This commit is contained in:
@@ -17,6 +17,11 @@ SubsystemBase::SubsystemBase() {
|
||||
CommandScheduler::GetInstance().RegisterSubsystem({this});
|
||||
}
|
||||
|
||||
SubsystemBase::SubsystemBase(std::string_view name) {
|
||||
wpi::SendableRegistry::AddLW(this, name);
|
||||
CommandScheduler::GetInstance().RegisterSubsystem({this});
|
||||
}
|
||||
|
||||
void SubsystemBase::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Subsystem");
|
||||
builder.AddBooleanProperty(
|
||||
|
||||
@@ -63,6 +63,15 @@ class SubsystemBase : public Subsystem,
|
||||
void AddChild(std::string name, wpi::Sendable* child);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Constructor. Telemetry/log name defaults to the classname.
|
||||
*/
|
||||
SubsystemBase();
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param name Name of the subsystem for telemetry and logging.
|
||||
*/
|
||||
explicit SubsystemBase(std::string_view name);
|
||||
};
|
||||
} // namespace frc2
|
||||
|
||||
Reference in New Issue
Block a user