From 557508c54b7e7688ba25032cacb854534d9eec15 Mon Sep 17 00:00:00 2001 From: Ethan <137455719+EndigoSkull@users.noreply.github.com> Date: Sat, 21 Mar 2026 08:53:49 -0500 Subject: [PATCH 1/5] initial driver exp adjustments, need to add incrementers for values --- .../subsystems/drivetrain/IDrivetrain.java | 5 +--- .../lib/subsystems/drivetrain/Swerve.java | 28 ++++++++----------- src/main/resources/yaml/ztldr.yml | 19 +++++++------ 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java b/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java index 70aac426..23f00c4c 100644 --- a/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java +++ b/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java @@ -22,11 +22,8 @@ public interface IDrivetrain extends ITestableSubsystem { double maxSpd = (config.kinematics.maxDriveRPS / config.kinematics.driveGearing) * 2 * Math.PI * config.kinematics.wheelRadius; double cof = config.kinematics.wheelCOF; double gearing = config.kinematics.driveGearing; - double wheelCircumference = 2 * Math.PI * whlRad; - // MOI = mass * (width^2 + length^2) / 12, with 1.5x multiplier to account for - // concentrated perimeter mass (swerve modules, bumpers, battery) - double MOI = 1.5 * massKG * (config.kinematics.wheelbaseWidth * config.kinematics.wheelbaseWidth + config.kinematics.wheelbaseLength * config.kinematics.wheelbaseLength) / 12; + double MOI = 1.5; boolean isAllowedToPathPlannerPath = false; diff --git a/src/main/java/com/team1816/lib/subsystems/drivetrain/Swerve.java b/src/main/java/com/team1816/lib/subsystems/drivetrain/Swerve.java index 28d366c3..dc46c270 100644 --- a/src/main/java/com/team1816/lib/subsystems/drivetrain/Swerve.java +++ b/src/main/java/com/team1816/lib/subsystems/drivetrain/Swerve.java @@ -26,9 +26,9 @@ public class Swerve extends SubsystemBase implements ITestableSubsystem { private final IDrivetrain drivetrain; private final CommandXboxController controller; - private final SlewRateLimiter xLimiter = new SlewRateLimiter(3); // forward/back - private final SlewRateLimiter yLimiter = new SlewRateLimiter(3); // strafe - private final SlewRateLimiter rotLimiter = new SlewRateLimiter(6); // rotation + private final SlewRateLimiter xLimiter = new SlewRateLimiter(1); // forward/back + private final SlewRateLimiter yLimiter = new SlewRateLimiter(1); // strafe + private final SlewRateLimiter rotLimiter = new SlewRateLimiter(1); // rotation private static double maxAngularRate = 0; // Blue alliance sees forward as 0 degrees (toward red alliance wall). @@ -78,6 +78,7 @@ public void periodic() { } private SwerveRequest GetSwerverCommand(SwerveRequest.FieldCentric drive) { + double deadBand = 0.05; // 1. Get raw joystick values (-1.0 to +1.0) double rawX = -controller.getLeftY(); // forward/back (negative because forward is usually negative Y) @@ -85,21 +86,16 @@ private SwerveRequest GetSwerverCommand(SwerveRequest.FieldCentric drive) { double rawRot = -controller.getRightX(); // rotation // 2. Deadband (remove drift) - rawX = Math.abs(rawX) < 0.08 ? 0 : rawX; - rawY = Math.abs(rawY) < 0.08 ? 0 : rawY; - rawRot = Math.abs(rawRot) < 0.08 ? 0 : rawRot; + double x = Math.abs(rawX) < deadBand ? 0 : (rawX-deadBand)*1/(1-deadBand); + double y = Math.abs(rawY) < deadBand ? 0 : (rawY-deadBand)*1/(1-deadBand); + double rot = Math.abs(rawRot) < deadBand ? 0 : (rawRot-deadBand)*1/(1-deadBand); - // 3. Cube the inputs → insane precision at low speed, full power at full stick - double x = rawX * rawX * rawX; - double y = rawY * rawY * rawY; - double rot = rawRot * rawRot * rawRot; + // 3. Slew rate limit → buttery smooth acceleration +// x = xLimiter.calculate(x); +// y = yLimiter.calculate(y); +// rot = rotLimiter.calculate(rot); - // 4. Slew rate limit → buttery smooth acceleration - x = xLimiter.calculate(x); - y = yLimiter.calculate(y); - rot = rotLimiter.calculate(rot); - - // 5. Multipliers to slow down movement based on driver preference. Slow mode and normal mode. + // 4. Multipliers to slow down movement based on driver preference. Slow mode and normal mode. if (controller.leftTrigger().getAsBoolean()) { x *= SLOW_MODE_TRANSLATIONAL_MULTIPLIER; y *= SLOW_MODE_TRANSLATIONAL_MULTIPLIER; diff --git a/src/main/resources/yaml/ztldr.yml b/src/main/resources/yaml/ztldr.yml index 2c3bc2e6..e7023866 100644 --- a/src/main/resources/yaml/ztldr.yml +++ b/src/main/resources/yaml/ztldr.yml @@ -131,23 +131,24 @@ subsystems: kinematics: driveGearing: 6.03 steerGearing: 26.0909 - wheelbaseLength: .505 # meters - wheelbaseWidth: .505 # meters - robotMass: 74.088 # kg + wheelbaseLength: 0.4305 # meters + wheelbaseWidth: 0.4305 # meters + robotMass: 56.7 # kg wheelRadius: .04938 # meters (1.944 in) - maxDriveRPS: 98 # measured motor max speed rps - maxAngularRate: 8.285 # rad/sec - wheelCOF: 1.7 + maxDriveRPS: 80 # measured motor max speed rps + maxAngularRate: 1.3 # rot/sec + wheelCOF: 1 constants: translationKp: 20 translationKd: 0 rotationKp: 10 rotationKi: 0 rotationKd: 0 + #Driver preference options normalModeTranslationalMultiplier: 1 - normalModeRotationalMultiplier: 0.4 - slowModeTranslationalMultiplier: 0.35 - slowModeRotationalMultiplier: 0.15 + normalModeRotationalMultiplier: 1 + slowModeTranslationalMultiplier: 0.5 + slowModeRotationalMultiplier: 1 ledManager: implemented: false devices: From ac53d297a244e1885d763ea86874422dc45f0a19 Mon Sep 17 00:00:00 2001 From: Ethan <137455719+EndigoSkull@users.noreply.github.com> Date: Sat, 21 Mar 2026 08:53:49 -0500 Subject: [PATCH 2/5] initial driver exp adjustments, need to add incrementers for values --- .../subsystems/drivetrain/IDrivetrain.java | 5 +--- .../lib/subsystems/drivetrain/Swerve.java | 30 ++++++++----------- src/main/resources/yaml/ztldr.yml | 19 ++++++------ 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java b/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java index 70aac426..23f00c4c 100644 --- a/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java +++ b/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java @@ -22,11 +22,8 @@ public interface IDrivetrain extends ITestableSubsystem { double maxSpd = (config.kinematics.maxDriveRPS / config.kinematics.driveGearing) * 2 * Math.PI * config.kinematics.wheelRadius; double cof = config.kinematics.wheelCOF; double gearing = config.kinematics.driveGearing; - double wheelCircumference = 2 * Math.PI * whlRad; - // MOI = mass * (width^2 + length^2) / 12, with 1.5x multiplier to account for - // concentrated perimeter mass (swerve modules, bumpers, battery) - double MOI = 1.5 * massKG * (config.kinematics.wheelbaseWidth * config.kinematics.wheelbaseWidth + config.kinematics.wheelbaseLength * config.kinematics.wheelbaseLength) / 12; + double MOI = 1.5; boolean isAllowedToPathPlannerPath = false; diff --git a/src/main/java/com/team1816/lib/subsystems/drivetrain/Swerve.java b/src/main/java/com/team1816/lib/subsystems/drivetrain/Swerve.java index 28d366c3..9d263e08 100644 --- a/src/main/java/com/team1816/lib/subsystems/drivetrain/Swerve.java +++ b/src/main/java/com/team1816/lib/subsystems/drivetrain/Swerve.java @@ -26,9 +26,9 @@ public class Swerve extends SubsystemBase implements ITestableSubsystem { private final IDrivetrain drivetrain; private final CommandXboxController controller; - private final SlewRateLimiter xLimiter = new SlewRateLimiter(3); // forward/back - private final SlewRateLimiter yLimiter = new SlewRateLimiter(3); // strafe - private final SlewRateLimiter rotLimiter = new SlewRateLimiter(6); // rotation + private final SlewRateLimiter xLimiter = new SlewRateLimiter(1); // forward/back + private final SlewRateLimiter yLimiter = new SlewRateLimiter(1); // strafe + private final SlewRateLimiter rotLimiter = new SlewRateLimiter(1); // rotation private static double maxAngularRate = 0; // Blue alliance sees forward as 0 degrees (toward red alliance wall). @@ -78,28 +78,24 @@ public void periodic() { } private SwerveRequest GetSwerverCommand(SwerveRequest.FieldCentric drive) { + double deadBand = 0.05; // 1. Get raw joystick values (-1.0 to +1.0) double rawX = -controller.getLeftY(); // forward/back (negative because forward is usually negative Y) double rawY = -controller.getLeftX(); // strafe left/right double rawRot = -controller.getRightX(); // rotation - // 2. Deadband (remove drift) - rawX = Math.abs(rawX) < 0.08 ? 0 : rawX; - rawY = Math.abs(rawY) < 0.08 ? 0 : rawY; - rawRot = Math.abs(rawRot) < 0.08 ? 0 : rawRot; + // 2. Deadband (remove drift, yet still allow speeds just above 0) + double x = Math.abs(rawX) < deadBand ? 0 : (rawX-deadBand)/(1-deadBand); + double y = Math.abs(rawY) < deadBand ? 0 : (rawY-deadBand)/(1-deadBand); + double rot = Math.abs(rawRot) < deadBand ? 0 : (rawRot-deadBand)/(1-deadBand); - // 3. Cube the inputs → insane precision at low speed, full power at full stick - double x = rawX * rawX * rawX; - double y = rawY * rawY * rawY; - double rot = rawRot * rawRot * rawRot; + // 3. Slew rate limit → buttery smooth acceleration +// x = xLimiter.calculate(x); +// y = yLimiter.calculate(y); +// rot = rotLimiter.calculate(rot); - // 4. Slew rate limit → buttery smooth acceleration - x = xLimiter.calculate(x); - y = yLimiter.calculate(y); - rot = rotLimiter.calculate(rot); - - // 5. Multipliers to slow down movement based on driver preference. Slow mode and normal mode. + // 4. Multipliers to slow down movement based on driver preference. Slow mode and normal mode. if (controller.leftTrigger().getAsBoolean()) { x *= SLOW_MODE_TRANSLATIONAL_MULTIPLIER; y *= SLOW_MODE_TRANSLATIONAL_MULTIPLIER; diff --git a/src/main/resources/yaml/ztldr.yml b/src/main/resources/yaml/ztldr.yml index 73c7c365..32565cd5 100644 --- a/src/main/resources/yaml/ztldr.yml +++ b/src/main/resources/yaml/ztldr.yml @@ -131,23 +131,24 @@ subsystems: kinematics: driveGearing: 6.03 steerGearing: 26.0909 - wheelbaseLength: .505 # meters - wheelbaseWidth: .505 # meters - robotMass: 74.088 # kg + wheelbaseLength: 0.4305 # meters + wheelbaseWidth: 0.4305 # meters + robotMass: 56.7 # kg wheelRadius: .04938 # meters (1.944 in) - maxDriveRPS: 98 # measured motor max speed rps - maxAngularRate: 8.285 # rad/sec - wheelCOF: 1.7 + maxDriveRPS: 80 # measured motor max speed rps + maxAngularRate: 1.3 # rot/sec + wheelCOF: 1 constants: translationKp: 20 translationKd: 0 rotationKp: 10 rotationKi: 0 rotationKd: 0 + #Driver preference options normalModeTranslationalMultiplier: 1 - normalModeRotationalMultiplier: 0.4 - slowModeTranslationalMultiplier: 0.35 - slowModeRotationalMultiplier: 0.15 + normalModeRotationalMultiplier: 1 + slowModeTranslationalMultiplier: 0.5 + slowModeRotationalMultiplier: 1 ledManager: implemented: false devices: From c7c6b71eab61a4d5d4ec068a6188e767efe3eddb Mon Sep 17 00:00:00 2001 From: Ethan <137455719+EndigoSkull@users.noreply.github.com> Date: Thu, 26 Mar 2026 19:04:05 -0500 Subject: [PATCH 3/5] adjusted soft limits on the new inclinemotor --- src/main/resources/yaml/ztldr.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/yaml/ztldr.yml b/src/main/resources/yaml/ztldr.yml index 32565cd5..68033bac 100644 --- a/src/main/resources/yaml/ztldr.yml +++ b/src/main/resources/yaml/ztldr.yml @@ -259,10 +259,10 @@ subsystems: motorType: NEO550_JST remoteSensor: RemoteCANcoder remoteSensorId: 29 - id: -1 + id: 27 motorRotation: Clockwise_Positive - reverseSoftLimit: 0.0405 - forwardSoftLimit: 0.109 + reverseSoftLimit: 0.052 + forwardSoftLimit: 0.1196 statorCurrentLimit: 35 pidConfig: slot0: @@ -296,11 +296,11 @@ subsystems: shooterOffsetYMeters: -0.112268 shooterOffsetZMeters: 0.508 inclineDuckingLimitRotations: 0.052 - distanceOneInclineAngleRotations: 0.0405 + distanceOneInclineAngleRotations: 0.052 distanceOneLaunchVelocityRPS: 35 - distanceTwoInclineAngleRotations: 0.0555 + distanceTwoInclineAngleRotations: 0.08 distanceTwoLaunchVelocityRPS: 47 - distanceThreeInclineAngleRotations: 0.07425 + distanceThreeInclineAngleRotations: 0.1196 distanceThreeLaunchVelocityRPS: 49 distanceAutoThingLaunchVelocityRPS: 60 closeDistanceBetweenBeamBreaks: 0.419 From edd5f37d378418a05e4820c4b6c346f9c2a94a9a Mon Sep 17 00:00:00 2001 From: Ethan <137455719+EndigoSkull@users.noreply.github.com> Date: Thu, 26 Mar 2026 19:25:46 -0500 Subject: [PATCH 4/5] adjusted setpoints for custom distance shooting and removed backspin modifier --- src/main/resources/yaml/ztldr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/yaml/ztldr.yml b/src/main/resources/yaml/ztldr.yml index 68033bac..f878430b 100644 --- a/src/main/resources/yaml/ztldr.yml +++ b/src/main/resources/yaml/ztldr.yml @@ -301,7 +301,7 @@ subsystems: distanceTwoInclineAngleRotations: 0.08 distanceTwoLaunchVelocityRPS: 47 distanceThreeInclineAngleRotations: 0.1196 - distanceThreeLaunchVelocityRPS: 49 + distanceThreeLaunchVelocityRPS: 100 distanceAutoThingLaunchVelocityRPS: 60 closeDistanceBetweenBeamBreaks: 0.419 farDistanceBetweenBeamBreaks: 13.570 @@ -312,7 +312,7 @@ subsystems: launchVelocityAdjustmentAmountRPS: 0.04 inclineAngleAdjustmentAmountDegrees: 0.02 turretAngleAdjustmentAmountDegrees: 0.04 - topLaunchMotorBackspinMultiplier: 0.8 # Less than one for backspin. + topLaunchMotorBackspinMultiplier: 1 # Less than one for backspin. vision: cameras: forwardLeft: # Pi IP: 10.18.16.11 From 36d020b1a73f6b49b731df0e5449de8dcf04ed01 Mon Sep 17 00:00:00 2001 From: Ethan <137455719+EndigoSkull@users.noreply.github.com> Date: Fri, 27 Mar 2026 12:45:52 -0500 Subject: [PATCH 5/5] undid MOI changes --- .../com/team1816/lib/subsystems/drivetrain/IDrivetrain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java b/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java index 23f00c4c..09fdad27 100644 --- a/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java +++ b/src/main/java/com/team1816/lib/subsystems/drivetrain/IDrivetrain.java @@ -23,7 +23,7 @@ public interface IDrivetrain extends ITestableSubsystem { double cof = config.kinematics.wheelCOF; double gearing = config.kinematics.driveGearing; - double MOI = 1.5; + double MOI = 1.5 * massKG * (config.kinematics.wheelbaseWidth * config.kinematics.wheelbaseWidth + config.kinematics.wheelbaseLength * config.kinematics.wheelbaseLength) / 12; boolean isAllowedToPathPlannerPath = false;