Class SimpleMotorSubsystem

java.lang.Object
org.wpilib.command2.SubsystemBase
xbot.common.command.BaseSubsystem
xbot.common.subsystems.simple.SimpleMotorSubsystem
All Implemented Interfaces:
org.wpilib.command2.Subsystem, org.wpilib.telemetry.TelemetryLoggable, TunablePrefixProvider

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

    Fields inherited from class BaseSubsystem

    aKitLog, log
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an instance with default power settings.
    SimpleMotorSubsystem(String name, TunableFactory tunableFactory, double defaultForwardPower, double defaultReversePower)
    Create an instance with the specified default forward and reverse power.
  • Method Summary

    Modifier and Type
    Method
    Description
    final org.wpilib.command2.Command
    Gets a command to drive the motor in the forward direction.
    final org.wpilib.command2.Command
    Gets a command to drive the motor in the reverse direction.
    final org.wpilib.command2.Command
    Gets a command to stop the motor.
    final void
    Drive the motor in the forward direction.
    abstract void
    setPower(double power)
    Sets the motor output power.
    final void
    Drive the motor in the reverse direction.
    final void
    Stop the motor.

    Methods inherited from class BaseSubsystem

    getPrefix, periodic

    Methods inherited from class org.wpilib.command2.SubsystemBase

    getName, getTelemetryType, logTo, setName

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.wpilib.command2.Subsystem

    defer, getCurrentCommand, getDefaultCommand, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
  • Constructor Details

    • SimpleMotorSubsystem

      public SimpleMotorSubsystem(String name, TunableFactory tunableFactory, double defaultForwardPower, double defaultReversePower)
      Create an instance with the specified default forward and reverse power.
      Parameters:
      name - The name of the subsystem
      tunableFactory - The tunable 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, TunableFactory tunableFactory)
      Create an instance with default power settings.
      Parameters:
      name - The name of the subsystem
      tunableFactory - The tunable 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 org.wpilib.command2.Command getForwardCommand()
      Gets a command to drive the motor in the forward direction.
      Returns:
      The command.
    • getReverseCommand

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

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