From 6c4ec5b822a0442b56273b1f543d49966796d744 Mon Sep 17 00:00:00 2001 From: clarkmilbert Date: Wed, 22 Apr 2026 23:37:48 -0500 Subject: [PATCH 1/2] add ability to set slip current --- .../java/com/team1816/lib/hardware/factory/RobotFactory.java | 5 +++++ src/main/resources/schemas/hardware/kinematics.schema.json | 5 +++++ src/main/resources/yaml/ztldr.yml | 5 +---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/team1816/lib/hardware/factory/RobotFactory.java b/src/main/java/com/team1816/lib/hardware/factory/RobotFactory.java index 13d84f1..c89921b 100644 --- a/src/main/java/com/team1816/lib/hardware/factory/RobotFactory.java +++ b/src/main/java/com/team1816/lib/hardware/factory/RobotFactory.java @@ -744,6 +744,7 @@ public SwerveDrivetrainConstants getSwerveDrivetrainConstant(String subsystemNam factory.DriveMotorGearRatio = kinematics.driveGearing; factory.SteerMotorGearRatio = kinematics.steerGearing; factory.CouplingGearRatio = kinematics.couplingGearRatio; + factory.SlipCurrent = kinematics.slipCurrentAmps; factory.SpeedAt12Volts = maxSpd; for (var module : config.modules.values()) { @@ -762,6 +763,7 @@ public SwerveDrivetrainConstants getSwerveDrivetrainConstant(String subsystemNam GreenLogger.log(" DriveMotorGearRatio: " + factory.DriveMotorGearRatio); GreenLogger.log(" SteerMotorGearRatio: " + factory.SteerMotorGearRatio); GreenLogger.log(" CouplingGearRatio: " + factory.CouplingGearRatio); + GreenLogger.log(" SlipCurrent: " + factory.SlipCurrent); GreenLogger.log(" SpeedAt12Volts: " + factory.SpeedAt12Volts); } @@ -832,6 +834,9 @@ private void verifyKinematics(String subsystemName, KinematicsConfig kinematics) if (kinematics.couplingGearRatio == null || kinematics.couplingGearRatio == 0) { property = "couplingGearRatio"; } + if (kinematics.slipCurrentAmps == null || kinematics.slipCurrentAmps == 0) { + property = "slipCurrentAmps"; + } if (property != null) { var message = subsystemName + " kinematics " + property + " can't be null or 0"; throw new IllegalArgumentException(message); diff --git a/src/main/resources/schemas/hardware/kinematics.schema.json b/src/main/resources/schemas/hardware/kinematics.schema.json index 40200ba..0e4d184 100644 --- a/src/main/resources/schemas/hardware/kinematics.schema.json +++ b/src/main/resources/schemas/hardware/kinematics.schema.json @@ -50,6 +50,11 @@ "type" : "number", "default": null, "description": "number of rotations of the drive motor caused by a rotation of the azimuth" + }, + "slipCurrentAmps": { + "type" : "number", + "default": null, + "description": "maximum amount of stator current the drive motors can apply without slippage" } } } diff --git a/src/main/resources/yaml/ztldr.yml b/src/main/resources/yaml/ztldr.yml index afdc6f4..c1d1de6 100644 --- a/src/main/resources/yaml/ztldr.yml +++ b/src/main/resources/yaml/ztldr.yml @@ -41,7 +41,6 @@ subsystems: id: 35 deviceType: TalonFX neutralMode: Brake - statorCurrentLimit: 80 supplyCurrentLimit: 40 flAz: id: 30 @@ -60,7 +59,6 @@ subsystems: deviceType: TalonFX neutralMode: Brake motorRotation: Clockwise_Positive - statorCurrentLimit: 80 supplyCurrentLimit: 40 frAz: id: 31 @@ -78,7 +76,6 @@ subsystems: id: 37 deviceType: TalonFX neutralMode: Brake - statorCurrentLimit: 80 supplyCurrentLimit: 40 blAz: id: 33 @@ -97,7 +94,6 @@ subsystems: deviceType: TalonFX neutralMode: Brake motorRotation: Clockwise_Positive - statorCurrentLimit: 80 supplyCurrentLimit: 40 brAz: id: 32 @@ -152,6 +148,7 @@ subsystems: maxDriveRPS: 98 # measured motor max speed rps maxAngularRate: 8.285 # rad/sec wheelCOF: 1.7 + slipCurrentAmps: 120 constants: translationKp: 20 translationKd: 0 From c00ce821f1f1b0fd33a8ed88646a132ed349a9a7 Mon Sep 17 00:00:00 2001 From: clarkmilbert Date: Fri, 24 Apr 2026 00:34:55 -0500 Subject: [PATCH 2/2] distance tuning --- .../team1816/season/subsystems/Shooter.java | 4 +-- src/main/resources/yaml/ztldr.yml | 34 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/team1816/season/subsystems/Shooter.java b/src/main/java/com/team1816/season/subsystems/Shooter.java index 163a7a5..7f9a2ca 100644 --- a/src/main/java/com/team1816/season/subsystems/Shooter.java +++ b/src/main/java/com/team1816/season/subsystems/Shooter.java @@ -79,7 +79,7 @@ public class Shooter extends SubsystemBase implements ITestableSubsystem { /** * An adjustment value added to all requests to the turret (in degrees). */ - private double turretAngleAdjustmentDegrees = -1.0; + private double turretAngleAdjustmentDegrees = 0; private boolean useChassisSpeedForHoodAngleAndSpeed = false; @@ -331,7 +331,7 @@ private void applyState() { isAutoAiming = autoAimTurret || wantedDistanceState == ShooterDistanceState.AUTOMATIC; if (autoAimTurret) { - double turretLookAheadTimeSeconds = 0.5; + double turretLookAheadTimeSeconds = 0; IShooterCalculator.ShooterCalculatorResponse calculatorResponse = shooterTableCalculator.calculate( getCurrentTurretPose3d().getTranslation(), target, diff --git a/src/main/resources/yaml/ztldr.yml b/src/main/resources/yaml/ztldr.yml index 8492419..2bdb171 100644 --- a/src/main/resources/yaml/ztldr.yml +++ b/src/main/resources/yaml/ztldr.yml @@ -1,31 +1,31 @@ shooterSettings: distancesInches: + - 48.5 - 60 - 96 - 120 - 156 - - 204 - 210 - - 264 - - 360 # Maximum distance shot + - 272 + - 272 inclineAnglesRotations: - - 0.057 # 48 + - 0.057 # 48.5 + - 0.057 # 60 - 0.064 #96 - 0.07 # 120 - 0.08 # 156 - - 0.09 # 204 - - 0.09 #210 - - 0.1113 # 264 - - 0.108 # 360 + - 0.083 #210 + - 0.095 # 272 + - 0.085 # 272 launchVelocitiesRPS: - - 32 # 48 - - 39 # 96 - - 41 #120 - - 43 # 156 - - 46 # 204 - - 48 #210 - - 49 # 264 - - 50 # 360 + - 38 # 48.5 + - 40 # 60 + - 42 # 96 + - 43 #120 + - 44 # 156 + - 49 # 210 + - 54 # 272 + - 58 # 272 linearMPSToLaunchRPS: # TODO: Actual tune this. For now we are just using the shooterSettings and doing some physics to convert. linearVelocitiesMPS: - 10 @@ -148,7 +148,7 @@ subsystems: maxDriveRPS: 98 # measured motor max speed rps maxAngularRate: 8.285 # rad/sec wheelCOF: 1.7 - slipCurrentAmps: 120 + slipCurrentAmps: 42 constants: translationKp: 20 translationKd: 0