Interface Motor
- All Superinterfaces:
MotorIO
- All Known Implementing Classes:
AbstractMotor,AbstractSimMotor,AbstractVelocityMotor,AbstractVelocitySimMotor,CompositeMotor,DisabledMotor,FeederMotor,FeederSimMotor,HarvesterMotor,HarvesterSimMotor,IndexerMotor,IndexerSimMotor,IntakeMotor,IntakeSimMotor,ShooterMotor,ShooterSimMotor,TurretMotor,TurretSimMotor
Positions and velocities are reported in radians so subsystems can work in standard WPILib math units. Callers should rely on the MotorIO
telemetry surfaces for logging and diagnostics.
-
Nested Class Summary
Nested classes/interfaces inherited from interface frc.robot.devices.motor.MotorIO
MotorIO.MotorIOInputs -
Method Summary
Modifier and TypeMethodDescriptiondoubleReports the current mechanism position.doubleReports the current mechanism velocity.edu.wpi.first.units.measure.VoltageReports the applied voltage.voidsetEncoderPosition(double positionRadians) Overwrites the encoder's stored position so the mechanism's logical zero matches its physical location.voidsetVoltage(edu.wpi.first.units.measure.Voltage voltage) Commands the motor with a voltage request.voidstop()Stops the motor output.Methods inherited from interface frc.robot.devices.motor.MotorIO
updateInputs
-
Method Details
-
setVoltage
void setVoltage(edu.wpi.first.units.measure.Voltage voltage) Commands the motor with a voltage request.Use this when closed-loop or feedforward logic has already computed the needed voltage. Implementations should apply the value immediately without additional scaling.
- Parameters:
voltage- desired output voltage, in volts
-
getPositionRadians
double getPositionRadians()Reports the current mechanism position.The returned value should already include any gearing or offsets needed to express the mechanism position in radians.
- Returns:
- position in radians
-
setEncoderPosition
void setEncoderPosition(double positionRadians) Overwrites the encoder's stored position so the mechanism's logical zero matches its physical location.Call this after manually repositioning a mechanism (e.g., centering a turret) so the encoder reading reflects the true position. The value is in radians, post-gearing, matching the units returned by
getPositionRadians().- Parameters:
positionRadians- new encoder position in mechanism radians
-
getVelocityRadiansPerSecond
double getVelocityRadiansPerSecond()Reports the current mechanism velocity.The returned value should already include any gearing needed to express the mechanism velocity in radians per second.
- Returns:
- velocity in radians per second
-
getVoltage
edu.wpi.first.units.measure.Voltage getVoltage()Reports the applied voltage.Use this for logging or validation that the controller output matches expectations.
- Returns:
- voltage applied to the motor, in volts
-
stop
void stop()Stops the motor output.Call this to halt motion immediately when the mechanism should idle or when disabling the subsystem.
-