- class wpilib.command.Subsystem(name=None)¶
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.
Creates a subsystem.
Parameters: name – the name of the subsystem; if None, it will be set to the name to the name of the class.
Call this to alert Subsystem that the current command is actually the command. Sometimes, the Subsystem is told that it has no command while the Scheduler is going through the loop, only to be soon after given a new one. This will avoid that situation.
Returns the command which currently claims this subsystem.
Returns: the command which currently claims this subsystem
Returns the default command (or None if there is none).
Returns: the default command
Returns the name of this subsystem, which is by default the class name.
Returns: the name of this subsystem
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.
Sets the current command
Parameters: command – the new current command
Sets the default command. If this is not called or is called with None, then there will be no default command for the subsystem.
Parameters: command – the default command (or None if there should be none)
This should NOT be called in a constructor if the subsystem is a singleton.