Class SwerveOptimization

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

public class SwerveOptimization extends Object
A class that contains methods to optimize the swerve module states.
  • 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 state, edu.wpi.first.math.geometry.Rotation2d currentRotation, double lastSetSpeed)
    Optimizes the swerve module state to minimize the angle change between the current angle and the target angle.

    Methods inherited from class java.lang.Object

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

    • SwerveOptimization

      public SwerveOptimization()
  • Method Details

    • optimize

      public static edu.wpi.first.math.kinematics.SwerveModuleState optimize(edu.wpi.first.math.kinematics.SwerveModuleState state, edu.wpi.first.math.geometry.Rotation2d currentRotation, double lastSetSpeed)
      Optimizes the swerve module state to minimize the angle change between the current angle and the target angle.
      Parameters:
      state - The target state
      currentRotation - The current rotation of the module
      Returns:
      The optimized state