Package frc.robot.controllers
Class SwerveModuleControlller
java.lang.Object
frc.robot.controllers.SwerveModuleControlller
-
Constructor Summary
ConstructorsConstructorDescriptionSwerveModuleControlller
(int drivingPort, int turningPort, double chassisAngularOffset) This class contains all the logic and code to control the swerve motors -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.math.kinematics.SwerveModuleState
Gets the current desired stateedu.wpi.first.math.kinematics.SwerveModulePosition
Gets the position of the swerve moduleedu.wpi.first.math.kinematics.SwerveModuleState
getState()
This function gets the state of the swerve modulevoid
This function resets all encoders for the swerve modulevoid
setDesiredState
(edu.wpi.first.math.kinematics.SwerveModuleState desiredState) This function sets the state of a swerve module
-
Constructor Details
-
SwerveModuleControlller
public SwerveModuleControlller(int drivingPort, int turningPort, double chassisAngularOffset) This class contains all the logic and code to control the swerve motors- Parameters:
drivingPort
- the port for the drive motorturningPort
- the port for the turning motorchassisAngularOffset
- the angular offset of the motor to the chassis?
-
-
Method Details
-
getState
public edu.wpi.first.math.kinematics.SwerveModuleState getState()This function gets the state of the swerve module- Returns:
- Returns a SwerveModuleState containing info about the velocity and rotation of the swerve module
-
getPosition
public edu.wpi.first.math.kinematics.SwerveModulePosition getPosition()Gets the position of the swerve module- Returns:
- Returns a SwerveModulePosition containing info about the velocity and rotation of the swerve module
-
setDesiredState
public void setDesiredState(edu.wpi.first.math.kinematics.SwerveModuleState desiredState) This function sets the state of a swerve module- Parameters:
desiredState
- the target state for the module
-
getDesiredState
public edu.wpi.first.math.kinematics.SwerveModuleState getDesiredState()Gets the current desired state- Returns:
- returns the desired state as a SwerveModuleState
-
resetEncoders
public void resetEncoders()This function resets all encoders for the swerve module
-