From 37f76cabb6c7d7b1ca6e0575963c73d4ef70c3ec Mon Sep 17 00:00:00 2001 From: Jordan Miller Date: Thu, 22 Jan 2026 19:48:55 -0500 Subject: [PATCH 1/3] Better turret tuning --- .../java/frc/robot/controls/OperatorControls.java | 2 +- .../java/frc/robot/subsystems/Superstructure.java | 7 +++++-- .../java/frc/robot/subsystems/TurretSubsystem.java | 11 ++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc/robot/controls/OperatorControls.java b/src/main/java/frc/robot/controls/OperatorControls.java index ecbcbef..73e5b0f 100644 --- a/src/main/java/frc/robot/controls/OperatorControls.java +++ b/src/main/java/frc/robot/controls/OperatorControls.java @@ -62,7 +62,7 @@ public static void configure(int port, SwerveSubsystem drivetrain, Superstructur // } // REAL CONTROLS - controller.start().onTrue(superstructure.rezeroIntakePivotCommand().ignoringDisable(true)); + controller.start().onTrue(superstructure.rezeroIntakePivotAndTurretCommand().ignoringDisable(true)); controller.rightBumper() .whileTrue(superstructure.setIntakeDeployAndRoll().withName("OperatorControls.intakeDeployed")); diff --git a/src/main/java/frc/robot/subsystems/Superstructure.java b/src/main/java/frc/robot/subsystems/Superstructure.java index cf077a0..1157f14 100644 --- a/src/main/java/frc/robot/subsystems/Superstructure.java +++ b/src/main/java/frc/robot/subsystems/Superstructure.java @@ -295,8 +295,11 @@ public Command stopShootingCommand() { } // Re-zero intake pivot if needed - public Command rezeroIntakePivotCommand() { - return intake.rezero().withName("Superstructure.rezeroIntakePivot"); + public Command rezeroIntakePivotAndTurretCommand() { + return Commands.parallel( + turret.rezero().withName("Superstructure.rezeroTurret"), + intake.rezero().withName("Superstructure.rezeroIntakePivot")) + .withName("Superstructure.rezeroIntakePivotAndTurret"); } @Override diff --git a/src/main/java/frc/robot/subsystems/TurretSubsystem.java b/src/main/java/frc/robot/subsystems/TurretSubsystem.java index afc355a..d83c524 100644 --- a/src/main/java/frc/robot/subsystems/TurretSubsystem.java +++ b/src/main/java/frc/robot/subsystems/TurretSubsystem.java @@ -7,7 +7,7 @@ import com.revrobotics.spark.SparkLowLevel.MotorType; import com.revrobotics.spark.SparkMax; -import edu.wpi.first.math.controller.ArmFeedforward; +import edu.wpi.first.math.controller.SimpleMotorFeedforward; import edu.wpi.first.math.geometry.Pose3d; import edu.wpi.first.math.geometry.Rotation3d; import edu.wpi.first.math.geometry.Translation3d; @@ -22,6 +22,7 @@ import static edu.wpi.first.units.Units.Volts; import edu.wpi.first.units.measure.Angle; import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; import yams.gearing.GearBox; @@ -53,8 +54,8 @@ public class TurretSubsystem extends SubsystemBase { private SmartMotorControllerConfig smcConfig = new SmartMotorControllerConfig(this) .withControlMode(ControlMode.CLOSED_LOOP) - .withClosedLoopController(60.0, 0, 0, DegreesPerSecond.of(10800), DegreesPerSecondPerSecond.of(10800)) - .withFeedforward(new ArmFeedforward(0, 0, 0)) + .withClosedLoopController(15.0, 0, 0, DegreesPerSecond.of(2440), DegreesPerSecondPerSecond.of(2440)) + .withFeedforward(new SimpleMotorFeedforward(0, 7.5, 0)) .withTelemetry("TurretMotor", TelemetryVerbosity.HIGH) .withGearing(new MechanismGearing(GearBox.fromReductionStages(4, 10))) .withMotorInverted(true) @@ -105,6 +106,10 @@ public Command set(double dutyCycle) { return turret.set(dutyCycle); } + public Command rezero() { + return Commands.runOnce(() -> spark.getEncoder().setPosition(0), this).withName("Turret.Rezero"); + } + public Command sysId() { return turret.sysId(Volts.of(7), Volts.of(2).per(Second), Seconds.of(10)); } From 6c7ee208fc0240d9c2e91ed3b5e9c721c89fc312 Mon Sep 17 00:00:00 2001 From: Jordan Miller Date: Thu, 22 Jan 2026 21:12:47 -0500 Subject: [PATCH 2/3] Better intake tuning --- .../frc/robot/subsystems/IntakeSubsystem.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/IntakeSubsystem.java b/src/main/java/frc/robot/subsystems/IntakeSubsystem.java index 13aeae9..bbada41 100644 --- a/src/main/java/frc/robot/subsystems/IntakeSubsystem.java +++ b/src/main/java/frc/robot/subsystems/IntakeSubsystem.java @@ -1,8 +1,12 @@ package frc.robot.subsystems; +import com.revrobotics.spark.SparkMax; +import com.revrobotics.spark.SparkLowLevel.MotorType; + import com.thethriftybot.ThriftyNova; import edu.wpi.first.math.controller.ArmFeedforward; +import edu.wpi.first.math.controller.SimpleMotorFeedforward; import edu.wpi.first.math.system.plant.DCMotor; import static edu.wpi.first.units.Units.Amps; import static edu.wpi.first.units.Units.Degrees; @@ -30,6 +34,7 @@ import yams.motorcontrollers.SmartMotorControllerConfig.MotorMode; import yams.motorcontrollers.SmartMotorControllerConfig.TelemetryVerbosity; import yams.motorcontrollers.local.NovaWrapper; +import yams.motorcontrollers.local.SparkWrapper; public class IntakeSubsystem extends SubsystemBase { @@ -60,18 +65,22 @@ public class IntakeSubsystem extends SubsystemBase { // 5:1, 5:1, 60/18 reduction private SmartMotorControllerConfig intakePivotSmartMotorConfig = new SmartMotorControllerConfig(this) .withControlMode(ControlMode.CLOSED_LOOP) - .withClosedLoopController(10, 0, 0, DegreesPerSecond.of(1080), DegreesPerSecondPerSecond.of(1080)) - .withFeedforward(new ArmFeedforward(0, 0, 1.3)) + .withClosedLoopController(25, 0, 0, DegreesPerSecond.of(360), DegreesPerSecondPerSecond.of(360)) + .withFeedforward(new SimpleMotorFeedforward(0, 10, 0)) .withTelemetry("IntakePivotMotor", TelemetryVerbosity.HIGH) - .withGearing(new MechanismGearing(GearBox.fromReductionStages(5, 5, 60.0 / 18.0, 42))) + .withGearing(new MechanismGearing(GearBox.fromReductionStages(5, 5, 60.0 / 18.0))) + // .withGearing(new MechanismGearing(GearBox.fromReductionStages(5, 5, 60.0 / + // 18.0, 42))) .withMotorInverted(false) .withIdleMode(MotorMode.COAST) + .withSoftLimit(Degrees.of(0), Degrees.of(150)) .withStatorCurrentLimit(Amps.of(10)) - .withClosedLoopRampRate(Seconds.of(0.1)); + .withClosedLoopRampRate(Seconds.of(0.1)) + .withOpenLoopRampRate(Seconds.of(0.1)); - private ThriftyNova pivotMotor = new ThriftyNova(Constants.IntakeConstants.kPivotMotorId); + private SparkMax pivotMotor = new SparkMax(Constants.IntakeConstants.kPivotMotorId, MotorType.kBrushless); - private SmartMotorController intakePivotController = new NovaWrapper(pivotMotor, DCMotor.getNeoVortex(1), + private SmartMotorController intakePivotController = new SparkWrapper(pivotMotor, DCMotor.getNeoVortex(1), intakePivotSmartMotorConfig); private final ArmConfig intakePivotConfig = new ArmConfig(intakePivotController) @@ -85,7 +94,7 @@ public class IntakeSubsystem extends SubsystemBase { private Arm intakePivot = new Arm(intakePivotConfig); public IntakeSubsystem() { - pivotMotor.factoryReset(); + // pivotMotor.factoryReset(); } /** @@ -107,7 +116,7 @@ public Command setPivotAngle(Angle angle) { } public Command rezero() { - return Commands.runOnce(() -> pivotMotor.setEncoderPosition(0), this).withName("IntakePivot.Rezero"); + return Commands.runOnce(() -> pivotMotor.getEncoder().setPosition(0), this).withName("IntakePivot.Rezero"); } /** From cdeef27da538ad7bd25da42234dc9f577c5ba72c Mon Sep 17 00:00:00 2001 From: Jordan Miller Date: Fri, 23 Jan 2026 20:59:29 -0500 Subject: [PATCH 3/3] No intake pivot during feeding, for SOTM --- src/main/java/frc/robot/subsystems/Superstructure.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/Superstructure.java b/src/main/java/frc/robot/subsystems/Superstructure.java index 1157f14..95252fb 100644 --- a/src/main/java/frc/robot/subsystems/Superstructure.java +++ b/src/main/java/frc/robot/subsystems/Superstructure.java @@ -240,8 +240,8 @@ public Command kickerStopCommand() { public Command feedAllCommand() { return Commands.parallel( hopper.feedCommand().asProxy(), - kicker.feedCommand().asProxy(), - intake.setPivotAngle(Degrees.of(46)).asProxy()).withName("Superstructure.feedAll"); + kicker.feedCommand().asProxy()).withName("Superstructure.feedAll"); + // intake.setPivotAngle(Degrees.of(46)).asProxy()).withName("Superstructure.feedAll"); } public Command backFeedAllCommand() {