Class SwerveModuleControlller

java.lang.Object
frc.robot.controllers.SwerveModuleControlller

public class SwerveModuleControlller extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    SwerveModuleControlller(int drivingPort, int turningPort, double chassisAngularOffset)
    This class contains all the logic and code to control the swerve motors
  • Method Summary

    Modifier and Type
    Method
    Description
    edu.wpi.first.math.kinematics.SwerveModuleState
    Gets the current desired state
    edu.wpi.first.math.kinematics.SwerveModulePosition
    Gets the position of the swerve module
    edu.wpi.first.math.kinematics.SwerveModuleState
    This function gets the state of the swerve module
    void
    This function resets all encoders for the swerve module
    void
    setDesiredState(edu.wpi.first.math.kinematics.SwerveModuleState desiredState)
    This function sets the state of a swerve module

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 motor
      turningPort - the port for the turning motor
      chassisAngularOffset - 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