From faa00f45f56f764aff4dcfb24fd1874b98b95522 Mon Sep 17 00:00:00 2001 From: WesleyWong-972 Date: Mon, 23 Mar 2026 15:23:05 -0700 Subject: [PATCH] current limit and stuff --- .../java/frc/robot/constants/swerve/DriveConstants.java | 2 +- src/main/java/frc/robot/subsystems/shooter/Shooter.java | 8 +++++++- .../frc/robot/subsystems/shooter/ShooterConstants.java | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/constants/swerve/DriveConstants.java b/src/main/java/frc/robot/constants/swerve/DriveConstants.java index f39931f..5d69304 100644 --- a/src/main/java/frc/robot/constants/swerve/DriveConstants.java +++ b/src/main/java/frc/robot/constants/swerve/DriveConstants.java @@ -53,7 +53,7 @@ public class DriveConstants { // To do so, divide by the radius. The radius is the diagonal of the square chassis, diagonal = sqrt(2) * side_length. public static final double MAX_ANGULAR_SPEED = MAX_SPEED / ((TRACK_WIDTH / 2) * Math.sqrt(2)); - public static final double COSF = 1.5; + public static final double COSF = 2.255; // The maximum acceleration of the robot, limited by friction public static final double MAX_LINEAR_ACCEL = COSF * Constants.GRAVITY_ACCELERATION; diff --git a/src/main/java/frc/robot/subsystems/shooter/Shooter.java b/src/main/java/frc/robot/subsystems/shooter/Shooter.java index 024c11f..10969cd 100644 --- a/src/main/java/frc/robot/subsystems/shooter/Shooter.java +++ b/src/main/java/frc/robot/subsystems/shooter/Shooter.java @@ -16,6 +16,7 @@ import edu.wpi.first.wpilibj2.command.InstantCommand; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.constants.Constants; import frc.robot.constants.IdConstants; +import frc.robot.constants.IntakeConstants; import frc.robot.util.HubActive; public class Shooter extends SubsystemBase implements ShooterIO { @@ -38,7 +39,7 @@ public class Shooter extends SubsystemBase implements ShooterIO { double powerModifier = 1.05; // TESTED - public Shooter(){ + public Shooter() { updateInputs(); TalonFXConfiguration config = new TalonFXConfiguration(); @@ -46,6 +47,11 @@ public class Shooter extends SubsystemBase implements ShooterIO { config.Slot0.kI = 0; config.Slot0.kD = 0.0; config.Slot0.kV = 0.125; //Maximum rps = 100 --> 12V/100rps + + config.CurrentLimits + .withSupplyCurrentLimit(ShooterConstants.SHOOTER_CURRENT_LIMIT) + .withSupplyCurrentLimitEnable(true); + shooterMotorLeft.getConfigurator().apply(config); shooterMotorRight.getConfigurator().apply(config); diff --git a/src/main/java/frc/robot/subsystems/shooter/ShooterConstants.java b/src/main/java/frc/robot/subsystems/shooter/ShooterConstants.java index e320c55..6644426 100644 --- a/src/main/java/frc/robot/subsystems/shooter/ShooterConstants.java +++ b/src/main/java/frc/robot/subsystems/shooter/ShooterConstants.java @@ -5,4 +5,5 @@ import edu.wpi.first.math.util.Units; public class ShooterConstants { public static final double SHOOTER_VELOCITY = 1.0; public static final double SHOOTER_LAUNCH_DIAMETER = Units.inchesToMeters(4.0); + public static final double SHOOTER_CURRENT_LIMIT = 80; } -- 2.39.5