|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.command.Subsystem
public abstract class Subsystem
This class defines a major component of the robot.
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 Summary | |
---|---|
Subsystem()
Creates a subsystem. |
|
Subsystem(java.lang.String name)
Creates a subsystem with the given name |
Method Summary | |
---|---|
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. |
NetworkTable |
getTable()
Returns the NetworkTable associated with the data. |
java.lang.String |
getType()
Returns the type of the data. |
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. |
protected void |
setDefaultCommand(Command command)
Sets the default command. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Subsystem(java.lang.String name)
name
- the name of the subsystempublic Subsystem()
Method Detail |
---|
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 SmartDashboardNamedData
public java.lang.String getType()
SmartDashboardData
getTable()
.
For instance, if the type was "Button", then the SmartDashboard would show the data
as a button on the desktop and would know to look at and modify the "pressed" field in the
NetworkTable
returned by getTable()
.
getType
in interface SmartDashboardData
public NetworkTable getTable()
SmartDashboardData
NetworkTable
associated with the data.
The table should contain all the information the desktop version of SmartDashboard needs
to interact with the object. The data should both keep the table up-to-date and also react
to changes that the SmartDashboard might make.
For instance, the SendablePIDController
will put its p, i and d values into its table
and will change them if the table receives new values.
This method should return the same table between calls
getTable
in interface SmartDashboardData
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |