]> git.taranathan.com Git - FRC2026.git/commitdiff
a
authormaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Fri, 20 Feb 2026 22:06:19 +0000 (14:06 -0800)
committermaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Fri, 20 Feb 2026 22:06:19 +0000 (14:06 -0800)
src/main/java/frc/robot/subsystems/turret/Turret.java
src/main/java/frc/robot/subsystems/turret/TurretConstants.java

index 013f91b7f680dd05a1094dd11fc4356bddbb9d66..1647999d295069f6e51e8a7629c0cee0763dafec 100644 (file)
@@ -145,28 +145,26 @@ public class Turret extends SubsystemBase implements TurretIO{
 
                int leftTooth = (int) Math.round(leftAbs * TurretConstants.LEFT_ENCODER_TEETH)
                                % TurretConstants.LEFT_ENCODER_TEETH;
-               SmartDashboard.putNumber("Left Tooth", leftTooth);
+               //SmartDashboard.putNumber("Left Tooth", leftTooth);
 
                int rightTooth = (int) Math.round(rightAbs * TurretConstants.RIGHT_ENCODER_TEETH)
                                % TurretConstants.RIGHT_ENCODER_TEETH;
-               SmartDashboard.putNumber("Right Tooth", rightTooth);
+               //SmartDashboard.putNumber("Right Tooth", rightTooth);
 
                int turretIndex = ChineseRemainderTheorem.solve(leftTooth, TurretConstants.LEFT_ENCODER_TEETH, rightTooth, TurretConstants.RIGHT_ENCODER_TEETH);
-               SmartDashboard.putNumber("Turret Index", turretIndex);
+               //SmartDashboard.putNumber("Turret Index", turretIndex);
 
-               double totalTeeth = TurretConstants.LEFT_ENCODER_TEETH
-        * TurretConstants.RIGHT_ENCODER_TEETH;
-
-               double turretRotations = turretIndex / (double) 140.0;
+               double turretRotations = turretIndex / (double) TurretConstants.TURRET_TEETH_COUNT;
                if(Units.rotationsToDegrees(turretRotations) > 500.0){
                        turretRotations -= Units.degreesToRotations(846.0);
                }
-               SmartDashboard.putNumber("CRT thing out", Units.rotationsToDegrees(turretRotations));
+               SmartDashboard.putNumber("CRT Position", Units.rotationsToDegrees(turretRotations));
 
                double motorRotations = turretRotations * TurretConstants.TURRET_GEAR_RATIO;
+
+               //Sets the initial motor position
                motor.setPosition(motorRotations);
 
-               
                // Position extrapolation
                double lookAheadSeconds = EXTRAPOLATION_TIME_CONSTANT; 
        double futureRobotAngle = goalAngle.getRadians() + (goalVelocityRadPerSec * lookAheadSeconds);
index 8710b6ba6b017172a500148d1f878c996fc4e540..e56cfec97992692b05066b9d6960cbf9d899bf83 100644 (file)
@@ -14,7 +14,7 @@ public class TurretConstants {
     public static double TURRET_RADIUS = TURRET_WIDTH / 2;
 
     public static double TURRET_TEETH_COUNT = 140.0; // the turret teeth count
-    public static double TURRET_GEAR_RATIO = 30.545454;
+    public static double TURRET_GEAR_RATIO = 25.454545454;
     public static int LEFT_ENCODER_TEETH = 15; // gear teeth
     public static int RIGHT_ENCODER_TEETH = 22; // read above
     public static int ENCODER_COUNT_TOTAL = 8192; // how many intervals it can have, like clicks on a clock chat gpt explained to me