001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.wpilibj;
006
007/**
008 * Interface for motor controlling devices.
009 *
010 * @deprecated Use {@link edu.wpi.first.wpilibj.motorcontrol.MotorController}.
011 */
012@Deprecated(since = "2022", forRemoval = true)
013public interface SpeedController {
014  /**
015   * Common interface for setting the speed of a motor controller.
016   *
017   * @param speed The speed to set. Value should be between -1.0 and 1.0.
018   */
019  void set(double speed);
020
021  /**
022   * Sets the voltage output of the MotorController. Compensates for the current bus voltage to
023   * ensure that the desired voltage is output even if the battery voltage is below 12V - highly
024   * useful when the voltage outputs are "meaningful" (e.g. they come from a feedforward
025   * calculation).
026   *
027   * <p>NOTE: This function *must* be called regularly in order for voltage compensation to work
028   * properly - unlike the ordinary set function, it is not "set it and forget it."
029   *
030   * @param outputVolts The voltage to output.
031   */
032  default void setVoltage(double outputVolts) {
033    set(outputVolts / RobotController.getBatteryVoltage());
034  }
035
036  /**
037   * Common interface for getting the current set speed of a motor controller.
038   *
039   * @return The current set speed. Value is between -1.0 and 1.0.
040   */
041  double get();
042
043  /**
044   * Common interface for inverting direction of a motor controller.
045   *
046   * @param isInverted The state of inversion true is inverted.
047   */
048  void setInverted(boolean isInverted);
049
050  /**
051   * Common interface for returning if a motor controller is in the inverted state or not.
052   *
053   * @return isInverted The state of the inversion true is inverted.
054   */
055  boolean getInverted();
056
057  /** Disable the motor controller. */
058  void disable();
059
060  /**
061   * Stops motor movement. Motor can be moved again by calling set without having to re-enable the
062   * motor.
063   */
064  void stopMotor();
065}