Package frc.lib.util.swerve
Class SwerveModule
java.lang.Object
frc.lib.util.swerve.SwerveModule
Swerve Module Subsystem
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSwerveModule
(int moduleNumber, Rotation2d angleOffset, SwerveModuleIO io) Swerve Module -
Method Summary
Modifier and TypeMethodDescriptionGet the rotation of the CANCoderGet the current Swerve Module PositiongetState()
Get the current Swerve Module Statevoid
periodic()
Update inputs for a Swerve Module.void
setDesiredState
(SwerveModuleState desiredState, boolean isOpenLoop) Set the desired state of the Swerve Module
-
Field Details
-
moduleNumber
public int moduleNumber
-
-
Constructor Details
-
SwerveModule
Swerve Module- Parameters:
moduleNumber
- Module NumberangleOffset
- Angle Offset of the CANCoder to align the wheels
-
-
Method Details
-
periodic
public void periodic()Update inputs for a Swerve Module. -
setDesiredState
Set the desired state of the Swerve Module- Parameters:
desiredState
- The desiredSwerveModuleState
for the moduleisOpenLoop
- Whether the state should be open or closed loop controlled
-
getCANcoder
Get the rotation of the CANCoder- Returns:
- The rotation of the CANCoder in
Rotation2d
-
getState
Get the current Swerve Module State- Returns:
- The current
SwerveModuleState
-
getPosition
Get the current Swerve Module Position- Returns:
- The current
SwerveModulePosition
-