public abstract class Subsystem extends 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(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).
|
String |
getName()
Returns the name of this subsystem, which is by default the class name.
|
String |
getSmartDashboardType() |
edu.wpi.first.wpilibj.tables.ITable |
getTable() |
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(edu.wpi.first.wpilibj.tables.ITable table)
Initializes a table for this sendable object.
|
protected void |
setDefaultCommand(Command command)
Sets the default command.
|
String |
toString() |
public Subsystem(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 String getName()
getName in interface NamedSendablepublic String getSmartDashboardType()
getSmartDashboardType in interface Sendablepublic void initTable(edu.wpi.first.wpilibj.tables.ITable table)
SendableCopyright © 2015. All rights reserved.