Interface MotorController

All Known Implementing Classes:
Koors40, PWMMotorController, PWMSparkFlex, PWMSparkMax, PWMTalonFX, PWMTalonSRX, PWMVenom, PWMVictorSPX, RomiMotor, Spark, SparkMini, Talon, VictorSP, XRPMotor

public interface MotorController
Interface for motor controlling devices.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Disables the motor controller.
    double
    Gets the duty cycle of the motor controller.
    boolean
    Gets the inversion state of the motor controller.
    void
    setDutyCycle(double dutyCycle)
    Sets the duty cycle of the motor controller.
    void
    setInverted(boolean isInverted)
    Sets the inversion state of the motor controller.
    default void
    setVoltage(double voltage)
    Sets the voltage output of the motor controller.
    default void
    Sets the voltage output of the motor controller.
  • Method Details

    • setDutyCycle

      void setDutyCycle(double dutyCycle)
      Sets the duty cycle of the motor controller.
      Parameters:
      dutyCycle - The duty cycle between -1 and 1 (sign indicates direction).
    • setVoltage

      default void setVoltage(double voltage)
      Sets the voltage output of the motor controller.

      Compensates for the current bus voltage to ensure that the desired voltage is output even if the battery voltage is below 12V - highly useful when the voltage outputs are "meaningful" (e.g. they come from a feedforward calculation).

      NOTE: This function *must* be called regularly in order for voltage compensation to work properly - unlike the ordinary set function, it is not "set it and forget it."

      Parameters:
      voltage - The voltage.
    • setVoltage

      default void setVoltage(Voltage voltage)
      Sets the voltage output of the motor controller.

      Compensates for the current bus voltage to ensure that the desired voltage is output even if the battery voltage is below 12V - highly useful when the voltage outputs are "meaningful" (e.g. they come from a feedforward calculation).

      NOTE: This function *must* be called regularly in order for voltage compensation to work properly - unlike the ordinary set function, it is not "set it and forget it."

      Parameters:
      voltage - The voltage.
    • getDutyCycle

      double getDutyCycle()
      Gets the duty cycle of the motor controller.
      Returns:
      The duty cycle between -1 and 1 (sign indicates direction).
    • setInverted

      void setInverted(boolean isInverted)
      Sets the inversion state of the motor controller.
      Parameters:
      isInverted - The inversion state.
    • getInverted

      boolean getInverted()
      Gets the inversion state of the motor controller.
      Returns:
      The inversion state.
    • disable

      void disable()
      Disables the motor controller.