Package frc.robot.devices.motor
Class DisabledMotor
java.lang.Object
frc.robot.devices.motor.DisabledMotor
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface frc.robot.devices.motor.MotorIO
MotorIO.MotorIOInputs -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReports a neutral encoder position of 0.doubleReports a neutral encoder velocity of 0.edu.wpi.first.units.measure.VoltageReports the last commanded voltage as a neutral voltage measurement.voidsetEncoderPosition(double positionRadians) Ignores encoder position changes because no hardware exists.voidsetVoltage(edu.wpi.first.units.measure.Voltage voltage) Ignores voltage requests and records the last value for telemetry.voidstop()Stops output by clearing the stored voltage request.voidupdateInputs(MotorIO.MotorIOInputs inputs) Populates the telemetry inputs with neutral values.
-
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:
setVoltagein interfaceMotor- Parameters:
voltage- desired voltage output
-
getPositionRadians
public double getPositionRadians()Reports a neutral encoder position of 0.- Specified by:
getPositionRadiansin interfaceMotor- Returns:
- position in radians
-
getVelocityRadiansPerSecond
public double getVelocityRadiansPerSecond()Reports a neutral encoder velocity of 0.- Specified by:
getVelocityRadiansPerSecondin interfaceMotor- 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:
getVoltagein interfaceMotor- Returns:
- voltage applied to the motor
-
stop
public void stop()Stops output by clearing the stored voltage request. -
setEncoderPosition
public void setEncoderPosition(double positionRadians) Ignores encoder position changes because no hardware exists.- Specified by:
setEncoderPositionin interfaceMotor- Parameters:
positionRadians- ignored
-
updateInputs
Populates the telemetry inputs with neutral values.- Specified by:
updateInputsin interfaceMotorIO- Parameters:
inputs- mutable inputs container to fill for logging
-