mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[commands] SubsystemBase: allow setting name in constructor (#6052)
This commit is contained in:
@@ -15,7 +15,7 @@ import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
* <p>This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
public abstract class SubsystemBase implements Subsystem, Sendable {
|
||||
/** Constructor. */
|
||||
/** Constructor. Telemetry/log name defaults to the classname. */
|
||||
@SuppressWarnings("this-escape")
|
||||
public SubsystemBase() {
|
||||
String name = this.getClass().getSimpleName();
|
||||
@@ -24,6 +24,17 @@ public abstract class SubsystemBase implements Subsystem, Sendable {
|
||||
CommandScheduler.getInstance().registerSubsystem(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param name Name of the subsystem for telemetry and logging.
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public SubsystemBase(String name) {
|
||||
SendableRegistry.addLW(this, name, name);
|
||||
CommandScheduler.getInstance().registerSubsystem(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this Subsystem.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user