]> git.taranathan.com Git - FRC2026.git/commitdiff
a
authormaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Sat, 28 Feb 2026 03:42:56 +0000 (19:42 -0800)
committermaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Sat, 28 Feb 2026 03:42:56 +0000 (19:42 -0800)
src/main/deploy/pathplanner/autos/Left(No SOTM) - Under Trench.auto
src/main/deploy/pathplanner/paths/#1 Left under the trench.path
src/main/deploy/pathplanner/paths/#2 Left(No SOTM) under the trench.path
src/main/deploy/pathplanner/paths/#3(No SOTM) Left under the trench.path
src/main/java/frc/robot/RobotContainer.java
src/main/java/frc/robot/commands/drive_comm/DefaultDriveCommand.java
src/main/java/frc/robot/constants/IntakeConstants.java
src/main/java/frc/robot/subsystems/turret/Turret.java
src/main/java/frc/robot/subsystems/turret/TurretConstants.java

index 4ef131d9e91739a6121128a7824404543d8b0487..db0b7a00574efe13191da97762c35dbda99d3996 100644 (file)
             "pathName": "#2 Left(No SOTM) under the trench"
           }
         },
+        {
+          "type": "parallel",
+          "data": {
+            "commands": [
+              {
+                "type": "wait",
+                "data": {
+                  "waitTime": 8.0
+                }
+              },
+              {
+                "type": "named",
+                "data": {
+                  "name": "Start Intake Seizure"
+                }
+              },
+              {
+                "type": "named",
+                "data": {
+                  "name": "Start Spindexer"
+                }
+              }
+            ]
+          }
+        },
         {
           "type": "path",
           "data": {
             "pathName": "#3(No SOTM) Left under the trench"
           }
+        },
+        {
+          "type": "parallel",
+          "data": {
+            "commands": [
+              {
+                "type": "wait",
+                "data": {
+                  "waitTime": 15.0
+                }
+              },
+              {
+                "type": "named",
+                "data": {
+                  "name": "Start Intake Seizure"
+                }
+              },
+              {
+                "type": "named",
+                "data": {
+                  "name": "Start Spindexer"
+                }
+              }
+            ]
+          }
         }
       ]
     }
index a5b24f8f74c5b55db27d8498d61054fa229f0dd9..587ab10aa6a5f3d20dee952767f7e7a7a7d0daef 100644 (file)
     }
   ],
   "pointTowardsZones": [],
-  "eventMarkers": [],
+  "eventMarkers": [
+    {
+      "name": "Intake",
+      "waypointRelativePos": 0,
+      "endWaypointRelativePos": null,
+      "command": {
+        "type": "parallel",
+        "data": {
+          "commands": [
+            {
+              "type": "named",
+              "data": {
+                "name": "Extend Intake"
+              }
+            },
+            {
+              "type": "named",
+              "data": {
+                "name": "Spin Intake Rollers"
+              }
+            }
+          ]
+        }
+      }
+    }
+  ],
   "globalConstraints": {
     "maxVelocity": 3.0,
     "maxAcceleration": 3.0,
index 2d8b84aef5b8a611f0ee2472c51221096c3058df..0ae719259f04ee04e9b9ddfbdc99eae899c17ece 100644 (file)
     }
   ],
   "pointTowardsZones": [],
-  "eventMarkers": [],
+  "eventMarkers": [
+    {
+      "name": "Retract Intake",
+      "waypointRelativePos": 0.65466816647919,
+      "endWaypointRelativePos": null,
+      "command": {
+        "type": "parallel",
+        "data": {
+          "commands": [
+            {
+              "type": "named",
+              "data": {
+                "name": "Retract Intake"
+              }
+            },
+            {
+              "type": "named",
+              "data": {
+                "name": "Stop Intake Rollers"
+              }
+            }
+          ]
+        }
+      }
+    }
+  ],
   "globalConstraints": {
     "maxVelocity": 3.0,
     "maxAcceleration": 3.0,
index dab87833a382dd431150cc5e1c318038665ca487..53e7d7795cd369a3ca91d1becfd0b9c4c19f8bc6 100644 (file)
     }
   ],
   "pointTowardsZones": [],
