Package frc.robot.subsystems.swerve.mod
Class SwerveModule
java.lang.Object
frc.robot.subsystems.swerve.mod.SwerveModule
Swerve Module
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the module velocity in rotations/sec (Phoenix native units).getOdometryPosition(int i) Get swerve module position at timestamp index iGet the current Swerve Module PositiongetState()Get the current Swerve Module StatedoubleReturns the module position in radians.voidperiodic()Periodic function (doesn't update inputs)voidrunCharacterization(double output) Run motor at given voltage with angle motor pointing forwardvoidsetBrakeMode(boolean enabled) Set drive motor brake modevoidsetDesiredState(SwerveModuleState desiredState) Set the desired state of the Swerve ModulevoidsetFreeSpin(boolean enabled) Set angle motor brake modevoidUpdate inputs for a Swerve Module.
-
Constructor Details
-
SwerveModule
Swerve Module- Parameters:
moduleId- index into the motor constantsio- IO implementation
-
-
Method Details
-
updateInputs
public void updateInputs()Update inputs for a Swerve Module. -
setDesiredState
Set the desired state of the Swerve Module- Parameters:
desiredState- The desiredSwerveModuleStatefor the module
-
getState
Get the current Swerve Module State -
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
Get swerve module position at timestamp index i
-