Subsystem¶
- class commands1.Subsystem(name: str)¶
Bases:
wpiutil._wpiutil.Sendable
This class defines a major component of the robot.
A good example of a subsystem is the drivetrain, 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 “Drivetrain” 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.
This class is provided by the OldCommands VendorDep
Creates a subsystem with the given name.
- Parameters
name – the name of the subsystem
- addChild(*args, **kwargs)¶
Overloaded function.
addChild(self: commands1._impl._commands_v1.command.Subsystem, name: str, child: wpiutil._wpiutil.Sendable) -> None
Associate a Sendable with this Subsystem. Also update the child’s name.
- Parameters
name – name to give child
child – sendable
addChild(self: commands1._impl._commands_v1.command.Subsystem, child: wpiutil._wpiutil.Sendable) -> None
Associate a Sendable with this Subsystem.
- Parameters
child – sendable
- getCurrentCommand() commands1._impl._commands_v1.command.Command ¶
Returns the command which currently claims this subsystem.
- Returns
the command which currently claims this subsystem
- getCurrentCommandName() str ¶
Returns the current command name, or empty string if no current command.
- Returns
the current command name
- getDefaultCommand() commands1._impl._commands_v1.command.Command ¶
Returns the default command (or null if there is none).
- Returns
the default command
- getDefaultCommandName() str ¶
Returns the default command name, or empty string is there is none.
- Returns
the default command name
- getName() str ¶
Gets the name of this Subsystem.
- Returns
Name
- getSubsystem() str ¶
Gets the subsystem name of this Subsystem.
- Returns
Subsystem name
- initDefaultCommand() None ¶
Initialize the default command for this subsystem.
This is meant to be the place to call SetDefaultCommand in a subsystem and will be called on all the subsystems by the CommandBase method before the program starts running by using the list of all registered Subsystems inside the Scheduler.
This should be overridden by a Subsystem that has a default Command
- initSendable(builder: wpiutil._wpiutil.SendableBuilder) None ¶
- periodic() None ¶
When the run method of the scheduler is called this method will be called.
- setCurrentCommand(command: commands1._impl._commands_v1.command.Command) None ¶
Sets the current command.
- Parameters
command – the new current command
- setDefaultCommand(command: commands1._impl._commands_v1.command.Command) None ¶
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)
- setName(name: str) None ¶
Sets the name of this Subsystem.
- Parameters
name – name
- setSubsystem(subsystem: str) None ¶
Sets the subsystem name of this Subsystem.
- Parameters
subsystem – subsystem name