Package edu.wpi.first.wpilibj2.command
Class SubsystemBase
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
- Direct Known Subclasses:
PIDSubsystem
,ProfiledPIDSubsystem
,TrapezoidProfileSubsystem
public abstract class SubsystemBase extends Object implements Subsystem, Sendable
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
-
Constructor Summary
Constructors Constructor Description SubsystemBase()
Constructor. -
Method Summary
Modifier and Type Method Description void
addChild(String name, Sendable child)
Associates aSendable
with this Subsystem.String
getName()
Gets the name of this Subsystem.String
getSubsystem()
Gets the subsystem name of this Subsystem.void
initSendable(SendableBuilder builder)
Initializes thisSendable
object.void
setName(String name)
Sets the name of this Subsystem.void
setSubsystem(String subsystem)
Sets the subsystem name of this Subsystem.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
getCurrentCommand, getDefaultCommand, periodic, register, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd
-
Constructor Details
-
SubsystemBase
public SubsystemBase()Constructor.
-
-
Method Details
-
getName
Gets the name of this Subsystem.- Returns:
- Name
-
setName
Sets the name of this Subsystem.- Parameters:
name
- name
-
getSubsystem
Gets the subsystem name of this Subsystem.- Returns:
- Subsystem name
-
setSubsystem
Sets the subsystem name of this Subsystem.- Parameters:
subsystem
- subsystem name
-
addChild
Associates aSendable
with this Subsystem. Also update the child's name.- Parameters:
name
- name to give childchild
- sendable
-
initSendable
Description copied from interface:Sendable
Initializes thisSendable
object.- Specified by:
initSendable
in interfaceSendable
- Parameters:
builder
- sendable builder
-