From 17282da571192c20147c0f9cf4def06417466e2f Mon Sep 17 00:00:00 2001 From: Abdul-create <66187970+Abdul-create@users.noreply.github.com> Date: Fri, 27 Sep 2024 02:48:15 -0400 Subject: [PATCH] Update Constants.java I edited the constants for neo base robot. We can set max speed and acceleration now along with more crucial things. We will have to measure the wheel diameter and find Angle and Drive Motors pid values. After that we have to set drive gear ratio(I didn't put it in the code yet) and we will be all done. Also there's no chosen module for swerve so we have to do the calculations ourselves. None of the code was edited except the deletion of the talon swerve libary. All new code is commented out so it doesn't affect the structure of the file. --- src/main/java/frc/robot/Constants.java | 49 ++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 02e121f..3690d3a 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -5,7 +5,6 @@ import edu.wpi.first.math.kinematics.SwerveDriveKinematics; import edu.wpi.first.math.trajectory.TrapezoidProfile; import edu.wpi.first.math.util.Units; -import frc.lib.util.COTSFalconSwerveConstants; import frc.lib.util.SwerveModuleConstants; @@ -39,9 +38,18 @@ public static final class REV //TODO: All must be tuned to specific robot public static final double trackWidth = Units.inchesToMeters(18.75); public static final double wheelBase = Units.inchesToMeters(20.25); - + /* + public static final double wheelDiameter = Units.inchesToMeters(insert value); + public static final double wheelCircumference = wheelDiameter * Math.PI; +//NEED TO FINE TUNE THE BELOW 4 LINES FOR OUR ROBOT + public static final double openLoopRamp = 0.25; + public static final double closedLoopRamp = 0.0; + + public static final double driveGearRatio = (6.75 / 1.0); // 6.75:1 + public static final double angleGearRatio = (12.8 / 1.0); // 12.8:1 + */ // Chosen - // public static final double wheelCircumference = chosenModule.wheelCircumference; + // /*Swerve Kinematics */ @@ -52,10 +60,37 @@ public static final class REV new Translation2d(-wheelBase / 2.0, trackWidth / 2.0), new Translation2d(-wheelBase / 2.0, -trackWidth / 2.0)); - - - - +/* +(WE NEED TO FINE TUNE THIS VALUES FOR OUR ROBOT!) + + // Angle Motor PID Values + public static final double angleKP = 0.01; + public static final double angleKI = 0.0; + public static final double angleKD = 0.0; + public static final double angleKFF = 0.0; + + // Drive Motor PID Values + public static final double driveKP = 0.1; + public static final double driveKI = 0.0; + public static final double driveKD = 0.0; + public static final double driveKFF = 0.0; + + // Drive Motor Characterization Values + public static final double driveKS = 0.667; + public static final double driveKV = 2.44; + public static final double driveKA = 0.27; + + // Drive Motor Conversion Factors + public static final double driveConversionPositionFactor = + (wheelDiameter * Math.PI) / driveGearRatio; + public static final double driveConversionVelocityFactor = driveConversionPositionFactor / 60.0; + public static final double angleConversionFactor = 360.0 / angleGearRatio; + + +//for setting max speed and acceleration + public static final double kMaxSpeedMetersPerSecond = 3; + public static final double kMaxAccelerationMetersPerSecondSquared = 1; +*/ }