Subsystem

class wpilib.command.Subsystem(name: str) → None

Bases: wpilib._wpilib.ErrorBase, wpilib._wpilib.Sendable

Creates a subsystem with the given name.

Parameters:name – the name of the subsystem
addChild(*args, **kwargs)

Overloaded function.

  1. addChild(self: wpilib.command._commands_v1.Subsystem, name: str, child: wpilib._wpilib.Sendable) -> None

Associate a Sendable with this Subsystem. Also update the child’s name.

Parameters:
  • name – name to give child
  • child – sendable
  1. addChild(self: wpilib.command._commands_v1.Subsystem, child: wpilib._wpilib.Sendable) -> None

Associate a {@link Sendable} with this Subsystem.

Parameters:child – sendable
getCurrentCommand() → wpilib.command._commands_v1.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() → wpilib.command._commands_v1.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: wpilib._wpilib.SendableBuilder) → None
periodic() → None

When the run method of the scheduler is called this method will be called.

setCurrentCommand(command: wpilib.command._commands_v1.Command) → None

Sets the current command.

Parameters:command – the new current command
setDefaultCommand(command: wpilib.command._commands_v1.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