Class SimpleMotorSubsystem

All Implemented Interfaces:
Sendable, Subsystem, DataFrameRefreshable, IPropertySupport

public abstract class SimpleMotorSubsystem extends BaseSubsystem
Generic subsystem that handles a single motor which can be driven in forward and reverse.
  • Constructor Details

    • SimpleMotorSubsystem

      public SimpleMotorSubsystem(String name, PropertyFactory pf, double defaultForwardPower, double defaultReversePower)
      Create an instance with the specified default forward and reverse power.
      Parameters:
      name - The name of the subsystem
      pf - The property factory
      defaultForwardPower - The default power to use in the forward direction
      defaultReversePower - The default power to use in the reverse direction
    • SimpleMotorSubsystem

      public SimpleMotorSubsystem(String name, PropertyFactory pf)
      Create an instance with default power settings.
      Parameters:
      name - The name of the subsystem
      pf - The property factory
  • Method Details

    • setPower

      public abstract void setPower(double power)
      Sets the motor output power.
      Parameters:
      power - The output power, from -1.0 to 1.0
    • setForward

      public final void setForward()
      Drive the motor in the forward direction.
    • setReverse

      public final void setReverse()
      Drive the motor in the reverse direction.
    • stop

      public final void stop()
      Stop the motor.
    • getForwardCommand

      public final Command getForwardCommand()
      Gets a command to drive the motor in the forward direction.
      Returns:
      The command.
    • getReverseCommand

      public final Command getReverseCommand()
      Gets a command to drive the motor in the reverse direction.
      Returns:
      The command.
    • getStopCommand

      public final Command getStopCommand()
      Gets a command to stop the motor.
      Returns:
      The command.