Package frc.lib.swerve
Class SwerveUtils
java.lang.Object
frc.lib.swerve.SwerveUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleconvertChoreoNewtonsToAmps(edu.wpi.first.math.kinematics.SwerveModuleState currentState, com.pathplanner.lib.util.DriveFeedforwards ff, int i) static edu.wpi.first.math.kinematics.SwerveModuleStatecopyState(edu.wpi.first.math.kinematics.SwerveModuleState state) static edu.wpi.first.math.kinematics.ChassisSpeedsdiscretize(edu.wpi.first.math.kinematics.ChassisSpeeds speeds, double driftRate) static doublegetTorqueOfKrakenDriveMotor(double amps) static booleanisSpeedOptimized(edu.wpi.first.math.kinematics.SwerveModuleState state, edu.wpi.first.math.kinematics.SwerveModuleState optimizedState, int i) static voidlogDriveFeedforward(com.pathplanner.lib.util.DriveFeedforwards ff, int i) static voidlogPossibleDriveStates(boolean doLogging, edu.wpi.first.math.kinematics.ChassisSpeeds desiredSpeeds, edu.wpi.first.math.kinematics.SwerveModuleState[] currentStates, SwerveSetpoint previousSetpoint, edu.wpi.first.math.geometry.Rotation2d robotRotation) static doubleoptimizeTorque(edu.wpi.first.math.kinematics.SwerveModuleState unOptimized, edu.wpi.first.math.kinematics.SwerveModuleState optimized, double motorAmperage, int i) static doubleprojectTorque(edu.wpi.first.math.kinematics.SwerveModuleState currentState, edu.wpi.first.math.Vector<edu.wpi.first.math.numbers.N2> wheelForce) static edu.wpi.first.math.geometry.Rotation2dremoveAzimuthJitter(edu.wpi.first.math.kinematics.SwerveModuleState setpoint, edu.wpi.first.math.kinematics.SwerveModuleState current) static edu.wpi.first.math.kinematics.SwerveModuleState[]
-
Constructor Details
-
SwerveUtils
public SwerveUtils()
-
-
Method Details
-
discretize
public static edu.wpi.first.math.kinematics.ChassisSpeeds discretize(edu.wpi.first.math.kinematics.ChassisSpeeds speeds, double driftRate) -
copyState
public static edu.wpi.first.math.kinematics.SwerveModuleState copyState(edu.wpi.first.math.kinematics.SwerveModuleState state) -
removeAzimuthJitter
public static edu.wpi.first.math.geometry.Rotation2d removeAzimuthJitter(edu.wpi.first.math.kinematics.SwerveModuleState setpoint, edu.wpi.first.math.kinematics.SwerveModuleState current) -
projectTorque
public static double projectTorque(edu.wpi.first.math.kinematics.SwerveModuleState currentState, edu.wpi.first.math.Vector<edu.wpi.first.math.numbers.N2> wheelForce) -
optimizeTorque
public static double optimizeTorque(edu.wpi.first.math.kinematics.SwerveModuleState unOptimized, edu.wpi.first.math.kinematics.SwerveModuleState optimized, double motorAmperage, int i) -
isSpeedOptimized
public static boolean isSpeedOptimized(edu.wpi.first.math.kinematics.SwerveModuleState state, edu.wpi.first.math.kinematics.SwerveModuleState optimizedState, int i) -
convertChoreoNewtonsToAmps
public static double convertChoreoNewtonsToAmps(edu.wpi.first.math.kinematics.SwerveModuleState currentState, com.pathplanner.lib.util.DriveFeedforwards ff, int i) -
logDriveFeedforward
public static void logDriveFeedforward(com.pathplanner.lib.util.DriveFeedforwards ff, int i) -
logPossibleDriveStates
public static void logPossibleDriveStates(boolean doLogging, edu.wpi.first.math.kinematics.ChassisSpeeds desiredSpeeds, edu.wpi.first.math.kinematics.SwerveModuleState[] currentStates, SwerveSetpoint previousSetpoint, edu.wpi.first.math.geometry.Rotation2d robotRotation) -
zeroStates
public static edu.wpi.first.math.kinematics.SwerveModuleState[] zeroStates() -
getTorqueOfKrakenDriveMotor
public static double getTorqueOfKrakenDriveMotor(double amps)
-