|
" 2013 FRC Java API " |
|||||||||
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(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). |
String |
getName()
Returns the name of this subsystem, which is by default the class name. |
String |
getSmartDashboardType()
|
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(ITable table)
Initializes a table for this sendable object. |
protected void |
setDefaultCommand(Command command)
Sets the default command. |
String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Subsystem(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 String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString
in class Object
public String getName()
getName
in interface NamedSendable
public String getSmartDashboardType()
getSmartDashboardType
in interface Sendable
public void initTable(ITable table)
Sendable
initTable
in interface Sendable
table
- The table to put the values in.public ITable getTable()
getTable
in interface Sendable
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |