Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.first.wpilibj.command
Class Subsystem

    java.lang.Object
      edu.wpi.first.wpilibj.command.Subsystem

All Implemented Interfaces:
  NamedSendable, Sendable

Direct Known Subclasses:
  PIDSubsystem

    public abstract class Subsystem

extends Object
implements NamedSendable

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.

Author:
  Joe Grinstead
See Also:
  `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

### Subsystem

    public Subsystem(String name)

  Creates a subsystem with the given name

  Parameters:
    `name` - the name of the subsystem

### Subsystem

    public Subsystem()

  Creates a subsystem. This will set the name to the name of the class.

Method Detail

### initDefaultCommand

    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. It is called on all Subsystems by CommandBase in the users program after all the Subsystems are created.

### setDefaultCommand

    protected void setDefaultCommand(Command command)

  Sets the default command. If this is not called or is called with null, then there will be no default command for the subsystem.

  WARNING: This should NOT be called in a constructor if the subsystem is a singleton.

  Parameters:
    `command` - the default command (or null if there should be none)
  Throws:
    `IllegalUseOfCommandException` - if the command does not require the subsystem

### getDefaultCommand

    protected Command getDefaultCommand()

  Returns the default command (or null if there is none).

  Returns:
    the default command

### getCurrentCommand

    public Command getCurrentCommand()

  Returns the command which currently claims this subsystem.

  Returns:
    the command which currently claims this subsystem

### toString

    public String toString()

  Description copied from class: `Object`
  Returns a string representation of the object. In general, the `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())

  Overrides:
    `toString` in class `Object`
  Returns:
    a string representation of the object.

### getName

    public String getName()

  Returns the name of this subsystem, which is by default the class name.

  Specified by:
    `getName` in interface `NamedSendable`
  Returns:
    the name of this subsystem

### getSmartDashboardType

    public String getSmartDashboardType()

  Specified by:
    `getSmartDashboardType` in interface `Sendable`
  Returns:
    the string representation of the named data type that will be used by the smart dashboard for this sendable

### initTable

    public void initTable(ITable table)

  Description copied from interface: `Sendable`
  Initializes a table for this sendable object.

  Specified by:
    `initTable` in interface `Sendable`
  Parameters:
    `table` - The table to put the values in.

### getTable

    public ITable getTable()

  Specified by:
    `getTable` in interface `Sendable`
  Returns:
    the table that is currently associated with the sendable

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"