Class SwerveModule

java.lang.Object
frc.robot.subsystems.swerve.mod.SwerveModule

@NullMarked public class SwerveModule extends Object
Swerve Module
  • Constructor Details

    • SwerveModule

      public SwerveModule(int moduleId, SwerveModuleIO io)
      Swerve Module
      Parameters:
      moduleId - index into the motor constants
      io - IO implementation
  • Method Details

    • updateInputs

      public void updateInputs()
      Update inputs for a Swerve Module.
    • setDesiredState

      public void setDesiredState(SwerveModuleState desiredState)
      Set the desired state of the Swerve Module
      Parameters:
      desiredState - The desired SwerveModuleState for the module
    • getState

      public SwerveModuleState getState()
      Get the current Swerve Module State
    • getPosition

      public SwerveModulePosition getPosition()
      Get the current Swerve Module Position
    • runCharacterization

      public void runCharacterization(double output)
      Run motor at given voltage with angle motor pointing forward
    • getWheelRadiusCharacterizationPosition

      public double getWheelRadiusCharacterizationPosition()
      Returns the module position in radians.
    • getFFCharacterizationVelocity

      public double getFFCharacterizationVelocity()
      Returns the module velocity in rotations/sec (Phoenix native units).
    • setBrakeMode

      public void setBrakeMode(boolean enabled)
      Set drive motor brake mode
    • setFreeSpin

      public void setFreeSpin(boolean enabled)
      Set angle motor brake mode
    • periodic

      public void periodic()
      Periodic function (doesn't update inputs)
    • getOdometryPosition

      public SwerveModulePosition getOdometryPosition(int i)
      Get swerve module position at timestamp index i