From 960f98e87f361ed976c3b227b98d3c033d656e33 Mon Sep 17 00:00:00 2001 From: QuackitsQuinn Date: Tue, 13 Feb 2024 15:06:34 -0600 Subject: [PATCH 01/38] Add intake motor id, add fl and fr drive ids probably works --- src/main/deploy/swerve/modules/frontleft.json | 4 ++-- src/main/deploy/swerve/modules/frontright.json | 2 +- src/main/java/frc/robot/Constants.java | 2 +- src/main/java/frc/robot/RobotContainer.java | 1 + src/test/BaseTest.java | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/deploy/swerve/modules/frontleft.json b/src/main/deploy/swerve/modules/frontleft.json index eb6d146c..ce3fcde2 100644 --- a/src/main/deploy/swerve/modules/frontleft.json +++ b/src/main/deploy/swerve/modules/frontleft.json @@ -6,12 +6,12 @@ "absoluteEncoderOffset": 140.6, "drive": { "type": "sparkmax", - "id": 3, + "id": 5, "canbus": null }, "angle": { "type": "sparkmax", - "id": 4, + "id": 6, "canbus": null }, "conversionFactor": { diff --git a/src/main/deploy/swerve/modules/frontright.json b/src/main/deploy/swerve/modules/frontright.json index 700ce186..980757ee 100644 --- a/src/main/deploy/swerve/modules/frontright.json +++ b/src/main/deploy/swerve/modules/frontright.json @@ -6,7 +6,7 @@ "absoluteEncoderOffset": 5.5, "drive": { "type": "sparkmax", - "id": 1, + "id": 4, "canbus": null }, "angle": { diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 8072037a..2805266e 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -75,7 +75,7 @@ public static class Drive { /** Constants for the Intake System */ public static class Intake { /** Motor id of the Intake motor. */ - public static final int INTAKE_MOTOR_ID = 0; + public static final int INTAKE_MOTOR_ID = 2; // It was me, DIO! /** DIO Port ID for the Intake limit switch. */ diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 3e30d48a..1036497c 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -82,6 +82,7 @@ public class RobotContainer { private DriveFieldOriented driveFieldOriented = new DriveFieldOriented(); private EnterXMode enterXMode = new EnterXMode(); private DeployPneumatics deployPneumatics = new DeployPneumatics(); + private RunBelts runBelts = new RunBelts(); private DeployMailbox deployMailbox = new DeployMailbox(); private DeindexNote deindexNote = new DeindexNote(); diff --git a/src/test/BaseTest.java b/src/test/BaseTest.java index 1c470c31..99dec433 100644 --- a/src/test/BaseTest.java +++ b/src/test/BaseTest.java @@ -15,7 +15,7 @@ public class BaseTests { /* HEY! If your test is failing, don't comment this out! Your code won't work on the robot. So fix it! /lh /nm */ @Test - public void TestAutoTasks() { + public void testAutoTasks() { new RobotContainer(); } } \ No newline at end of file From d467d924acb0b83a4747d73d3f5b2fcb8709eef8 Mon Sep 17 00:00:00 2001 From: QuackitsQuinn Date: Tue, 13 Feb 2024 15:17:33 -0600 Subject: [PATCH 02/38] fix ids and add more --- src/main/deploy/swerve/modules/backleft.json | 4 ++-- src/main/deploy/swerve/modules/backright.json | 4 ++-- src/main/deploy/swerve/modules/frontleft.json | 4 ++-- src/main/deploy/swerve/modules/frontright.json | 4 ++-- src/main/java/frc/robot/Constants.java | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/deploy/swerve/modules/backleft.json b/src/main/deploy/swerve/modules/backleft.json index cdd61e73..d7057a16 100644 --- a/src/main/deploy/swerve/modules/backleft.json +++ b/src/main/deploy/swerve/modules/backleft.json @@ -6,12 +6,12 @@ "absoluteEncoderOffset": 211.0, "drive": { "type": "sparkmax", - "id": 5, + "id": 8, "canbus": null }, "angle": { "type": "sparkmax", - "id": 6, + "id": 4, "canbus": null }, "conversionFactor": { diff --git a/src/main/deploy/swerve/modules/backright.json b/src/main/deploy/swerve/modules/backright.json index 9d808f46..a8e0f267 100644 --- a/src/main/deploy/swerve/modules/backright.json +++ b/src/main/deploy/swerve/modules/backright.json @@ -6,12 +6,12 @@ "absoluteEncoderOffset": 31.9, "drive": { "type": "sparkmax", - "id": 7, + "id": 5, "canbus": null }, "angle": { "type": "sparkmax", - "id": 8, + "id": 6, "canbus": null }, "conversionFactor": { diff --git a/src/main/deploy/swerve/modules/frontleft.json b/src/main/deploy/swerve/modules/frontleft.json index ce3fcde2..588f4ace 100644 --- a/src/main/deploy/swerve/modules/frontleft.json +++ b/src/main/deploy/swerve/modules/frontleft.json @@ -6,12 +6,12 @@ "absoluteEncoderOffset": 140.6, "drive": { "type": "sparkmax", - "id": 5, + "id": 10, "canbus": null }, "angle": { "type": "sparkmax", - "id": 6, + "id": 9, "canbus": null }, "conversionFactor": { diff --git a/src/main/deploy/swerve/modules/frontright.json b/src/main/deploy/swerve/modules/frontright.json index 980757ee..906b0f7e 100644 --- a/src/main/deploy/swerve/modules/frontright.json +++ b/src/main/deploy/swerve/modules/frontright.json @@ -6,12 +6,12 @@ "absoluteEncoderOffset": 5.5, "drive": { "type": "sparkmax", - "id": 4, + "id": 3, "canbus": null }, "angle": { "type": "sparkmax", - "id": 2, + "id": 7, "canbus": null }, "conversionFactor": { diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 2805266e..4c79455e 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -48,7 +48,7 @@ public static class MailboxPneumatics { /** Constants for the Belts system. */ public static class MailboxBelts { /** The channel on the PCM for the belt motor */ - public static final int BELT_MOTOR_ID = 0; + public static final int BELT_MOTOR_ID = 3; /** The speed for the belt motor. */ public static final double BELT_MOTOR_SPEED = 1; @@ -75,7 +75,7 @@ public static class Drive { /** Constants for the Intake System */ public static class Intake { /** Motor id of the Intake motor. */ - public static final int INTAKE_MOTOR_ID = 2; + public static final int INTAKE_MOTOR_ID = 1; // It was me, DIO! /** DIO Port ID for the Intake limit switch. */ From 52607cbef6c607fa88aa85cf41b20738528de9ef Mon Sep 17 00:00:00 2001 From: QuackitsQuinn Date: Wed, 14 Feb 2024 17:35:59 -0600 Subject: [PATCH 03/38] add the rest of the drivetrain numbers --- src/main/deploy/swerve/modules/backleft.json | 2 +- src/main/deploy/swerve/modules/frontright.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/deploy/swerve/modules/backleft.json b/src/main/deploy/swerve/modules/backleft.json index d7057a16..1d9f7bb5 100644 --- a/src/main/deploy/swerve/modules/backleft.json +++ b/src/main/deploy/swerve/modules/backleft.json @@ -20,7 +20,7 @@ }, "encoder": { "type": "thrifty", - "id": 2, + "id": 1, "canbus": null }, "inverted": { diff --git a/src/main/deploy/swerve/modules/frontright.json b/src/main/deploy/swerve/modules/frontright.json index 906b0f7e..97e1c038 100644 --- a/src/main/deploy/swerve/modules/frontright.json +++ b/src/main/deploy/swerve/modules/frontright.json @@ -20,7 +20,7 @@ }, "encoder": { "type": "thrifty", - "id": 1, + "id": 2, "canbus": null }, "inverted": { From f0855a23b10296f4435d161822dd9b09b3762918 Mon Sep 17 00:00:00 2001 From: QuackitsQuinn Date: Thu, 15 Feb 2024 19:41:44 -0600 Subject: [PATCH 04/38] more numbers and a quick fix that i dont have time to unfix --- src/main/deploy/swerve/modules/backleft.json | 4 ++-- src/main/deploy/swerve/modules/backright.json | 4 ++-- src/main/deploy/swerve/modules/frontleft.json | 4 ++-- src/main/deploy/swerve/modules/frontright.json | 4 ++-- src/main/java/frc/robot/Constants.java | 6 +++--- src/main/java/frc/robot/RobotContainer.java | 2 +- src/main/java/frc/robot/commands/RunIntake.java | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/deploy/swerve/modules/backleft.json b/src/main/deploy/swerve/modules/backleft.json index 1d9f7bb5..93db69fc 100644 --- a/src/main/deploy/swerve/modules/backleft.json +++ b/src/main/deploy/swerve/modules/backleft.json @@ -1,7 +1,7 @@ { "location": { - "front": -12, - "left": 9 + "front": -10.875, + "left": 10 }, "absoluteEncoderOffset": 211.0, "drive": { diff --git a/src/main/deploy/swerve/modules/backright.json b/src/main/deploy/swerve/modules/backright.json index a8e0f267..bd58a7e5 100644 --- a/src/main/deploy/swerve/modules/backright.json +++ b/src/main/deploy/swerve/modules/backright.json @@ -1,7 +1,7 @@ { "location": { - "front": -12, - "left": -9 + "front": -10.875, + "left": -10 }, "absoluteEncoderOffset": 31.9, "drive": { diff --git a/src/main/deploy/swerve/modules/frontleft.json b/src/main/deploy/swerve/modules/frontleft.json index 588f4ace..c93fae48 100644 --- a/src/main/deploy/swerve/modules/frontleft.json +++ b/src/main/deploy/swerve/modules/frontleft.json @@ -1,7 +1,7 @@ { "location": { - "front": 12, - "left": 9 + "front": 10.875, + "left": 10 }, "absoluteEncoderOffset": 140.6, "drive": { diff --git a/src/main/deploy/swerve/modules/frontright.json b/src/main/deploy/swerve/modules/frontright.json index 97e1c038..854ac38a 100644 --- a/src/main/deploy/swerve/modules/frontright.json +++ b/src/main/deploy/swerve/modules/frontright.json @@ -1,7 +1,7 @@ { "location": { - "front": 12, - "left": -9 + "front": 10.875, + "left": -10 }, "absoluteEncoderOffset": 5.5, "drive": { diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 5d64ef42..dec4213b 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -28,7 +28,7 @@ public final class Constants { public static class Mailbox { // It was me, DIO! /** DIO Port ID for the Mailbox limit switch. */ - public static final int MAILBOX_LIMIT_SWITCH_DIO_PORT = 0; + public static final int MAILBOX_LIMIT_SWITCH_DIO_PORT = 4; } /** Constants for the Pneumatics system. */ @@ -49,7 +49,7 @@ public static class MailboxPneumatics { /** Constants for the Belts system. */ public static class MailboxBelts { /** The channel on the PCM for the belt motor */ - public static final int BELT_MOTOR_ID = 3; + public static final int BELT_MOTOR_ID = 2; /** The speed for the belt motor. */ public static final double BELT_MOTOR_SPEED = 1; @@ -98,7 +98,7 @@ public static class Intake { public static final int INTAKE_LIMIT_SWITCH_DIO_PORT = 0; /** Speed we want to run the Intake at. */ - public static final double INTAKE_MOTOR_SPEED = 1; + public static final double INTAKE_MOTOR_SPEED = -1; } /** Holds contstants for the Limelights. */ diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 33fcc6d8..6b5dc03d 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -151,7 +151,7 @@ private void configureBindings() { driverController.x().onTrue(enterXMode); driverController.y().whileTrue(fireNote); driverController.a().whileTrue(runIntake); - driverController.rightTrigger().whileTrue(deployMailbox); + // driverController.rightTrigger().whileTrue(deployMailbox); driverController.b().whileTrue(runBelts); } diff --git a/src/main/java/frc/robot/commands/RunIntake.java b/src/main/java/frc/robot/commands/RunIntake.java index 6dff66b8..527e6a99 100644 --- a/src/main/java/frc/robot/commands/RunIntake.java +++ b/src/main/java/frc/robot/commands/RunIntake.java @@ -45,6 +45,6 @@ public void end(boolean interrupted) { // Returns true when the command should end. @Override public boolean isFinished() { - return intake.getLimitSwitch(); + return false; // intake.getLimitSwitch(); } } From f1bb4a91f72998da02d13dcf4ad932334a1e879f Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:03:46 -0600 Subject: [PATCH 05/38] set encoder offsets --- src/main/deploy/swerve/modules/backleft.json | 2 +- src/main/deploy/swerve/modules/backright.json | 2 +- src/main/deploy/swerve/modules/frontleft.json | 2 +- src/main/deploy/swerve/modules/frontright.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/deploy/swerve/modules/backleft.json b/src/main/deploy/swerve/modules/backleft.json index 93db69fc..03c52f9c 100644 --- a/src/main/deploy/swerve/modules/backleft.json +++ b/src/main/deploy/swerve/modules/backleft.json @@ -3,7 +3,7 @@ "front": -10.875, "left": 10 }, - "absoluteEncoderOffset": 211.0, + "absoluteEncoderOffset": 27.7, "drive": { "type": "sparkmax", "id": 8, diff --git a/src/main/deploy/swerve/modules/backright.json b/src/main/deploy/swerve/modules/backright.json index bd58a7e5..5569881d 100644 --- a/src/main/deploy/swerve/modules/backright.json +++ b/src/main/deploy/swerve/modules/backright.json @@ -3,7 +3,7 @@ "front": -10.875, "left": -10 }, - "absoluteEncoderOffset": 31.9, + "absoluteEncoderOffset": 0.95, "drive": { "type": "sparkmax", "id": 5, diff --git a/src/main/deploy/swerve/modules/frontleft.json b/src/main/deploy/swerve/modules/frontleft.json index c93fae48..0bcb1456 100644 --- a/src/main/deploy/swerve/modules/frontleft.json +++ b/src/main/deploy/swerve/modules/frontleft.json @@ -3,7 +3,7 @@ "front": 10.875, "left": 10 }, - "absoluteEncoderOffset": 140.6, + "absoluteEncoderOffset": 300.9, "drive": { "type": "sparkmax", "id": 10, diff --git a/src/main/deploy/swerve/modules/frontright.json b/src/main/deploy/swerve/modules/frontright.json index 854ac38a..ced375a2 100644 --- a/src/main/deploy/swerve/modules/frontright.json +++ b/src/main/deploy/swerve/modules/frontright.json @@ -3,7 +3,7 @@ "front": 10.875, "left": -10 }, - "absoluteEncoderOffset": 5.5, + "absoluteEncoderOffset": 12.75, "drive": { "type": "sparkmax", "id": 3, From 9f57fae2704f94859bcfc55901e9d5cd5c25e6d4 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Sat, 17 Feb 2024 11:43:39 -0600 Subject: [PATCH 06/38] set encoder offsets --- src/main/deploy/swerve/modules/backleft.json | 2 +- src/main/deploy/swerve/modules/backright.json | 2 +- src/main/deploy/swerve/modules/frontleft.json | 2 +- src/main/deploy/swerve/modules/frontright.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/deploy/swerve/modules/backleft.json b/src/main/deploy/swerve/modules/backleft.json index 03c52f9c..b2500100 100644 --- a/src/main/deploy/swerve/modules/backleft.json +++ b/src/main/deploy/swerve/modules/backleft.json @@ -3,7 +3,7 @@ "front": -10.875, "left": 10 }, - "absoluteEncoderOffset": 27.7, + "absoluteEncoderOffset": 54.5, "drive": { "type": "sparkmax", "id": 8, diff --git a/src/main/deploy/swerve/modules/backright.json b/src/main/deploy/swerve/modules/backright.json index 5569881d..88b1c4cd 100644 --- a/src/main/deploy/swerve/modules/backright.json +++ b/src/main/deploy/swerve/modules/backright.json @@ -3,7 +3,7 @@ "front": -10.875, "left": -10 }, - "absoluteEncoderOffset": 0.95, + "absoluteEncoderOffset": 214.9, "drive": { "type": "sparkmax", "id": 5, diff --git a/src/main/deploy/swerve/modules/frontleft.json b/src/main/deploy/swerve/modules/frontleft.json index 0bcb1456..e4f3de80 100644 --- a/src/main/deploy/swerve/modules/frontleft.json +++ b/src/main/deploy/swerve/modules/frontleft.json @@ -3,7 +3,7 @@ "front": 10.875, "left": 10 }, - "absoluteEncoderOffset": 300.9, + "absoluteEncoderOffset": 260.5, "drive": { "type": "sparkmax", "id": 10, diff --git a/src/main/deploy/swerve/modules/frontright.json b/src/main/deploy/swerve/modules/frontright.json index ced375a2..35384fa5 100644 --- a/src/main/deploy/swerve/modules/frontright.json +++ b/src/main/deploy/swerve/modules/frontright.json @@ -3,7 +3,7 @@ "front": 10.875, "left": -10 }, - "absoluteEncoderOffset": 12.75, + "absoluteEncoderOffset": 1.5, "drive": { "type": "sparkmax", "id": 3, From 02d93bfff2f0eb93eca9d547ef16dd5e1cd60b10 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Sat, 17 Feb 2024 11:43:50 -0600 Subject: [PATCH 07/38] fix FL sparkmax ids --- src/main/deploy/swerve/modules/frontleft.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/deploy/swerve/modules/frontleft.json b/src/main/deploy/swerve/modules/frontleft.json index e4f3de80..cfb2d2ed 100644 --- a/src/main/deploy/swerve/modules/frontleft.json +++ b/src/main/deploy/swerve/modules/frontleft.json @@ -6,12 +6,12 @@ "absoluteEncoderOffset": 260.5, "drive": { "type": "sparkmax", - "id": 10, + "id": 9, "canbus": null }, "angle": { "type": "sparkmax", - "id": 9, + "id": 10, "canbus": null }, "conversionFactor": { From 325a10acdc9fa59d0db2780d07cdad315c6fd7d6 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Sat, 17 Feb 2024 11:43:59 -0600 Subject: [PATCH 08/38] flip intake motor speed sign --- src/main/java/frc/robot/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index dec4213b..711e2df1 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -98,7 +98,7 @@ public static class Intake { public static final int INTAKE_LIMIT_SWITCH_DIO_PORT = 0; /** Speed we want to run the Intake at. */ - public static final double INTAKE_MOTOR_SPEED = -1; + public static final double INTAKE_MOTOR_SPEED = 1; } /** Holds contstants for the Limelights. */ From 13959b794cd9daeb048297bfb95804427eb932bb Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Sat, 17 Feb 2024 11:44:10 -0600 Subject: [PATCH 09/38] make controller axes front-left positive --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 6b5dc03d..af60df74 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -166,7 +166,7 @@ public Command getAutonomousCommand() { private static double scaleAxis(double axis) { double deadbanded = MathUtil.applyDeadband(axis, 0.1); - return Math.pow(deadbanded, 3); + return -1 * Math.pow(deadbanded, 3); } /** From 4c8bef985c3e9da2515fa991fbc0f95ae6c07fb6 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Sat, 17 Feb 2024 11:49:39 -0600 Subject: [PATCH 10/38] set current limits --- src/main/java/frc/robot/Constants.java | 4 ++++ src/main/java/frc/robot/subsystems/Intake.java | 2 ++ src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 711e2df1..ffe8738b 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -53,6 +53,8 @@ public static class MailboxBelts { /** The speed for the belt motor. */ public static final double BELT_MOTOR_SPEED = 1; + + public static final int BLET_MOTOR_CURRENT_LIMIT = 30; } /** Constants that are relating to the controllers. */ @@ -99,6 +101,8 @@ public static class Intake { /** Speed we want to run the Intake at. */ public static final double INTAKE_MOTOR_SPEED = 1; + + public static final int INTAKE_MOTOR_CURRENT_LIMIT = 40; } /** Holds contstants for the Limelights. */ diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index 970da0e8..1ea07a78 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -27,6 +27,8 @@ public class Intake extends SubsystemBase { public Intake() { this.intake = new CANSparkMax(Constants.Intake.INTAKE_MOTOR_ID, MotorType.kBrushless); this.limitSwitch = new DigitalInput(Constants.Intake.INTAKE_LIMIT_SWITCH_DIO_PORT); + + intake.setSmartCurrentLimit(Constants.Intake.INTAKE_MOTOR_CURRENT_LIMIT); } /** Runs the intake motors. */ diff --git a/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java b/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java index ee5906ef..7e061c3d 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java +++ b/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java @@ -23,6 +23,8 @@ public class MailboxBelts extends SubsystemBase { /** Constructer for MailboxBelts subsystem */ public MailboxBelts() { beltMotor = new CANSparkMax(Constants.MailboxBelts.BELT_MOTOR_ID, MotorType.kBrushless); + + beltMotor.setSmartCurrentLimit(Constants.MailboxBelts.BLET_MOTOR_CURRENT_LIMIT); } /** Runs the belt. */ From f6cf9c51be74a042f334112fdc89f0bc69d00628 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Sat, 17 Feb 2024 11:58:08 -0600 Subject: [PATCH 11/38] fix BELT_MOTOR_CURRENT_LIMIT spelling --- src/main/java/frc/robot/Constants.java | 2 +- src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index ffe8738b..a0b914c4 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -54,7 +54,7 @@ public static class MailboxBelts { /** The speed for the belt motor. */ public static final double BELT_MOTOR_SPEED = 1; - public static final int BLET_MOTOR_CURRENT_LIMIT = 30; + public static final int BELT_MOTOR_CURRENT_LIMIT = 30; } /** Constants that are relating to the controllers. */ diff --git a/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java b/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java index 7e061c3d..b91b1139 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java +++ b/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java @@ -24,7 +24,7 @@ public class MailboxBelts extends SubsystemBase { public MailboxBelts() { beltMotor = new CANSparkMax(Constants.MailboxBelts.BELT_MOTOR_ID, MotorType.kBrushless); - beltMotor.setSmartCurrentLimit(Constants.MailboxBelts.BLET_MOTOR_CURRENT_LIMIT); + beltMotor.setSmartCurrentLimit(Constants.MailboxBelts.BELT_MOTOR_CURRENT_LIMIT); } /** Runs the belt. */ From fdc4a5d32f291d652945d2bbf2cc6cfc8a9c2ef4 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Sat, 17 Feb 2024 11:58:59 -0600 Subject: [PATCH 12/38] JavaDoc current limits --- src/main/java/frc/robot/Constants.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index a0b914c4..8e6fcb71 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -54,6 +54,7 @@ public static class MailboxBelts { /** The speed for the belt motor. */ public static final double BELT_MOTOR_SPEED = 1; + /** Current limit (in amps) for the belt motor(s) */ public static final int BELT_MOTOR_CURRENT_LIMIT = 30; } @@ -102,6 +103,7 @@ public static class Intake { /** Speed we want to run the Intake at. */ public static final double INTAKE_MOTOR_SPEED = 1; + /** Current limit (in amps) for the intake motor(s) */ public static final int INTAKE_MOTOR_CURRENT_LIMIT = 40; } From 8a5089f50e9538f001ca0d980df9f89d28bcf434 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:35:04 -0600 Subject: [PATCH 13/38] add back intake current limit --- src/main/java/frc/robot/subsystems/Intake.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index 0a046ed0..b5dc4c1c 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -32,6 +32,8 @@ public Intake() { new CANSparkMax(Constants.Intake.UPPER_INTAKE_MOTOR_ID, MotorType.kBrushless); this.limitSwitch = new DigitalInput(Constants.Intake.INTAKE_LIMIT_SWITCH_DIO_PORT); + intakeLower.setSmartCurrentLimit(Constants.Intake.INTAKE_MOTOR_CURRENT_LIMIT); + intakeLower.follow(intakeUpper, Constants.Intake.INTAKE_FOLLOWER_INVERSE_STATE); intakeUpper.setInverted(Constants.Intake.UPPER_INTAKE_MOTOR_INVERTED); } From f99286e7db08111b1af94be517b7223e330184e5 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:52:08 -0600 Subject: [PATCH 14/38] solenoid channels --- src/main/java/frc/robot/Constants.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 727bff21..5aa6eb3e 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -34,16 +34,16 @@ public static class Mailbox { /** Constants for the Pneumatics system. */ public static class MailboxPneumatics { /** The channel on the PCM for the forward direction on the left solenoid. */ - public static final int LEFT_SOLENOID_FORWARD_CHANNEL = 0; + public static final int LEFT_SOLENOID_FORWARD_CHANNEL = 5; /** The channel on the PCM for the reverse direction on the left solenoid. */ - public static final int LEFT_SOLENOID_REVERSE_CHANNEL = 1; + public static final int LEFT_SOLENOID_REVERSE_CHANNEL = 4; /** The channel on the PCM for the forward direction on the right solenoid. */ - public static final int RIGHT_SOLENOID_FORWARD_CHANNEL = 2; + public static final int RIGHT_SOLENOID_FORWARD_CHANNEL = 7; /** The channel on the PCM for the reverse direction on the right solenoid. */ - public static final int RIGHT_SOLENOID_REVERSE_CHANNEL = 3; + public static final int RIGHT_SOLENOID_REVERSE_CHANNEL = 6; } /** Constants for the Belts system. */ From 2910cceca7482faec8ddb47a26001e814ad97084 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:54:25 -0600 Subject: [PATCH 15/38] belt motor ids --- src/main/java/frc/robot/Constants.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 5aa6eb3e..a1679355 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -49,10 +49,10 @@ public static class MailboxPneumatics { /** Constants for the Belts system. */ public static class MailboxBelts { /** The CAN ID for the upper belt motor */ - public static final int UPPER_BELT_MOTOR_ID = 0; + public static final int UPPER_BELT_MOTOR_ID = 2; /** The CAN ID for the lower belt motor */ - public static final int LOWER_BELT_MOTOR_ID = 0; + public static final int LOWER_BELT_MOTOR_ID = 1; /** The speed for the belt motors. */ public static final double BELT_MOTOR_SPEED = 1; @@ -135,7 +135,7 @@ public static class Intake { /** Inversion state for the intake follower motor. */ public static final boolean INTAKE_FOLLOWER_INVERSE_STATE = false; - + /** Current limit (in amps) for the intake motor(s) */ public static final int INTAKE_MOTOR_CURRENT_LIMIT = 40; } From a416afb259b9eedcc54b860dd0f71486c6e076f7 Mon Sep 17 00:00:00 2001 From: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> Date: Sat, 24 Feb 2024 11:50:10 -0600 Subject: [PATCH 16/38] temp fix for brushed mailbox belt motors --- src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java b/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java index aa7b0577..fafc1c8c 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java +++ b/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java @@ -24,9 +24,9 @@ public class MailboxBelts extends SubsystemBase { /** Constructer for MailboxBelts subsystem */ public MailboxBelts() { upperBeltMotor = - new CANSparkMax(Constants.MailboxBelts.UPPER_BELT_MOTOR_ID, MotorType.kBrushless); + new CANSparkMax(Constants.MailboxBelts.UPPER_BELT_MOTOR_ID, MotorType.kBrushed); lowerBeltMotor = - new CANSparkMax(Constants.MailboxBelts.LOWER_BELT_MOTOR_ID, MotorType.kBrushless); + new CANSparkMax(Constants.MailboxBelts.LOWER_BELT_MOTOR_ID, MotorType.kBrushed); lowerBeltMotor.follow(upperBeltMotor, Constants.MailboxBelts.BELTS_FOLLOWER_INVERSE_STATE); upperBeltMotor.setInverted(Constants.MailboxBelts.UPPER_BELT_MOTOR_INVERTED); From 6fc7302c312fb0ce3998ee56f1619de182b0d221 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:54:27 -0600 Subject: [PATCH 17/38] set mailbox limit switch DIO port num also updated intake limit switch port to avoid conflicts --- src/main/java/frc/robot/Constants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index e8095714..d1b4fca9 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -28,7 +28,7 @@ public final class Constants { public static class Mailbox { // It was me, DIO! /** DIO Port ID for the Mailbox limit switch. */ - public static final int MAILBOX_LIMIT_SWITCH_DIO_PORT = 4; + public static final int MAILBOX_LIMIT_SWITCH_DIO_PORT = 0; } /** Constants for the Pneumatics system. */ @@ -128,7 +128,7 @@ public static class Intake { // It was me, DIO! /** DIO Port ID for the Intake limit switch. */ - public static final int INTAKE_LIMIT_SWITCH_DIO_PORT = 0; + public static final int INTAKE_LIMIT_SWITCH_DIO_PORT = 1; /** Speed we want to run the Intake at. */ public static final double INTAKE_MOTOR_SPEED = 1; From 04de95c593c34d199a9610b467da2bef3e3091fb Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Mon, 26 Feb 2024 16:21:39 -0600 Subject: [PATCH 18/38] intake and belt IDs --- src/main/java/frc/robot/Constants.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index d1b4fca9..92bcc00b 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -49,10 +49,10 @@ public static class MailboxPneumatics { /** Constants for the Belts system. */ public static class MailboxBelts { /** The CAN ID for the upper belt motor */ - public static final int UPPER_BELT_MOTOR_ID = 2; + public static final int UPPER_BELT_MOTOR_ID = 11; /** The CAN ID for the lower belt motor */ - public static final int LOWER_BELT_MOTOR_ID = 1; + public static final int LOWER_BELT_MOTOR_ID = 12; /** The speed for the belt motors. */ public static final double BELT_MOTOR_SPEED = 1; @@ -118,10 +118,10 @@ public static class Auto { /** Constants for the Intake System */ public static class Intake { /** Motor id of the Lower Intake motor. */ - public static final int LOWER_INTAKE_MOTOR_ID = 0; + public static final int LOWER_INTAKE_MOTOR_ID = 1; /** Motor id of the Upper Intake motor. */ - public static final int UPPER_INTAKE_MOTOR_ID = 0; + public static final int UPPER_INTAKE_MOTOR_ID = 2; /** Inversion state of the upper intake motor. */ public static final boolean UPPER_INTAKE_MOTOR_INVERTED = false; From ebdbe3743e54f723003ef895c9401ce79965054a Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Mon, 26 Feb 2024 16:58:56 -0600 Subject: [PATCH 19/38] set current limit for upper intake motor --- src/main/java/frc/robot/subsystems/Intake.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index b5dc4c1c..c8df7b47 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -33,6 +33,7 @@ public Intake() { this.limitSwitch = new DigitalInput(Constants.Intake.INTAKE_LIMIT_SWITCH_DIO_PORT); intakeLower.setSmartCurrentLimit(Constants.Intake.INTAKE_MOTOR_CURRENT_LIMIT); + intakeUpper.setSmartCurrentLimit(Constants.Intake.INTAKE_MOTOR_CURRENT_LIMIT); intakeLower.follow(intakeUpper, Constants.Intake.INTAKE_FOLLOWER_INVERSE_STATE); intakeUpper.setInverted(Constants.Intake.UPPER_INTAKE_MOTOR_INVERTED); From a5e7c8bec2265b95eb3cd1a3e246bab6a7ee01b4 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Mon, 26 Feb 2024 16:59:05 -0600 Subject: [PATCH 20/38] actually return the limit switch state --- src/main/java/frc/robot/commands/RunIntake.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/commands/RunIntake.java b/src/main/java/frc/robot/commands/RunIntake.java index 527e6a99..6dff66b8 100644 --- a/src/main/java/frc/robot/commands/RunIntake.java +++ b/src/main/java/frc/robot/commands/RunIntake.java @@ -45,6 +45,6 @@ public void end(boolean interrupted) { // Returns true when the command should end. @Override public boolean isFinished() { - return false; // intake.getLimitSwitch(); + return intake.getLimitSwitch(); } } From d8e9df0b06f4c82b68ae397b8b4b6fb5501ee241 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:08:06 -0600 Subject: [PATCH 21/38] =?UTF-8?q?LS=20needed=20to=20be=20inverted=20to=20w?= =?UTF-8?q?ork=20=F0=9F=A4=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/frc/robot/subsystems/Intake.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index c8df7b47..4bbfe96a 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -51,7 +51,7 @@ public void runIntake() { */ public boolean getLimitSwitch() { /* Assumes the limit switch is wired to be normally open. */ - return limitSwitch.get(); + return !limitSwitch.get(); } /** Stops the intake motors. */ From 1f649fb8b8f3881612f64dc9740fc3f181b2aa55 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:08:20 -0600 Subject: [PATCH 22/38] Brake intake motor controllers --- src/main/java/frc/robot/subsystems/Intake.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index 4bbfe96a..979d7f04 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -11,6 +11,7 @@ package frc.robot.subsystems; +import com.revrobotics.CANSparkBase.IdleMode; import com.revrobotics.CANSparkLowLevel.MotorType; import com.revrobotics.CANSparkMax; import edu.wpi.first.wpilibj.DigitalInput; @@ -35,6 +36,9 @@ public Intake() { intakeLower.setSmartCurrentLimit(Constants.Intake.INTAKE_MOTOR_CURRENT_LIMIT); intakeUpper.setSmartCurrentLimit(Constants.Intake.INTAKE_MOTOR_CURRENT_LIMIT); + intakeLower.setIdleMode(IdleMode.kBrake); + intakeUpper.setIdleMode(IdleMode.kBrake); + intakeLower.follow(intakeUpper, Constants.Intake.INTAKE_FOLLOWER_INVERSE_STATE); intakeUpper.setInverted(Constants.Intake.UPPER_INTAKE_MOTOR_INVERTED); } From 8f7506e8d755a76cb8ea27a97e45988e05a64915 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:51:49 -0600 Subject: [PATCH 23/38] Raised belt current limit --- src/main/java/frc/robot/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 92bcc00b..9c4da095 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -64,7 +64,7 @@ public static class MailboxBelts { public static final boolean BELTS_FOLLOWER_INVERSE_STATE = false; /** Current limit (in amps) for the belt motor(s) */ - public static final int BELT_MOTOR_CURRENT_LIMIT = 30; + public static final int BELT_MOTOR_CURRENT_LIMIT = 40; } /** Constants that are relating to the controllers. */ From 8e8d6d12561a8fc48146af56996cd82aeb9279f5 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:53:15 -0600 Subject: [PATCH 24/38] Fixed belt motor current limit setting --- src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java b/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java index fafc1c8c..36e608b5 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java +++ b/src/main/java/frc/robot/subsystems/mailbox/MailboxBelts.java @@ -28,10 +28,11 @@ public MailboxBelts() { lowerBeltMotor = new CANSparkMax(Constants.MailboxBelts.LOWER_BELT_MOTOR_ID, MotorType.kBrushed); + upperBeltMotor.setSmartCurrentLimit(Constants.MailboxBelts.BELT_MOTOR_CURRENT_LIMIT); + lowerBeltMotor.setSmartCurrentLimit(Constants.MailboxBelts.BELT_MOTOR_CURRENT_LIMIT); + lowerBeltMotor.follow(upperBeltMotor, Constants.MailboxBelts.BELTS_FOLLOWER_INVERSE_STATE); upperBeltMotor.setInverted(Constants.MailboxBelts.UPPER_BELT_MOTOR_INVERTED); - - upperBeltMotor.setSmartCurrentLimit(Constants.MailboxBelts.BELT_MOTOR_CURRENT_LIMIT); } /** Runs the belt. */ From a83f9f3de95f5090abc54584983fd7332b795e23 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:59:41 -0600 Subject: [PATCH 25/38] ensure heading correction is always false Co-Authored-By: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> --- .../java/frc/robot/commands/drive/DriveFieldOriented.java | 4 +++- .../java/frc/robot/commands/drive/DriveRobotOriented.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/drive/DriveFieldOriented.java b/src/main/java/frc/robot/commands/drive/DriveFieldOriented.java index 35a384fe..dd27ac9e 100644 --- a/src/main/java/frc/robot/commands/drive/DriveFieldOriented.java +++ b/src/main/java/frc/robot/commands/drive/DriveFieldOriented.java @@ -40,7 +40,9 @@ public DriveFieldOriented( // Called when the command is initially scheduled. @Override - public void initialize() {} + public void initialize() { + drive.setHeadingCorrection(false); + } // Called every time the scheduler runs while the command is scheduled. @Override diff --git a/src/main/java/frc/robot/commands/drive/DriveRobotOriented.java b/src/main/java/frc/robot/commands/drive/DriveRobotOriented.java index e9b5c02e..df0b2441 100644 --- a/src/main/java/frc/robot/commands/drive/DriveRobotOriented.java +++ b/src/main/java/frc/robot/commands/drive/DriveRobotOriented.java @@ -40,7 +40,9 @@ public DriveRobotOriented( // Called when the command is initially scheduled. @Override - public void initialize() {} + public void initialize() { + drive.setHeadingCorrection(false); + } // Called every time the scheduler runs while the command is scheduled. @Override From 3d9b22ab277e557fa95db083d53f392678750c60 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:39:09 -0600 Subject: [PATCH 26/38] make stick values negative (again?) --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index d4e63ba9..783c2460 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -225,7 +225,7 @@ public Command getAutonomousCommand() { private static double scaleAxis(double axis) { double deadbanded = MathUtil.applyDeadband(axis, Constants.Controllers.DRIVER_CONTROLLER_DEADBAND); - return Math.pow(deadbanded, 3); + return -Math.pow(deadbanded, 3); } /** From 39f4ec464fad51121afce6a1a353990878752e7e Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:03:51 -0600 Subject: [PATCH 27/38] correct encoder offsets --- src/main/deploy/swerve/modules/backleft.json | 2 +- src/main/deploy/swerve/modules/backright.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/deploy/swerve/modules/backleft.json b/src/main/deploy/swerve/modules/backleft.json index b2500100..81877770 100644 --- a/src/main/deploy/swerve/modules/backleft.json +++ b/src/main/deploy/swerve/modules/backleft.json @@ -3,7 +3,7 @@ "front": -10.875, "left": 10 }, - "absoluteEncoderOffset": 54.5, + "absoluteEncoderOffset": 56.5, "drive": { "type": "sparkmax", "id": 8, diff --git a/src/main/deploy/swerve/modules/backright.json b/src/main/deploy/swerve/modules/backright.json index 88b1c4cd..69cc0987 100644 --- a/src/main/deploy/swerve/modules/backright.json +++ b/src/main/deploy/swerve/modules/backright.json @@ -3,7 +3,7 @@ "front": -10.875, "left": -10 }, - "absoluteEncoderOffset": 214.9, + "absoluteEncoderOffset": 209.9, "drive": { "type": "sparkmax", "id": 5, From a6505cc1fa45ead96f76ca776b2797988961bce9 Mon Sep 17 00:00:00 2001 From: MarissaKoglesby <156854363+MarissaKoglesby@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:29:32 -0600 Subject: [PATCH 28/38] Changed Input Scaling on controller --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 783c2460..f8b6590d 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -225,7 +225,7 @@ public Command getAutonomousCommand() { private static double scaleAxis(double axis) { double deadbanded = MathUtil.applyDeadband(axis, Constants.Controllers.DRIVER_CONTROLLER_DEADBAND); - return -Math.pow(deadbanded, 3); + return -Math.pow(deadbanded, 2) * (Math.abs(axis) / axis); } /** From b3448a58c034a0d08e9d86bda8a8868357a2e80c Mon Sep 17 00:00:00 2001 From: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:34:15 -0600 Subject: [PATCH 29/38] tuned limelight constants --- src/main/java/frc/robot/Constants.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index e9574ed6..e5fb23c1 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -148,39 +148,39 @@ public static class AimingLimelight { public static final String LIMELIGHT_NAME = "limelight"; /** The number of degrees the Limelight is mounted back from perfectly vertical */ - public static final double MOUNT_ANGLE = 0; + public static final double MOUNT_ANGLE = 50; /** The number of inches from the center of the Limelight lens to the floor */ - public static final double MOUNT_HEIGHT = 0; + public static final double MOUNT_HEIGHT = 10.0625; /** The height to the Amp Apriltag off the ground. */ - public static final double AMP_APRILTAG_HEIGHT = 0; + public static final double AMP_APRILTAG_HEIGHT = 53.13; /** How far in inches we want to be from the target when we shoot */ - public static final double DISTANCE_FROM_TARGET = 0; + public static final double DISTANCE_FROM_TARGET = 14; /** * How hard to turn toward the target. Double between 0 and 1, standard way to drive a motor */ - public static final double STEER_STRENGTH = 0; + public static final double STEER_STRENGTH = 0.01; /** How hard to drive toward the target. Same notation as above. */ - public static final double DRIVE_STRENGTH = 0; + public static final double DRIVE_STRENGTH = 0.01; /** VERY BASIC speed limit to make sure we don't drive too fast towards the target. */ - public static final double SPEED_LIMIT = 0; + public static final double SPEED_LIMIT = 0.2; /** * When we're at or below this number of degrees from where we want to be, we'll consider the * Limelight's aim routine "done" */ - public static final double TURN_DONE_THRESHOLD = 0; + public static final double TURN_DONE_THRESHOLD = 1; /** * When we're at or below this number of inches from the target distance, we'll consider the * Limelight's drive routine "done" */ - public static final double DISTANCE_DONE_THRESHOLD = 0; + public static final double DISTANCE_DONE_THRESHOLD = 4; /** Holds pipeline numbers for this Limelight. */ public static class PipelineNumbers { From 6f7c2d14a54b2641737b74041aeff9c9ae49bd02 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Mon, 4 Mar 2024 17:02:39 -0600 Subject: [PATCH 30/38] actually switch pipeline numbers in AimWithLL --- src/main/java/frc/robot/RobotContainer.java | 3 ++- .../java/frc/robot/commands/AimAndFireRoutine.java | 3 ++- .../java/frc/robot/commands/AimWithLimelight.java | 14 +++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index f8b6590d..54934c7b 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -148,7 +148,8 @@ public class RobotContainer { Constants.Limelight.AimingLimelight.SPEED_LIMIT, Constants.Limelight.AimingLimelight.TURN_DONE_THRESHOLD, Constants.Limelight.AimingLimelight.DISTANCE_DONE_THRESHOLD, - Constants.Limelight.AimingLimelight.AMP_APRILTAG_HEIGHT); + Constants.Limelight.AimingLimelight.AMP_APRILTAG_HEIGHT, + Constants.Limelight.AimingLimelight.PipelineNumbers.AMP_PIPELINE_NUMBER); private AimAndFireRoutine aimAndFire = new AimAndFireRoutine(); private DeployUrMom deployUrMom = new DeployUrMom(); private ClimbUp climbUp = new ClimbUp(); diff --git a/src/main/java/frc/robot/commands/AimAndFireRoutine.java b/src/main/java/frc/robot/commands/AimAndFireRoutine.java index 6a812f9f..0dd5591c 100644 --- a/src/main/java/frc/robot/commands/AimAndFireRoutine.java +++ b/src/main/java/frc/robot/commands/AimAndFireRoutine.java @@ -36,7 +36,8 @@ public AimAndFireRoutine() { Constants.Limelight.AimingLimelight.SPEED_LIMIT, Constants.Limelight.AimingLimelight.TURN_DONE_THRESHOLD, Constants.Limelight.AimingLimelight.DISTANCE_DONE_THRESHOLD, - Constants.Limelight.AimingLimelight.AMP_APRILTAG_HEIGHT), + Constants.Limelight.AimingLimelight.AMP_APRILTAG_HEIGHT, + Constants.Limelight.AimingLimelight.PipelineNumbers.AMP_PIPELINE_NUMBER), new ParallelDeadlineGroup( new WaitCommand(Constants.Auto.FIRE_NOTE_FOR_TIME), new FireNoteRoutine())); } diff --git a/src/main/java/frc/robot/commands/AimWithLimelight.java b/src/main/java/frc/robot/commands/AimWithLimelight.java index 2a8ba820..781f6de8 100644 --- a/src/main/java/frc/robot/commands/AimWithLimelight.java +++ b/src/main/java/frc/robot/commands/AimWithLimelight.java @@ -33,7 +33,9 @@ public class AimWithLimelight extends Command { speedLimit, turnDoneThreshold, distanceDoneThreshold, - targetHeight; + targetHeight, + pipelineNumber, + oldPipelineNumber; /** * Creates a new command to aim with the Limelight. @@ -61,7 +63,8 @@ public AimWithLimelight( double speedLimit, double turnDoneThreshold, double distanceDoneThreshold, - double targetHeight) { + double targetHeight, + double pipelineNumber) { this.steerStrength = steerStrength; this.distanceFromTarget = distanceFromTarget; this.mountHeight = mountHeight; @@ -71,6 +74,7 @@ public AimWithLimelight( this.turnDoneThreshold = turnDoneThreshold; this.distanceDoneThreshold = distanceDoneThreshold; this.targetHeight = targetHeight; + this.pipelineNumber = pipelineNumber; this.drive = RobotContainer.drive; this.limelight = limelight; // Use addRequirements() here to declare subsystem dependencies. @@ -80,6 +84,8 @@ public AimWithLimelight( // Called when the command is initially scheduled. @Override public void initialize() { + this.oldPipelineNumber = limelight.getLimelightPipeline(); + limelight.setLimelightPipeline(pipelineNumber); this.finished = false; this.counter = 0; } @@ -115,7 +121,9 @@ public void execute() { // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + limelight.setLimelightPipeline(oldPipelineNumber); + } // Returns true when the command should end. @Override From 9392f93dd14c49df0c2193dc632d028ac0cbe1a9 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Wed, 6 Mar 2024 10:04:50 -0600 Subject: [PATCH 31/38] switch y to aiming --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 54934c7b..4c281844 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -206,7 +206,7 @@ private void configureBindings() { driverController.leftStick().toggleOnTrue(driveFieldOriented); driverController.x().onTrue(enterXMode); - driverController.y().whileTrue(fireNote); + driverController.y().whileTrue(aimToAmp); driverController.a().whileTrue(runIntake); // driverController.rightTrigger().whileTrue(deployMailbox); driverController.b().whileTrue(runBelts); From 6d264d3c08131e88f0987fa0ebaae7b0dd2de691 Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Wed, 6 Mar 2024 17:53:54 -0600 Subject: [PATCH 32/38] Fix NaN returned from scaleAxis (fixes #99) --- src/main/java/frc/robot/RobotContainer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 4c281844..fc2a5925 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -224,6 +224,9 @@ public Command getAutonomousCommand() { } private static double scaleAxis(double axis) { + if (axis == 0) { + return 0; + } double deadbanded = MathUtil.applyDeadband(axis, Constants.Controllers.DRIVER_CONTROLLER_DEADBAND); return -Math.pow(deadbanded, 2) * (Math.abs(axis) / axis); From a4813e4310a3fd7346a8086e9b46b371c758a936 Mon Sep 17 00:00:00 2001 From: QuackitsQuinn Date: Thu, 7 Mar 2024 12:47:06 -0600 Subject: [PATCH 33/38] Merge remote-tracking branch 'origin/main' into numbers --- src/main/java/frc/robot/Constants.java | 7 +- src/main/java/frc/robot/Keybinds.java | 79 +++++++++++ src/main/java/frc/robot/RobotContainer.java | 138 +++++++++++++------- 3 files changed, 173 insertions(+), 51 deletions(-) create mode 100644 src/main/java/frc/robot/Keybinds.java diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index e5fb23c1..c1d531e1 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -69,8 +69,11 @@ public static class MailboxBelts { /** Constants that are relating to the controllers. */ public static class Controllers { - /** Driver station port number for the drive controller. */ - public static final int DRIVER_CONTROLLER_PORT = 0; + /** Driver station port number for the pilot controller */ + public static final int PILOT_CONTROLLER_PORT = 0; + + /** Driver station port number for the operator controller */ + public static final int OPERATOR_CONTROLLER_PORT = 2; /** Axis deadband for driver controller. */ public static double DRIVER_CONTROLLER_DEADBAND = 0.1; diff --git a/src/main/java/frc/robot/Keybinds.java b/src/main/java/frc/robot/Keybinds.java new file mode 100644 index 00000000..c95c6a9a --- /dev/null +++ b/src/main/java/frc/robot/Keybinds.java @@ -0,0 +1,79 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +/* + * Asimov's Laws: + * The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm. + * The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law. + * The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law. + */ + +package frc.robot; + +import edu.wpi.first.wpilibj2.command.button.CommandXboxController; + +/** + * The list of keybinds for our controllers for the robot. Call ONE of these methods in {@link + * RobotContainer}'s configureBindings() method.' + */ +public final class Keybinds { + /** + * Configures the robot with default keybinds for competition. + * + * @param pilotController + * @param operatorController + */ + public static void configureDefaultKeybinds( + CommandXboxController pilotController, CommandXboxController operatorController) { + operatorController.y().whileTrue(RobotContainer.climbUp); + operatorController.a().whileTrue(RobotContainer.climbDown); + operatorController.povUp().whileTrue(RobotContainer.runIntake); + /* TODO: bind intake reverse to povDown when issue 92 is closed. */ + operatorController.leftTrigger().whileTrue(RobotContainer.aimToAmp); + operatorController.rightTrigger().whileTrue(RobotContainer.fireNote); + + pilotController.leftTrigger().toggleOnTrue(RobotContainer.driveFieldOriented); + pilotController.rightBumper().toggleOnTrue(RobotContainer.enterXMode); + /* TODO: angle / velocity steering toggle w/ right trigger (no issue) and boost on left bumper (issue 86) */ + } + + /** + * Configures the robot with keybinds for if we can't use the operator controller. (All buttons + * bound to pilotController) + * + * @param pilotController + * @param operatorController + */ + public static void configureOperatorlessKeybinds( + CommandXboxController pilotController, CommandXboxController operatorController) { + pilotController.leftStick().toggleOnTrue(RobotContainer.driveFieldOriented); + /* TODO: angle / velocity steering toggle w/ right stick (no issue) and boost on right bumper (issue 86) */ + /* TODO: bind intake reverse to povDown when issue 92 is closed. */ + pilotController.povUp().toggleOnTrue(RobotContainer.enterXMode); + pilotController.rightTrigger().whileTrue(RobotContainer.runIntake); + pilotController.a().whileTrue(RobotContainer.aimToAmp); + pilotController.b().whileTrue(RobotContainer.fireNote); + pilotController.x().whileTrue(RobotContainer.climbUp); + pilotController.y().whileTrue(RobotContainer.climbDown); + } + + /** + * Configures the robot with the original keybinds. DOES NOT USE OPERATOR CONTROLLER + * + * @param pilotController + * @param operatorController + */ + public static void configureOriginalKeybinds( + CommandXboxController pilotController, CommandXboxController operatorController) { + pilotController.leftStick().toggleOnTrue(RobotContainer.driveFieldOriented); + pilotController.x().onTrue(RobotContainer.enterXMode); + pilotController.y().whileTrue(RobotContainer.fireNote); + pilotController.a().whileTrue(RobotContainer.runIntake); + /* TODO: bind intake reverse to povDown when issue 92 is closed. */ + pilotController.b().whileTrue(RobotContainer.aimToAmp); + pilotController.leftTrigger().whileTrue(RobotContainer.climbDown); + pilotController.rightTrigger().whileTrue(RobotContainer.climbUp); + /* TODO: angle / velocity steering toggle w/ right stick (no issue) and boost on left bumper (issue 86) */ + } +} diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index fc2a5925..bc867c8c 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -87,21 +87,41 @@ public class RobotContainer { /** Singleton instance of {@link Climber} for the whole robot. */ public static Climber climber = new Climber(); + /* + * *************** + * * CONTROLLERS * + * *************** + */ + /** Xbox controller for the pilot. */ + public static CommandXboxController pilotController = + new CommandXboxController(Constants.Controllers.PILOT_CONTROLLER_PORT); + + /** Xbox controller for the operator */ + public static CommandXboxController operatorController = + new CommandXboxController(Constants.Controllers.OPERATOR_CONTROLLER_PORT); + + private static XboxController rawPilotController = pilotController.getHID(); + /* * ************* * * SUPPLIERS * * ************* */ - private Supplier scaledControllerLeftXAxisSupplier = () -> getScaledControllerLeftXAxis(); - private Supplier scaledControllerLeftYAxisSupplier = () -> getScaledControllerLeftYAxis(); - private Supplier scaledControllerRightXAxisSupplier = + private static Supplier scaledControllerLeftXAxisSupplier = + () -> getScaledControllerLeftXAxis(); + private static Supplier scaledControllerLeftYAxisSupplier = + () -> getScaledControllerLeftYAxis(); + private static Supplier scaledControllerRightXAxisSupplier = () -> getScaledControllerRightXAxis(); - private Supplier scaledControllerRightYAxisSupplier = + private static Supplier scaledControllerRightYAxisSupplier = () -> getScaledControllerRightYAxis(); - private Supplier povUpDirectionSupplier = () -> rawXboxController.getPOV() == 0; - private Supplier povRightDirectionSupplier = () -> rawXboxController.getPOV() == 90; - private Supplier povDownDirectionSupplier = () -> rawXboxController.getPOV() == 180; - private Supplier povLeftDirectionSupplier = () -> rawXboxController.getPOV() == 270; + private static Supplier povUpDirectionSupplier = () -> rawPilotController.getPOV() == 0; + private static Supplier povRightDirectionSupplier = + () -> rawPilotController.getPOV() == 90; + private static Supplier povDownDirectionSupplier = + () -> rawPilotController.getPOV() == 180; + private static Supplier povLeftDirectionSupplier = + () -> rawPilotController.getPOV() == 270; /* * ************ @@ -109,17 +129,22 @@ public class RobotContainer { * ************ */ - private DriveRobotOriented driveRobotOriented = + /** Singleton instance of {@link DriveRobotOriented} for the whole robot. */ + public static DriveRobotOriented driveRobotOriented = new DriveRobotOriented( scaledControllerLeftYAxisSupplier, scaledControllerLeftXAxisSupplier, scaledControllerRightXAxisSupplier); - private DriveFieldOriented driveFieldOriented = + + /** Singleton instance of {@link DriveFieldOriented} for the whole robot. */ + public static DriveFieldOriented driveFieldOriented = new DriveFieldOriented( scaledControllerLeftXAxisSupplier, scaledControllerLeftYAxisSupplier, scaledControllerRightXAxisSupplier); - private DriveFieldOrientedHeadingSnapping driveFieldOrientedHeadingSnapping = + + /** Singleton instance of {@link DriveFieldOrientedHeadingSnapping} for the whole robot. */ + public static DriveFieldOrientedHeadingSnapping driveFieldOrientedHeadingSnapping = new DriveFieldOrientedHeadingSnapping( scaledControllerRightXAxisSupplier, scaledControllerLeftYAxisSupplier, @@ -128,16 +153,34 @@ public class RobotContainer { povDownDirectionSupplier, povLeftDirectionSupplier, povRightDirectionSupplier); - private EnterXMode enterXMode = new EnterXMode(); - private DeployPneumatics deployPneumatics = new DeployPneumatics(); - private RunBelts runBelts = new RunBelts(); - private DeployMailbox deployMailbox = new DeployMailbox(); - private DeindexNote deindexNote = new DeindexNote(); - private FireNoteRoutine fireNote = new FireNoteRoutine(); - private FireNoteRoutineNoLimitSwitch fireNoteRoutineNoLimitSwitch = + + /** Singleton instance of {@link EnterXMode} for the whole robot. */ + public static EnterXMode enterXMode = new EnterXMode(); + + /** Singleton instance of {@link DeployPneumatics} for the whole robot. */ + public static DeployPneumatics deployPneumatics = new DeployPneumatics(); + + /** Singleton instance of {@link RunBelts} for the whole robot. */ + public static RunBelts runBelts = new RunBelts(); + + /** Singleton instance of {@link DeployMailbox} for the whole robot. */ + public static DeployMailbox deployMailbox = new DeployMailbox(); + + /** Singleton instance of {@link DeindexNote} for the whole robot. */ + public static DeindexNote deindexNote = new DeindexNote(); + + /** Singleton instance of {@link FireNoteRoutine} for the whole robot. */ + public static FireNoteRoutine fireNote = new FireNoteRoutine(); + + /** Singleton instance of {@link FireNoteRoutineNoLimitSwitch} for the whole robot. */ + public static FireNoteRoutineNoLimitSwitch fireNoteRoutineNoLimitSwitch = new FireNoteRoutineNoLimitSwitch(); - private RunIntake runIntake = new RunIntake(); - private AimWithLimelight aimToAmp = + + /** Singleton instance of {@link RunIntake} for the whole robot. */ + public static RunIntake runIntake = new RunIntake(); + + /** Singleton instance of {@link AimWithLimelight} for the whole robot. */ + public static AimWithLimelight aimToAmp = new AimWithLimelight( limelight, Constants.Limelight.AimingLimelight.STEER_STRENGTH, @@ -150,15 +193,28 @@ public class RobotContainer { Constants.Limelight.AimingLimelight.DISTANCE_DONE_THRESHOLD, Constants.Limelight.AimingLimelight.AMP_APRILTAG_HEIGHT, Constants.Limelight.AimingLimelight.PipelineNumbers.AMP_PIPELINE_NUMBER); - private AimAndFireRoutine aimAndFire = new AimAndFireRoutine(); - private DeployUrMom deployUrMom = new DeployUrMom(); - private ClimbUp climbUp = new ClimbUp(); - private ClimbDown climbDown = new ClimbDown(); + + /** Singleton instance of {@link AimAndFireRoutine} for the whole robot. */ + public static AimAndFireRoutine aimAndFire = new AimAndFireRoutine(); + + /** Singleton instance of {@link DeployUrMom} for the whole robot. */ + public static DeployUrMom deployUrMom = new DeployUrMom(); + + /** Singleton instance of {@link ClimbUp} for the whole robot. */ + public static ClimbUp climbUp = new ClimbUp(); + + /** Singleton instance of {@link ClimbDown} for the whole robot. */ + public static ClimbDown climbDown = new ClimbDown(); /* Autos */ - private MoveAwayFromAmp moveAwayFromAmp = new MoveAwayFromAmp(); - private OnePieceAuto onePieceAuto = new OnePieceAuto(); - private TaxiAuto taxiAuto = new TaxiAuto(); + /** Singleton instance of {@link MoveAwayFromAmp} for the whole robot. */ + public static MoveAwayFromAmp moveAwayFromAmp = new MoveAwayFromAmp(); + + /** Singleton instance of {@link OnePieceAuto} for the whole robot. */ + public static OnePieceAuto onePieceAuto = new OnePieceAuto(); + + /** Singleton instance of {@link TaxiAuto} for the whole robot. */ + public static TaxiAuto taxiAuto = new TaxiAuto(); /* * *********************** @@ -166,15 +222,6 @@ public class RobotContainer { * *********************** */ - /* The CommandXboxController instance must be static to allow the getter methods for its axes - * to work. - */ - /** Xbox controller for the driver. */ - public static CommandXboxController driverController = - new CommandXboxController(Constants.Controllers.DRIVER_CONTROLLER_PORT); - - private static XboxController rawXboxController = driverController.getHID(); - /** Sendable Chooser for autos. */ private SendableChooser autoChooser; @@ -203,15 +250,8 @@ private void configureAuto() { } private void configureBindings() { - driverController.leftStick().toggleOnTrue(driveFieldOriented); - - driverController.x().onTrue(enterXMode); - driverController.y().whileTrue(aimToAmp); - driverController.a().whileTrue(runIntake); - // driverController.rightTrigger().whileTrue(deployMailbox); - driverController.b().whileTrue(runBelts); - driverController.leftBumper().whileTrue(climbDown); - driverController.rightBumper().whileTrue(climbUp); + // TODO: CHANGE THIS TO configureDefaultKeybinds() FOR COMP + Keybinds.configureDefaultKeybinds(pilotController, operatorController); } /** @@ -238,7 +278,7 @@ private static double scaleAxis(double axis) { * @return x-axis of left stick of driver controller. */ public static double getControllerLeftXAxis() { - return driverController.getLeftX(); + return pilotController.getLeftX(); } /** @@ -256,7 +296,7 @@ public static double getScaledControllerLeftXAxis() { * @return y-axis of left stick of driver controller. */ public static double getControllerLeftYAxis() { - return driverController.getLeftY(); + return pilotController.getLeftY(); } /** @@ -274,7 +314,7 @@ public static double getScaledControllerLeftYAxis() { * @return x-axis of right stick of driver controller. */ public static double getControllerRightXAxis() { - return driverController.getRightX(); + return pilotController.getRightX(); } /** @@ -292,7 +332,7 @@ public static double getScaledControllerRightXAxis() { * @return y-axis of right stick of driver controller. */ public static double getControllerRightYAxis() { - return driverController.getRightY(); + return pilotController.getRightY(); } /** From 74f77e03d5e483cd3b80aa75b2dcb6a2e219c8d0 Mon Sep 17 00:00:00 2001 From: QuackitsQuinn Date: Thu, 7 Mar 2024 12:57:40 -0600 Subject: [PATCH 34/38] fix a small merge error --- src/main/java/frc/robot/RobotContainer.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index a7eb7519..15879ccb 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -176,8 +176,6 @@ public class RobotContainer { /** Singleton instance of {@link FireNoteRoutineNoLimitSwitch} for the whole robot. */ public static FireNoteRoutineNoLimitSwitch fireNoteRoutineNoLimitSwitch = new FireNoteRoutineNoLimitSwitch(); - private RunIntake runIntake = new RunIntake(); - private AimWithLimelight aimToAmp = /** Singleton instance of {@link RunIntakeReverse} for the whole robot. */ public RunIntakeReverse runIntakeReverse = new RunIntakeReverse(); From 25aa062b5a7e637fdc0787d905a78bf408ce054b Mon Sep 17 00:00:00 2001 From: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> Date: Thu, 7 Mar 2024 17:39:52 -0600 Subject: [PATCH 35/38] made RunIntakeReverse static in robot container --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 15879ccb..bf88fc56 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -178,7 +178,7 @@ public class RobotContainer { new FireNoteRoutineNoLimitSwitch(); /** Singleton instance of {@link RunIntakeReverse} for the whole robot. */ - public RunIntakeReverse runIntakeReverse = new RunIntakeReverse(); + public static RunIntakeReverse runIntakeReverse = new RunIntakeReverse(); /** Singleton instance of {@link RunIntake} for the whole robot. */ public static RunIntake runIntake = new RunIntake(); From e7251670d87183fb98f70579c8bd92edd04c4f0d Mon Sep 17 00:00:00 2001 From: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> Date: Thu, 7 Mar 2024 17:40:29 -0600 Subject: [PATCH 36/38] updated keybinds with run intake reverse --- src/main/java/frc/robot/Keybinds.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/Keybinds.java b/src/main/java/frc/robot/Keybinds.java index c95c6a9a..3e7e7760 100644 --- a/src/main/java/frc/robot/Keybinds.java +++ b/src/main/java/frc/robot/Keybinds.java @@ -29,7 +29,7 @@ public static void configureDefaultKeybinds( operatorController.y().whileTrue(RobotContainer.climbUp); operatorController.a().whileTrue(RobotContainer.climbDown); operatorController.povUp().whileTrue(RobotContainer.runIntake); - /* TODO: bind intake reverse to povDown when issue 92 is closed. */ + operatorController.povDown().whileTrue(RobotContainer.runIntakeReverse); operatorController.leftTrigger().whileTrue(RobotContainer.aimToAmp); operatorController.rightTrigger().whileTrue(RobotContainer.fireNote); @@ -49,7 +49,7 @@ public static void configureOperatorlessKeybinds( CommandXboxController pilotController, CommandXboxController operatorController) { pilotController.leftStick().toggleOnTrue(RobotContainer.driveFieldOriented); /* TODO: angle / velocity steering toggle w/ right stick (no issue) and boost on right bumper (issue 86) */ - /* TODO: bind intake reverse to povDown when issue 92 is closed. */ + pilotController.povDown().whileTrue(RobotContainer.runIntakeReverse); pilotController.povUp().toggleOnTrue(RobotContainer.enterXMode); pilotController.rightTrigger().whileTrue(RobotContainer.runIntake); pilotController.a().whileTrue(RobotContainer.aimToAmp); @@ -70,7 +70,7 @@ public static void configureOriginalKeybinds( pilotController.x().onTrue(RobotContainer.enterXMode); pilotController.y().whileTrue(RobotContainer.fireNote); pilotController.a().whileTrue(RobotContainer.runIntake); - /* TODO: bind intake reverse to povDown when issue 92 is closed. */ + pilotController.povDown().whileTrue(RobotContainer.runIntakeReverse); pilotController.b().whileTrue(RobotContainer.aimToAmp); pilotController.leftTrigger().whileTrue(RobotContainer.climbDown); pilotController.rightTrigger().whileTrue(RobotContainer.climbUp); From 577874aa2060f7d1d4ca0c60bad1649e2cbb514d Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Thu, 7 Mar 2024 17:43:18 -0600 Subject: [PATCH 37/38] fix merge error (again) --- src/main/java/frc/robot/commands/AimAndFireRoutine.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/frc/robot/commands/AimAndFireRoutine.java b/src/main/java/frc/robot/commands/AimAndFireRoutine.java index 0dd5591c..2b333f32 100644 --- a/src/main/java/frc/robot/commands/AimAndFireRoutine.java +++ b/src/main/java/frc/robot/commands/AimAndFireRoutine.java @@ -38,6 +38,7 @@ public AimAndFireRoutine() { Constants.Limelight.AimingLimelight.DISTANCE_DONE_THRESHOLD, Constants.Limelight.AimingLimelight.AMP_APRILTAG_HEIGHT, Constants.Limelight.AimingLimelight.PipelineNumbers.AMP_PIPELINE_NUMBER), + new EnterXMode(), new ParallelDeadlineGroup( new WaitCommand(Constants.Auto.FIRE_NOTE_FOR_TIME), new FireNoteRoutine())); } From 1e38053ad3cc23db964003266cb8f1461c3e732d Mon Sep 17 00:00:00 2001 From: willitcode <91231142+willitcode@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:18:35 -0600 Subject: [PATCH 38/38] Fix intake LS comment --- src/main/java/frc/robot/subsystems/Intake.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index 97f9a802..4e4b022b 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -59,7 +59,7 @@ public void runIntakeReverse() { * @return the status of the limit switch */ public boolean getLimitSwitch() { - /* Assumes the limit switch is wired to be normally open. */ + /* Assumes the limit switch is wired to be normally closed. */ return !limitSwitch.get(); }