Class DisabledMotor

java.lang.Object
frc.robot.devices.motor.DisabledMotor
All Implemented Interfaces:
Motor, MotorIO

public final class DisabledMotor extends Object implements Motor
No-op motor implementation used when a subsystem is disabled or has no hardware.

All commands are safely ignored, while getters return neutral values so callers can continue to run without null checks.

  • Constructor Details

    • DisabledMotor

      public DisabledMotor()
      Creates a disabled motor that ignores all output requests.
  • Method Details

    • setVoltage

      public void setVoltage(edu.wpi.first.units.measure.Voltage voltage)
      Ignores voltage requests and records the last value for telemetry.
      Specified by:
      setVoltage in interface Motor
      Parameters:
      voltage - desired voltage output
    • getPositionRadians

      public double getPositionRadians()
      Reports a neutral encoder position of 0.
      Specified by:
      getPositionRadians in interface Motor
      Returns:
      position in radians
    • getVelocityRadiansPerSecond

      public double getVelocityRadiansPerSecond()
      Reports a neutral encoder velocity of 0.
      Specified by:
      getVelocityRadiansPerSecond in interface Motor
      Returns:
      velocity in radians per second
    • getVoltage

      public edu.wpi.first.units.measure.Voltage getVoltage()
      Reports the last commanded voltage as a neutral voltage measurement.
      Specified by:
      getVoltage in interface Motor
      Returns:
      voltage applied to the motor
    • stop

      public void stop()
      Stops output by clearing the stored voltage request.
      Specified by:
      stop in interface Motor
    • setEncoderPosition

      public void setEncoderPosition(double positionRadians)
      Ignores encoder position changes because no hardware exists.
      Specified by:
      setEncoderPosition in interface Motor
      Parameters:
      positionRadians - ignored
    • updateInputs

      public void updateInputs(MotorIO.MotorIOInputs inputs)
      Populates the telemetry inputs with neutral values.
      Specified by:
      updateInputs in interface MotorIO
      Parameters:
      inputs - mutable inputs container to fill for logging