-  "eventMarkers": [],
+  "eventMarkers": [
+    {
+      "name": "Getting Ready",
+      "waypointRelativePos": 0,
+      "endWaypointRelativePos": null,
+      "command": {
+        "type": "sequential",
+        "data": {
+          "commands": [
+            {
+              "type": "parallel",
+              "data": {
+                "commands": [
+                  {
+                    "type": "named",
+                    "data": {
+                      "name": "Stop Intake Seizure"
+                    }
+                  },
+                  {
+                    "type": "named",
+                    "data": {
+                      "name": "Stop Spindexer"
+                    }
+                  }
+                ]
+              }
+            },
+            {
+              "type": "parallel",
+              "data": {
+                "commands": [
+                  {
+                    "type": "named",
+                    "data": {
+                      "name": "Extend Intake"
+                    }
+                  },
+                  {
+                    "type": "named",
+                    "data": {
+                      "name": "Spin Intake Rollers"
+                    }
+                  }
+                ]
+              }
+            }
+          ]
+        }
+      }
+    }
+  ],
   "globalConstraints": {
     "maxVelocity": 3.0,
     "maxAcceleration": 3.0,
index 5dcfa84b18221065322283591ddcf555b84c52cd..b22ab22c2597c1dc5502cefdacdd92e02ac1cfab 100644 (file)
@@ -25,6 +25,7 @@ import frc.robot.commands.DoNothing;
 import frc.robot.commands.drive_comm.DefaultDriveCommand;
 import frc.robot.commands.gpm.AutoShootCommand;
 import frc.robot.commands.gpm.ClimbDriveCommand;
+import frc.robot.commands.gpm.IntakeMovementCommand;
 import frc.robot.commands.gpm.Superstructure;
 import frc.robot.commands.vision.ShutdownAllPis;
 import frc.robot.constants.AutoConstants;
@@ -147,7 +148,7 @@ public class RobotContainer {
           e.printStackTrace();
         }
         if(turret != null){
-          turret.setDefaultCommand(new Superstructure(turret, drive, hood, shooter, spindexer));
+          //turret.setDefaultCommand(new Superstructure(turret, drive, hood, shooter, spindexer));
         }
         drive.setDefaultCommand(new DefaultDriveCommand(drive, driver));
         break;
@@ -192,8 +193,8 @@ public class RobotContainer {
 
   public void registerCommands() {
     if (intake != null){
-      NamedCommands.registerCommand("Extend intake", new InstantCommand(()-> intake.extend()));
-      NamedCommands.registerCommand("Retract intake", new InstantCommand(()-> intake.retract()));
+      NamedCommands.registerCommand("Extend Intake", new InstantCommand(()-> intake.extend()));
+      NamedCommands.registerCommand("Retract Intake", new InstantCommand(()-> intake.retract()));
     }
 
     if (intake != null && spindexer != null){ 
@@ -203,11 +204,16 @@ public class RobotContainer {
       NamedCommands.registerCommand("Stop Intake Rollers", new ParallelCommandGroup(
         new InstantCommand(()->intake.spinStop())
       ));
+      Command intakeMovement = new IntakeMovementCommand(intake);
+      NamedCommands.registerCommand("Start Intake Seizure", new InstantCommand(()-> intakeMovement.schedule()));
+      NamedCommands.registerCommand("Stop Intake Seizure", new InstantCommand(()-> intakeMovement.cancel()));
+
+
     }
 
     if (turret != null && drive != null && hood != null && shooter != null && spindexer != null){
       NamedCommands.registerCommand("Auto shoot", new AutoShootCommand(turret, drive, hood, shooter, spindexer));
-      NamedCommands.registerCommand("Spin Spindexer", new InstantCommand(()-> spindexer.maxSpindexer(), spindexer));
+      NamedCommands.registerCommand("Start Spindexer", new InstantCommand(()-> spindexer.maxSpindexer(), spindexer));
       NamedCommands.registerCommand("Stop Spindexer", new InstantCommand(()-> spindexer.stopSpindexer()));
     }
 
index c481e0d87f3d0746c3b9668fa5caaf5d15b1e033..daa9b1eb6f9ab4f4326f88d7dac33a60ef07c8bc 100644 (file)
@@ -12,7 +12,7 @@ import frc.robot.Robot;
 import frc.robot.constants.swerve.DriveConstants;
 import frc.robot.controls.BaseDriverConfig;
 import frc.robot.subsystems.drivetrain.Drivetrain;
-import frc.robot.util.TrenchAssist.TrenchAssist2;
+import frc.robot.util.TrenchAssist.TrenchAssist;
 import frc.robot.util.TrenchAssist.TrenchAssistConstants;
 import frc.robot.util.Vision.DriverAssist;
 
@@ -88,7 +88,7 @@ public class DefaultDriveCommand extends Command {
 
         Logger.recordOutput("TrenchAssist", swerve.getTrenchAssist());
         if (swerve.getTrenchAssist()) {
-            drive(TrenchAssist2.calculate(swerve, corrected, trenchAssistPid));
+            drive(TrenchAssist.calculate(swerve, corrected, trenchAssistPid));
         } else {
             trenchAssistPid.reset();
             drive(corrected);
index e09f459f7897e471190ebed7974923db468ef57f..b58189ce9583c5441810b4827dfdc08c1a535736 100644 (file)
@@ -4,7 +4,7 @@ import edu.wpi.first.math.util.Units;
 
 public class IntakeConstants {
     /** Intake roller motor speed in range [-1, 1] */
-    public static final double SPEED = 0.8;
+    public static final double SPEED = 1.0;
     /** 12 tooth pinion driving 36 tooth driven gear */
     public static final double GEAR_RATIO = 36.0/12.0;
     /** radius (inches) of the rack gear which is a 10 tooth pinion at 10 DP */
index 69969eb13be5c97a3de0587015d4230c3c6e9058..15f13af40f42ea98c33a796707c0648b45101a99 100644 (file)
@@ -74,10 +74,10 @@ public class Turret extends SubsystemBase implements TurretIO{
                TalonFXConfiguration config = new TalonFXConfiguration();
                config.MotorOutput.Inverted = InvertedValue.CounterClockwise_Positive;
     
-               config.Slot0.kP = 10.0; 
+               config.Slot0.kP = 12.0; 
                config.Slot0.kS = 0.1; // Static friction compensation
                config.Slot0.kV = 0.12; // Adjusted kV for the gear ratio
-               config.Slot0.kD = 0.20; // The "Braking" term to stop overshoot
+               config.Slot0.kD = 0.50; // The "Braking" term to stop overshoot
 
                var mm = config.MotionMagic;
                mm.MotionMagicCruiseVelocity = Units.radiansToRotations(TurretConstants.MAX_VELOCITY) * TurretConstants.GEAR_RATIO;
@@ -115,10 +115,7 @@ public class Turret extends SubsystemBase implements TurretIO{
                crt = new ModifiedCRT(TurretConstants.LEFT_ENCODER_TEETH, TurretConstants.RIGHT_ENCODER_TEETH, TurretConstants.TURRET_TEETH_COUNT);
 
                double turretRot = crt.solve(leftAbs, rightAbs); 
-               //SmartDashboard.putNumber("Turret Index", turretIndex);
-
-               SmartDashboard.putNumber("CRT Position", Units.rotationsToDegrees(turretRot));
-
+               
                double motorRotations = turretRot * TurretConstants.GEAR_RATIO;
 
                //Sets the initial motor position
@@ -243,6 +240,19 @@ public class Turret extends SubsystemBase implements TurretIO{
                SmartDashboard.putNumber("Turret position", Units.radiansToDegrees(getPositionRad()));
                SmartDashboard.putNumber("Encoder left position", encoderLeft.getAbsolutePosition().getValueAsDouble());
                SmartDashboard.putNumber("Encoder right position", encoderRight.getAbsolutePosition().getValueAsDouble());
+
+
+               double leftPosition = encoderLeft.getAbsolutePosition().getValueAsDouble();
+               double leftAbs = wrapUnit(leftPosition - TurretConstants.LEFT_ENCODER_OFFSET);
+
+               double rightPosition = encoderRight.getAbsolutePosition().getValueAsDouble();
+               double rightAbs = wrapUnit(rightPosition - TurretConstants.RIGHT_ENCODER_OFFSET);
+
+               crt = new ModifiedCRT(TurretConstants.LEFT_ENCODER_TEETH, TurretConstants.RIGHT_ENCODER_TEETH, TurretConstants.TURRET_TEETH_COUNT);
+
+               double turretRot = crt.solve(leftAbs, rightAbs); 
+
+               SmartDashboard.putNumber("CRT Position", Units.rotationsToDegrees(turretRot));
        }
 
        /* ---------------- Simulation ---------------- */
index e14c1a739cfaba30c76c8b148614d2e35578ffee..d63095113287930312f097af5e0a82cd7c3096da 100644 (file)
@@ -10,7 +10,8 @@ public class TurretConstants {
     public static double CALIBRATION_OFFSET = 0.0; // TODO: find this at hardstop
 
     public static double MAX_VELOCITY = 600; // rad/s
-    public static double MAX_ACCELERATION = 120.0; // rad/s^2
+    // public static double MAX_ACCELERATION = 120.0; // rad/s^2
+    public static double MAX_ACCELERATION = 320.0; // rad/s^2
 
     // Not using this, but just in case
     public static double TURRET_WIDTH = Units.inchesToMeters(6.4);