Class CTREModuleState

java.lang.Object
frc.team_8840_lib.utils.controllers.swerve.CTREModuleState

public class CTREModuleState extends Object
Credit to https://github.com/frc3512/SwerveBot-2022/blob/main/src/main/java/frc/lib/math/OnboardModuleState.java
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static edu.wpi.first.math.kinematics.SwerveModuleState
    optimize(edu.wpi.first.math.kinematics.SwerveModuleState desiredState, edu.wpi.first.math.geometry.Rotation2d currentAngle)
    Minimize the change in heading the desired swerve module state would require by potentially reversing the direction the wheel spins.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CTREModuleState

      public CTREModuleState()
  • Method Details

    • optimize

      public static edu.wpi.first.math.kinematics.SwerveModuleState optimize(edu.wpi.first.math.kinematics.SwerveModuleState desiredState, edu.wpi.first.math.geometry.Rotation2d currentAngle)
      Minimize the change in heading the desired swerve module state would require by potentially reversing the direction the wheel spins. Customized from WPILib's version to include placing in appropriate scope for CTRE and REV onboard control as both controllers as of writing don't have support for continuous input.
      Parameters:
      desiredState - The desired state.
      currentAngle - The current module angle.