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

public interface Motor extends MotorIO
Minimal motor control surface for set-and-seek style mechanisms.

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 Type
    Method
    Description
    double
    Reports the current mechanism position.
    double
    Reports the current mechanism velocity.
    edu.wpi.first.units.measure.Voltage
    Reports the applied voltage.
    void
    setEncoderPosition(double positionRadians)
    Overwrites the encoder's stored position so the mechanism's logical zero matches its physical location.
    void
    setVoltage(edu.wpi.first.units.measure.Voltage voltage)
    Commands the motor with a voltage request.
    void
    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.