public abstract class Subsystem extends java.lang.Object implements NamedSendable
A good example of a subsystem is the driveline, or a claw if the robot has one.
All motors should be a part of a subsystem. For instance, all the wheel motors should be a part of some kind of "Driveline" subsystem.
Subsystems are used within the command system as requirements for Command
. Only one
command which requires a subsystem can run at a time. Also, subsystems can have default commands
which are started if there is no command running which requires this subsystem.
Command
Constructor and Description |
---|
Subsystem()
Creates a subsystem.
|
Subsystem(java.lang.String name)
Creates a subsystem with the given name.
|
Modifier and Type | Method and Description |
---|---|
Command |
getCurrentCommand()
Returns the command which currently claims this subsystem.
|
protected Command |
getDefaultCommand()
Returns the default command (or null if there is none).
|
java.lang.String |
getName()
Returns the name of this subsystem, which is by default the class name.
|
java.lang.String |
getSmartDashboardType()
The string representation of the named data type that will be used by the smart dashboard for
this
Sendable . |
ITable |
getTable()
The table that is associated with this
Sendable . |
protected abstract void |
initDefaultCommand()
Initialize the default command for a subsystem By default subsystems have no default command,
but if they do, the default command is set with this method.
|
void |
initTable(ITable table)
Initializes a table for this
Sendable object. |
protected void |
setDefaultCommand(Command command)
Sets the default command.
|
java.lang.String |
toString() |
public Subsystem(java.lang.String name)
name
- the name of the subsystempublic Subsystem()
protected abstract void initDefaultCommand()
protected void setDefaultCommand(Command command)
WARNING: This should NOT be called in a constructor if the subsystem is a singleton.
command
- the default command (or null if there should be none)IllegalUseOfCommandException
- if the command does not require the subsystemprotected Command getDefaultCommand()
public Command getCurrentCommand()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getName()
getName
in interface NamedSendable
public java.lang.String getSmartDashboardType()
Sendable
Sendable
.getSmartDashboardType
in interface Sendable
Sendable
.public void initTable(ITable table)
Sendable
Sendable
object.