From a58ebe1cca49b12f04cb8eae08af4ec2c21ad07d Mon Sep 17 00:00:00 2001 From: WesleyWong-972 Date: Sun, 22 Mar 2026 17:11:51 -0700 Subject: [PATCH] Shooter COSF and Limit Shooter P lowered: Motors dont fight Need to add current limits Lowered drivetrain module limits from 60 to 40 Increased coefficient of static from 0.9 to 1.5 Kousha Auto --- .../deploy/pathplanner/paths/Kousha S1.path | 146 +++++++++++ .../deploy/pathplanner/paths/Kousha S2.path | 235 ++++++++++++++++++ src/main/java/frc/robot/RobotContainer.java | 7 +- .../constants/swerve/DriveConstants.java | 6 +- .../frc/robot/subsystems/shooter/Shooter.java | 6 +- 5 files changed, 393 insertions(+), 7 deletions(-) create mode 100644 src/main/deploy/pathplanner/paths/Kousha S1.path create mode 100644 src/main/deploy/pathplanner/paths/Kousha S2.path diff --git a/src/main/deploy/pathplanner/paths/Kousha S1.path b/src/main/deploy/pathplanner/paths/Kousha S1.path new file mode 100644 index 0000000..e2b0a20 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/Kousha S1.path @@ -0,0 +1,146 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 4.45853476821192, + "y": 7.664966887417217 + }, + "prevControl": null, + "nextControl": { + "x": 5.458534768211921, + "y": 7.664966887417217 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 7.921523178807947, + "y": 6.750215231788079 + }, + "prevControl": { + "x": 7.9078401005687935, + "y": 7.287276052674142 + }, + "nextControl": { + "x": 7.9796026490066865, + "y": 4.4705960264905045 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 6.534875827814634, + "y": 4.819072847682557 + }, + "prevControl": { + "x": 7.224569536423906, + "y": 4.753733443709048 + }, + "nextControl": { + "x": 5.615154835282087, + "y": 4.906204310133009 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 5.213567880794766, + "y": 5.42890728476865 + }, + "prevControl": { + "x": 5.888741721854368, + "y": 5.153029801324941 + }, + "nextControl": { + "x": 4.393659545209185, + "y": 5.7639235939326525 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 3.3, + "y": 5.75 + }, + "prevControl": { + "x": 4.100683433038495, + "y": 5.703196560889764 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [ + { + "waypointRelativePos": 1.002386634844876, + "rotationDegrees": -90.0 + }, + { + "waypointRelativePos": 1.6658711217183793, + "rotationDegrees": -171.29413327946216 + }, + { + "waypointRelativePos": 2.6348448687350827, + "rotationDegrees": 90.0 + } + ], + "constraintZones": [], + "pointTowardsZones": [], + "eventMarkers": [ + { + "name": "Hood Down", + "waypointRelativePos": 0, + "endWaypointRelativePos": null, + "command": null + }, + { + "name": "Extend Intake", + "waypointRelativePos": 0.41695621959694984, + "endWaypointRelativePos": null, + "command": null + }, + { + "name": "Spin Intake Rollers", + "waypointRelativePos": 0.4447533009034007, + "endWaypointRelativePos": null, + "command": null + }, + { + "name": "Start Spindexer", + "waypointRelativePos": 0.9506601806810285, + "endWaypointRelativePos": null, + "command": null + }, + { + "name": "Stop Spindexer", + "waypointRelativePos": 1.2119527449617822, + "endWaypointRelativePos": null, + "command": null + } + ], + "globalConstraints": { + "maxVelocity": 2.0, + "maxAcceleration": 2.0, + "maxAngularVelocity": 200.0, + "maxAngularAcceleration": 300.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": 90.0 + }, + "reversed": false, + "folder": "week 2 autos", + "idealStartingState": { + "velocity": 0, + "rotation": 0.0 + }, + "useDefaultConstraints": true +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/Kousha S2.path b/src/main/deploy/pathplanner/paths/Kousha S2.path new file mode 100644 index 0000000..b00df98 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/Kousha S2.path @@ -0,0 +1,235 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 3.3, + "y": 5.75 + }, + "prevControl": null, + "nextControl": { + "x": 2.9339486754966884, + "y": 5.748344370860926 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 4.088278145695364, + "y": 7.599627483443708 + }, + "prevControl": { + "x": 3.0882889621775207, + "y": 7.59497637096223 + }, + "nextControl": { + "x": 5.649163907284769, + "y": 7.606887417218543 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 5.925041390728477, + "y": 6.677615894039734 + }, + "prevControl": { + "x": 5.927124705977556, + "y": 7.17761155381847 + }, + "nextControl": { + "x": 5.922958075479399, + "y": 6.177620234260998 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 5.801622516552661, + "y": 4.390736754963256 + }, + "prevControl": { + "x": 5.824062934803918, + "y": 5.123790417837672 + }, + "nextControl": { + "x": 5.779842715228158, + "y": 3.6792632450294818 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 6.868832781456953, + "y": 4.811812913907284 + }, + "prevControl": { + "x": 6.9559519867549655, + "y": 3.7155629139072834 + }, + "nextControl": { + "x": 6.78171357615894, + "y": 5.908062913907284 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 5.489445364238411, + "y": 5.552326158940397 + }, + "prevControl": { + "x": 6.081129966887417, + "y": 5.6212955298013245 + }, + "nextControl": { + "x": 4.897760761589405, + "y": 5.483356788079469 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 3.3, + "y": 5.552326158940397 + }, + "prevControl": { + "x": 3.83542011589404, + "y": 5.492431705298013 + }, + "nextControl": { + "x": 2.7645798841059595, + "y": 5.612220612582781 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 3.384064569536424, + "y": 7.505248344370861 + }, + "prevControl": { + "x": 2.9266887417218546, + "y": 7.338269867549668 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [ + { + "waypointRelativePos": 1.1026252983293603, + "rotationDegrees": 0.0 + }, + { + "waypointRelativePos": 2.0095465393794885, + "rotationDegrees": -90.0 + }, + { + "waypointRelativePos": 2.983293556085921, + "rotationDegrees": -75.19021917064742 + }, + { + "waypointRelativePos": 3.326968973747023, + "rotationDegrees": 57.25248324201524 + }, + { + "waypointRelativePos": 3.646778042959423, + "rotationDegrees": 64.7436522905489 + }, + { + "waypointRelativePos": 3.9260143198090636, + "rotationDegrees": 90.0 + }, + { + "waypointRelativePos": 4.853221957040566, + "rotationDegrees": 45.0 + }, + { + "waypointRelativePos": 5.939140811455842, + "rotationDegrees": 45.0 + } + ], + "constraintZones": [ + { + "name": "Constraints Zone", + "minWaypointRelativePos": 0.0, + "maxWaypointRelativePos": 1.0368311327310604, + "constraints": { + "maxVelocity": 1.0, + "maxAcceleration": 2.0, + "maxAngularVelocity": 200.0, + "maxAngularAcceleration": 300.0, + "nominalVoltage": 12.0, + "unlimited": false + } + }, + { + "name": "Constraints Zone", + "minWaypointRelativePos": 5.662265462126515, + "maxWaypointRelativePos": 7.0, + "constraints": { + "maxVelocity": 1.0, + "maxAcceleration": 2.0, + "maxAngularVelocity": 200.0, + "maxAngularAcceleration": 300.0, + "nominalVoltage": 12.0, + "unlimited": false + } + } + ], + "pointTowardsZones": [], + "eventMarkers": [ + { + "name": "Stop Spindexer", + "waypointRelativePos": 0.9631688672689134, + "endWaypointRelativePos": null, + "command": null + }, + { + "name": "Hood Down", + "waypointRelativePos": 1.002084781098009, + "endWaypointRelativePos": null, + "command": null + }, + { + "name": "Stop Hood Down", + "waypointRelativePos": 5.86657400972897, + "endWaypointRelativePos": null, + "command": null + }, + { + "name": "Start Spindexer", + "waypointRelativePos": 5.944405837387076, + "endWaypointRelativePos": null, + "command": null + } + ], + "globalConstraints": { + "maxVelocity": 2.0, + "maxAcceleration": 2.0, + "maxAngularVelocity": 200.0, + "maxAngularAcceleration": 300.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": 1.8279682443049239 + }, + "reversed": false, + "folder": "week 2 autos", + "idealStartingState": { + "velocity": 0, + "rotation": 90.0 + }, + "useDefaultConstraints": true +} \ No newline at end of file diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 87b6ee0..7d351b5 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -137,13 +137,14 @@ public class RobotContainer { PathGroupLoader.loadPathGroups(); // Load the auto command try { - String leftSideAuto = "Right Week V1"; + String koushaAuto = "Kousha Double"; + //String leftSideAuto = "Right Week V1"; // String leftSideAuto = "Right Week V1"; // String leftSideAuto = "Right Week V1"; // String rightSideAuto = "Right(2) - Under Trench"; // String testing = "Straight Test"; - PathPlannerAuto.getPathGroupFromAutoFile(leftSideAuto); - auto = new PathPlannerAuto(leftSideAuto); + PathPlannerAuto.getPathGroupFromAutoFile(koushaAuto); + auto = new PathPlannerAuto(koushaAuto); } catch (IOException | ParseException e) { e.printStackTrace(); } diff --git a/src/main/java/frc/robot/constants/swerve/DriveConstants.java b/src/main/java/frc/robot/constants/swerve/DriveConstants.java index 5cb0da5..f39931f 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 = 0.9; + public static final double COSF = 1.5; // The maximum acceleration of the robot, limited by friction public static final double MAX_LINEAR_ACCEL = COSF * Constants.GRAVITY_ACCELERATION; @@ -129,8 +129,8 @@ public class DriveConstants { public static final double STEER_PEAK_CURRENT_DURATION = 0.01; public static final boolean STEER_ENABLE_CURRENT_LIMIT = true; - public static final int DRIVE_CONTINUOUS_CURRENT_LIMIT = 60; - public static final int DRIVE_PEAK_CURRENT_LIMIT = 60; + public static final int DRIVE_CONTINUOUS_CURRENT_LIMIT = 40; + public static final int DRIVE_PEAK_CURRENT_LIMIT = 40; public static final double DRIVE_PEAK_CURRENT_DURATION = 0.01; public static final boolean DRIVE_ENABLE_CURRENT_LIMIT = true; diff --git a/src/main/java/frc/robot/subsystems/shooter/Shooter.java b/src/main/java/frc/robot/subsystems/shooter/Shooter.java index 5e751e2..024c11f 100644 --- a/src/main/java/frc/robot/subsystems/shooter/Shooter.java +++ b/src/main/java/frc/robot/subsystems/shooter/Shooter.java @@ -23,6 +23,10 @@ public class Shooter extends SubsystemBase implements ShooterIO { private TalonFX shooterMotorLeft = new TalonFX(IdConstants.SHOOTER_LEFT_ID, Constants.CANIVORE_SUB); private TalonFX shooterMotorRight = new TalonFX(IdConstants.SHOOTER_RIGHT_ID, Constants.CANIVORE_SUB); + + //TODO Add current limits + + // Goal Velocity / Double theCircumfrence private double shooterTargetSpeed = 0; @@ -38,7 +42,7 @@ public class Shooter extends SubsystemBase implements ShooterIO { updateInputs(); TalonFXConfiguration config = new TalonFXConfiguration(); - config.Slot0.kP = 1.0; //tune p value + config.Slot0.kP = 0.5; // 0.5 Stable config.Slot0.kI = 0; config.Slot0.kD = 0.0; config.Slot0.kV = 0.125; //Maximum rps = 100 --> 12V/100rps -- 2.39.5