From 912f4f0db10b62775e89ed9e2122335a8838ce3e Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Tue, 30 Jan 2024 17:02:00 -0600 Subject: [PATCH 01/29] Renamed RunBelts to RunMailboxBelts to prevent confusion --- src/main/java/frc/robot/RobotContainer.java | 4 +-- .../frc/robot/commands/DeployMailbox.java | 2 +- .../java/frc/robot/commands/OutputNote.java | 32 +++++++++++++++++++ .../{RunBelts.java => RunMailboxBelts.java} | 4 +-- 4 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 src/main/java/frc/robot/commands/OutputNote.java rename src/main/java/frc/robot/commands/{RunBelts.java => RunMailboxBelts.java} (95%) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 2a8d483b..a2e074e8 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -19,7 +19,7 @@ import frc.robot.commands.DriveFieldOriented; import frc.robot.commands.DriveRobotOriented; import frc.robot.commands.EnterXMode; -import frc.robot.commands.RunBelts; +import frc.robot.commands.RunMailboxBelts; import frc.robot.commands.RunIntake; import frc.robot.subsystems.Drive; import frc.robot.subsystems.Intake; @@ -61,7 +61,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 RunMailboxBelts runBelts = new RunMailboxBelts(); private RunIntake runIntake = new RunIntake(); /* diff --git a/src/main/java/frc/robot/commands/DeployMailbox.java b/src/main/java/frc/robot/commands/DeployMailbox.java index b54b9fcb..e8a1e84b 100644 --- a/src/main/java/frc/robot/commands/DeployMailbox.java +++ b/src/main/java/frc/robot/commands/DeployMailbox.java @@ -19,6 +19,6 @@ public class DeployMailbox extends ParallelCommandGroup { /** Creates a new DeployMailbox. */ public DeployMailbox() { - addCommands(new DeployPneumatics(), new RunBelts()); + addCommands(new DeployPneumatics(), new RunMailboxBelts()); } } diff --git a/src/main/java/frc/robot/commands/OutputNote.java b/src/main/java/frc/robot/commands/OutputNote.java new file mode 100644 index 00000000..289394c3 --- /dev/null +++ b/src/main/java/frc/robot/commands/OutputNote.java @@ -0,0 +1,32 @@ +// 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. + +package frc.robot.commands; + +import edu.wpi.first.wpilibj2.command.Command; + +public class OutputNote extends Command { + /** Creates a new OutputNote. */ + public OutputNote() { + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() {} + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/commands/RunBelts.java b/src/main/java/frc/robot/commands/RunMailboxBelts.java similarity index 95% rename from src/main/java/frc/robot/commands/RunBelts.java rename to src/main/java/frc/robot/commands/RunMailboxBelts.java index f42494b4..71ee65be 100644 --- a/src/main/java/frc/robot/commands/RunBelts.java +++ b/src/main/java/frc/robot/commands/RunMailboxBelts.java @@ -16,11 +16,11 @@ import frc.robot.subsystems.mailbox.MailboxBelts; /** Command that activates belts when started, and deactivates belts when ended. */ -public class RunBelts extends Command { +public class RunMailboxBelts extends Command { private MailboxBelts mailboxBelts; /** Creates a new DeployBelts. */ - public RunBelts() { + public RunMailboxBelts() { this.mailboxBelts = RobotContainer.mailboxBelts; addRequirements(mailboxBelts); // Use addRequirements() here to declare subsystem dependencies. From 290924523b2548e51d7f397b7ddd3782afbe571e Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:38:50 -0600 Subject: [PATCH 02/29] Added mailbox subsystems --- src/main/java/frc/robot/commands/OutputNote.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/frc/robot/commands/OutputNote.java b/src/main/java/frc/robot/commands/OutputNote.java index 289394c3..b94f8ca9 100644 --- a/src/main/java/frc/robot/commands/OutputNote.java +++ b/src/main/java/frc/robot/commands/OutputNote.java @@ -5,11 +5,24 @@ package frc.robot.commands; import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.RobotContainer; +import frc.robot.subsystems.mailbox.MailboxBelts; +import frc.robot.subsystems.mailbox.MailboxPneumatics; + + public class OutputNote extends Command { /** Creates a new OutputNote. */ + + private MailboxBelts mailboxBelts; + private MailboxPneumatics mailboxPneumatics; + public OutputNote() { + + this.mailboxBelts = RobotContainer.mailboxBelts; + this.mailboxPneumatics = RobotContainer.mailboxPneumatics; // Use addRequirements() here to declare subsystem dependencies. + addRequirements(mailboxBelts, mailboxPneumatics); } // Called when the command is initially scheduled. From 283f732fb3b8c69c923c42e918618b0cd151acc0 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:55:57 -0600 Subject: [PATCH 03/29] Added constant for limit switch port --- src/main/java/frc/robot/Constants.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 1ceaa0b6..6f1707d0 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -22,6 +22,13 @@ * constants are needed, to reduce verbosity. */ public final class Constants { + + /** Constants for the Mailbox system */ + 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; + } /** Constants for the Pneumatics system. */ public static class MailboxPneumatics { /** The channel on the PCM for the forward direction on the left solenoid. */ From 21761da8d6110df1cbabea5cd803184933c3e660 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:56:40 -0600 Subject: [PATCH 04/29] Added Limitswitch to Mailbox --- .../java/frc/robot/subsystems/mailbox/Mailbox.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java index ee925a4d..dd8b2568 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java +++ b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java @@ -11,12 +11,20 @@ package frc.robot.subsystems.mailbox; +import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.Constants; /** Subsystem for the mailbox that outputs game pieces from our robot. */ public class Mailbox extends SubsystemBase { + + private DigitalInput limitSwitch; + /** Creates a new Mailbox. */ - public Mailbox() {} + public Mailbox() { + + this.limitSwitch = new DigitalInput(Constants.Mailbox.MAILBOX_LIMIT_SWITCH_DIO_PORT); + } @Override public void periodic() { From a3a727d84f1254443ef385a3b7c84e71919a0d0d Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:57:59 -0600 Subject: [PATCH 05/29] Added getter method for mailbox limit switch --- src/main/java/frc/robot/subsystems/mailbox/Mailbox.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java index dd8b2568..ac6e2809 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java +++ b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java @@ -26,6 +26,10 @@ public Mailbox() { this.limitSwitch = new DigitalInput(Constants.Mailbox.MAILBOX_LIMIT_SWITCH_DIO_PORT); } + public boolean getLimitSwitch() { + return limitSwitch.get(); + } + @Override public void periodic() { // This method will be called once per scheduler run From a4e741c5fc36ccba1acada164b4e968f6fe679e1 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 18:00:54 -0600 Subject: [PATCH 06/29] Added mailbox to robotcontainer --- src/main/java/frc/robot/RobotContainer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index a2e074e8..1bbf37e6 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -23,6 +23,7 @@ import frc.robot.commands.RunIntake; import frc.robot.subsystems.Drive; import frc.robot.subsystems.Intake; +import frc.robot.subsystems.mailbox.Mailbox; import frc.robot.subsystems.mailbox.MailboxBelts; import frc.robot.subsystems.mailbox.MailboxPneumatics; @@ -48,6 +49,9 @@ public class RobotContainer { /** Singleton instance of {@link MailboxBelts} for the whole robot. */ public static MailboxBelts mailboxBelts = new MailboxBelts(); + /** Singleton instance of {@link Mailbox} for the whole robot. */ + public static Mailbox mailbox = new Mailbox(); + /** Singleton instance of {@link Intake} for the whole robot. */ public static Intake intake = new Intake(); From cbb5f1c68b345fbb68bfc4e228644d1848d77ef1 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 18:17:23 -0600 Subject: [PATCH 07/29] Added RetractPneumatics command --- .../frc/robot/commands/RetractPneumatics.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/java/frc/robot/commands/RetractPneumatics.java diff --git a/src/main/java/frc/robot/commands/RetractPneumatics.java b/src/main/java/frc/robot/commands/RetractPneumatics.java new file mode 100644 index 00000000..a08b92fb --- /dev/null +++ b/src/main/java/frc/robot/commands/RetractPneumatics.java @@ -0,0 +1,40 @@ +// 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. + +package frc.robot.commands; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.RobotContainer; +import frc.robot.subsystems.mailbox.MailboxPneumatics; + +public class RetractPneumatics extends Command { + + private MailboxPneumatics mailboxPneumatics; + + /** Creates a new RetractPneumatics. */ + public RetractPneumatics() { + mailboxPneumatics = RobotContainer.mailboxPneumatics; + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + mailboxPneumatics.retract(); + } + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() {} + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From dd957e85faa8809bf180c47d0f9d3850d4833758 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 18:17:42 -0600 Subject: [PATCH 08/29] Renamed RunMailboxBelts to RunBelts Cause that's what we're calling it --- .../frc/robot/commands/{RunMailboxBelts.java => RunBelts.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/java/frc/robot/commands/{RunMailboxBelts.java => RunBelts.java} (100%) diff --git a/src/main/java/frc/robot/commands/RunMailboxBelts.java b/src/main/java/frc/robot/commands/RunBelts.java similarity index 100% rename from src/main/java/frc/robot/commands/RunMailboxBelts.java rename to src/main/java/frc/robot/commands/RunBelts.java From 6d9b78d97db9f28b660b69ca1f865879100e7e58 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 18:26:51 -0600 Subject: [PATCH 09/29] general cleanup from last commits --- src/main/java/frc/robot/RobotContainer.java | 4 ++-- src/main/java/frc/robot/commands/DeployMailbox.java | 2 +- src/main/java/frc/robot/commands/DeployPneumatics.java | 1 - src/main/java/frc/robot/commands/RunBelts.java | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 1bbf37e6..36798a59 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -19,7 +19,7 @@ import frc.robot.commands.DriveFieldOriented; import frc.robot.commands.DriveRobotOriented; import frc.robot.commands.EnterXMode; -import frc.robot.commands.RunMailboxBelts; +import frc.robot.commands.RunBelts; import frc.robot.commands.RunIntake; import frc.robot.subsystems.Drive; import frc.robot.subsystems.Intake; @@ -65,7 +65,7 @@ public class RobotContainer { private DriveFieldOriented driveFieldOriented = new DriveFieldOriented(); private EnterXMode enterXMode = new EnterXMode(); private DeployPneumatics deployPneumatics = new DeployPneumatics(); - private RunMailboxBelts runBelts = new RunMailboxBelts(); + private RunBelts runBelts = new RunBelts(); private RunIntake runIntake = new RunIntake(); /* diff --git a/src/main/java/frc/robot/commands/DeployMailbox.java b/src/main/java/frc/robot/commands/DeployMailbox.java index e8a1e84b..b54b9fcb 100644 --- a/src/main/java/frc/robot/commands/DeployMailbox.java +++ b/src/main/java/frc/robot/commands/DeployMailbox.java @@ -19,6 +19,6 @@ public class DeployMailbox extends ParallelCommandGroup { /** Creates a new DeployMailbox. */ public DeployMailbox() { - addCommands(new DeployPneumatics(), new RunMailboxBelts()); + addCommands(new DeployPneumatics(), new RunBelts()); } } diff --git a/src/main/java/frc/robot/commands/DeployPneumatics.java b/src/main/java/frc/robot/commands/DeployPneumatics.java index 8c072a71..ae490ba6 100644 --- a/src/main/java/frc/robot/commands/DeployPneumatics.java +++ b/src/main/java/frc/robot/commands/DeployPneumatics.java @@ -38,7 +38,6 @@ public void execute() {} // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { - mailboxPneumatics.retract(); } // Returns true when the command should end. diff --git a/src/main/java/frc/robot/commands/RunBelts.java b/src/main/java/frc/robot/commands/RunBelts.java index 71ee65be..f42494b4 100644 --- a/src/main/java/frc/robot/commands/RunBelts.java +++ b/src/main/java/frc/robot/commands/RunBelts.java @@ -16,11 +16,11 @@ import frc.robot.subsystems.mailbox.MailboxBelts; /** Command that activates belts when started, and deactivates belts when ended. */ -public class RunMailboxBelts extends Command { +public class RunBelts extends Command { private MailboxBelts mailboxBelts; /** Creates a new DeployBelts. */ - public RunMailboxBelts() { + public RunBelts() { this.mailboxBelts = RobotContainer.mailboxBelts; addRequirements(mailboxBelts); // Use addRequirements() here to declare subsystem dependencies. From 0adfc0715867b8bb889278580e3b437f951be24c Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 18:36:57 -0600 Subject: [PATCH 10/29] created mailbox folder for orginization --- src/main/java/frc/robot/RobotContainer.java | 4 ++-- .../commands/{ => mailbox}/DeployMailbox.java | 2 +- .../commands/{ => mailbox}/DeployPneumatics.java | 2 +- .../robot/commands/{ => mailbox}/OutputNote.java | 13 ++++++++++--- .../robot/commands/mailbox/RetractMailbox.java | 15 +++++++++++++++ .../commands/{ => mailbox}/RetractPneumatics.java | 2 +- .../robot/commands/{ => mailbox}/RunBelts.java | 2 +- 7 files changed, 31 insertions(+), 9 deletions(-) rename src/main/java/frc/robot/commands/{ => mailbox}/DeployMailbox.java (96%) rename src/main/java/frc/robot/commands/{ => mailbox}/DeployPneumatics.java (97%) rename src/main/java/frc/robot/commands/{ => mailbox}/OutputNote.java (83%) create mode 100644 src/main/java/frc/robot/commands/mailbox/RetractMailbox.java rename src/main/java/frc/robot/commands/{ => mailbox}/RetractPneumatics.java (96%) rename src/main/java/frc/robot/commands/{ => mailbox}/RunBelts.java (97%) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 36798a59..9c23619f 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -15,12 +15,12 @@ import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; -import frc.robot.commands.DeployPneumatics; import frc.robot.commands.DriveFieldOriented; import frc.robot.commands.DriveRobotOriented; import frc.robot.commands.EnterXMode; -import frc.robot.commands.RunBelts; import frc.robot.commands.RunIntake; +import frc.robot.commands.mailbox.DeployPneumatics; +import frc.robot.commands.mailbox.RunBelts; import frc.robot.subsystems.Drive; import frc.robot.subsystems.Intake; import frc.robot.subsystems.mailbox.Mailbox; diff --git a/src/main/java/frc/robot/commands/DeployMailbox.java b/src/main/java/frc/robot/commands/mailbox/DeployMailbox.java similarity index 96% rename from src/main/java/frc/robot/commands/DeployMailbox.java rename to src/main/java/frc/robot/commands/mailbox/DeployMailbox.java index b54b9fcb..8fb4d8d5 100644 --- a/src/main/java/frc/robot/commands/DeployMailbox.java +++ b/src/main/java/frc/robot/commands/mailbox/DeployMailbox.java @@ -9,7 +9,7 @@ * 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.commands; +package frc.robot.commands.mailbox; import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; diff --git a/src/main/java/frc/robot/commands/DeployPneumatics.java b/src/main/java/frc/robot/commands/mailbox/DeployPneumatics.java similarity index 97% rename from src/main/java/frc/robot/commands/DeployPneumatics.java rename to src/main/java/frc/robot/commands/mailbox/DeployPneumatics.java index ae490ba6..69d2ceeb 100644 --- a/src/main/java/frc/robot/commands/DeployPneumatics.java +++ b/src/main/java/frc/robot/commands/mailbox/DeployPneumatics.java @@ -9,7 +9,7 @@ * 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.commands; +package frc.robot.commands.mailbox; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.RobotContainer; diff --git a/src/main/java/frc/robot/commands/OutputNote.java b/src/main/java/frc/robot/commands/mailbox/OutputNote.java similarity index 83% rename from src/main/java/frc/robot/commands/OutputNote.java rename to src/main/java/frc/robot/commands/mailbox/OutputNote.java index b94f8ca9..811b7884 100644 --- a/src/main/java/frc/robot/commands/OutputNote.java +++ b/src/main/java/frc/robot/commands/mailbox/OutputNote.java @@ -2,10 +2,11 @@ // 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. -package frc.robot.commands; +package frc.robot.commands.mailbox; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.RobotContainer; +import frc.robot.subsystems.mailbox.Mailbox; import frc.robot.subsystems.mailbox.MailboxBelts; import frc.robot.subsystems.mailbox.MailboxPneumatics; @@ -16,12 +17,14 @@ public class OutputNote extends Command { private MailboxBelts mailboxBelts; private MailboxPneumatics mailboxPneumatics; + private Mailbox mailbox; public OutputNote() { this.mailboxBelts = RobotContainer.mailboxBelts; this.mailboxPneumatics = RobotContainer.mailboxPneumatics; - // Use addRequirements() here to declare subsystem dependencies. + this.mailbox = RobotContainer.mailbox; + addRequirements(mailboxBelts, mailboxPneumatics); } @@ -31,7 +34,11 @@ public void initialize() {} // Called every time the scheduler runs while the command is scheduled. @Override - public void execute() {} + public void execute() { + if (mailbox.getLimitSwitch()) { + + } + } // Called once the command ends or is interrupted. @Override diff --git a/src/main/java/frc/robot/commands/mailbox/RetractMailbox.java b/src/main/java/frc/robot/commands/mailbox/RetractMailbox.java new file mode 100644 index 00000000..8e66b188 --- /dev/null +++ b/src/main/java/frc/robot/commands/mailbox/RetractMailbox.java @@ -0,0 +1,15 @@ +// 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. + +package frc.robot.commands.mailbox; + +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; + +public class RetractMailbox extends ParallelCommandGroup { + /** Creates a new DeployMailbox. */ + public RetractMailbox() { + addCommands(new DeployPneumatics(), new RunBelts()); + } +} diff --git a/src/main/java/frc/robot/commands/RetractPneumatics.java b/src/main/java/frc/robot/commands/mailbox/RetractPneumatics.java similarity index 96% rename from src/main/java/frc/robot/commands/RetractPneumatics.java rename to src/main/java/frc/robot/commands/mailbox/RetractPneumatics.java index a08b92fb..61686690 100644 --- a/src/main/java/frc/robot/commands/RetractPneumatics.java +++ b/src/main/java/frc/robot/commands/mailbox/RetractPneumatics.java @@ -2,7 +2,7 @@ // 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. -package frc.robot.commands; +package frc.robot.commands.mailbox; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.RobotContainer; diff --git a/src/main/java/frc/robot/commands/RunBelts.java b/src/main/java/frc/robot/commands/mailbox/RunBelts.java similarity index 97% rename from src/main/java/frc/robot/commands/RunBelts.java rename to src/main/java/frc/robot/commands/mailbox/RunBelts.java index f42494b4..68bef281 100644 --- a/src/main/java/frc/robot/commands/RunBelts.java +++ b/src/main/java/frc/robot/commands/mailbox/RunBelts.java @@ -9,7 +9,7 @@ * 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.commands; +package frc.robot.commands.mailbox; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.RobotContainer; From 588c50cbf330e1085906c062e7ac6222a62a6717 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 18:37:09 -0600 Subject: [PATCH 11/29] Created DeindexNotel.java --- .../robot/commands/mailbox/DeindexNote.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/main/java/frc/robot/commands/mailbox/DeindexNote.java diff --git a/src/main/java/frc/robot/commands/mailbox/DeindexNote.java b/src/main/java/frc/robot/commands/mailbox/DeindexNote.java new file mode 100644 index 00000000..e622057a --- /dev/null +++ b/src/main/java/frc/robot/commands/mailbox/DeindexNote.java @@ -0,0 +1,38 @@ +// 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. + +package frc.robot.commands.mailbox; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Intake; +import frc.robot.subsystems.mailbox.Mailbox; + +public class DeindexNote extends Command { + + private Intake intake; + private Mailbox mailbox; + + /** Creates a new DeindexNote. */ + public DeindexNote() { + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() {} + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From fed7601182dff64456a8878a2e3ddd3699072fb1 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:00:54 -0600 Subject: [PATCH 12/29] DeindexNote runs the intake properly --- .../robot/commands/mailbox/DeindexNote.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/commands/mailbox/DeindexNote.java b/src/main/java/frc/robot/commands/mailbox/DeindexNote.java index e622057a..09391cd6 100644 --- a/src/main/java/frc/robot/commands/mailbox/DeindexNote.java +++ b/src/main/java/frc/robot/commands/mailbox/DeindexNote.java @@ -5,6 +5,7 @@ package frc.robot.commands.mailbox; import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.RobotContainer; import frc.robot.subsystems.Intake; import frc.robot.subsystems.mailbox.Mailbox; @@ -15,7 +16,9 @@ public class DeindexNote extends Command { /** Creates a new DeindexNote. */ public DeindexNote() { - // Use addRequirements() here to declare subsystem dependencies. + this.intake = RobotContainer.intake; + this.mailbox = RobotContainer.mailbox; + addRequirements(intake, mailbox); } // Called when the command is initially scheduled. @@ -24,11 +27,21 @@ public void initialize() {} // Called every time the scheduler runs while the command is scheduled. @Override - public void execute() {} + public void execute() { + if (mailbox.getLimitSwitch()) { + intake.runIntake(); + } + /* This else isn't neccessary, just advised for safety. If it interferes with anything, feel free to remove it. */ + else { + intake.stop(); + } + } // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + intake.stop(); + } // Returns true when the command should end. @Override From 89229341a7dd5123d110d7790ecced9e25f8a3e8 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:03:26 -0600 Subject: [PATCH 13/29] removed redundant code --- src/main/java/frc/robot/commands/mailbox/OutputNote.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/frc/robot/commands/mailbox/OutputNote.java b/src/main/java/frc/robot/commands/mailbox/OutputNote.java index 811b7884..3c9a18d9 100644 --- a/src/main/java/frc/robot/commands/mailbox/OutputNote.java +++ b/src/main/java/frc/robot/commands/mailbox/OutputNote.java @@ -34,11 +34,7 @@ public void initialize() {} // Called every time the scheduler runs while the command is scheduled. @Override - public void execute() { - if (mailbox.getLimitSwitch()) { - - } - } + public void execute() {} // Called once the command ends or is interrupted. @Override From 06f4d26a686c14d010cd6ad39a75aa105d9de8bb Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:11:23 -0600 Subject: [PATCH 14/29] Added deindexNote object to robotContainer --- src/main/java/frc/robot/RobotContainer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 9c23619f..e0545237 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -19,6 +19,7 @@ import frc.robot.commands.DriveRobotOriented; import frc.robot.commands.EnterXMode; import frc.robot.commands.RunIntake; +import frc.robot.commands.mailbox.DeindexNote; import frc.robot.commands.mailbox.DeployPneumatics; import frc.robot.commands.mailbox.RunBelts; import frc.robot.subsystems.Drive; @@ -52,6 +53,9 @@ public class RobotContainer { /** Singleton instance of {@link Mailbox} for the whole robot. */ public static Mailbox mailbox = new Mailbox(); + /** Singleton instance of {@link DeindexNote} for the whole robot. */ + public static DeindexNote deindexNote = new DeindexNote(); + /** Singleton instance of {@link Intake} for the whole robot. */ public static Intake intake = new Intake(); From 02ade764807bb0ef331af8938aed86b153aea8c9 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:12:44 -0600 Subject: [PATCH 15/29] properly added deployMailbox and deindexNote to RobotContainer --- src/main/java/frc/robot/RobotContainer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index e0545237..64b37c1b 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -20,6 +20,7 @@ import frc.robot.commands.EnterXMode; import frc.robot.commands.RunIntake; import frc.robot.commands.mailbox.DeindexNote; +import frc.robot.commands.mailbox.DeployMailbox; import frc.robot.commands.mailbox.DeployPneumatics; import frc.robot.commands.mailbox.RunBelts; import frc.robot.subsystems.Drive; @@ -53,9 +54,6 @@ public class RobotContainer { /** Singleton instance of {@link Mailbox} for the whole robot. */ public static Mailbox mailbox = new Mailbox(); - /** Singleton instance of {@link DeindexNote} for the whole robot. */ - public static DeindexNote deindexNote = new DeindexNote(); - /** Singleton instance of {@link Intake} for the whole robot. */ public static Intake intake = new Intake(); @@ -70,6 +68,8 @@ public class RobotContainer { 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 RunIntake runIntake = new RunIntake(); /* From a57836d4aba9aab08f4835eb791e6fd29e49a5ad Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:29:19 -0600 Subject: [PATCH 16/29] Added FireNote.java --- .../commands/mailbox/DeployPneumatics.java | 1 + .../frc/robot/commands/mailbox/FireNote.java | 21 ++++++++ .../robot/commands/mailbox/OutputNote.java | 48 ------------------- .../commands/mailbox/RetractPneumatics.java | 40 ---------------- 4 files changed, 22 insertions(+), 88 deletions(-) create mode 100644 src/main/java/frc/robot/commands/mailbox/FireNote.java delete mode 100644 src/main/java/frc/robot/commands/mailbox/OutputNote.java delete mode 100644 src/main/java/frc/robot/commands/mailbox/RetractPneumatics.java diff --git a/src/main/java/frc/robot/commands/mailbox/DeployPneumatics.java b/src/main/java/frc/robot/commands/mailbox/DeployPneumatics.java index 69d2ceeb..ba7e9483 100644 --- a/src/main/java/frc/robot/commands/mailbox/DeployPneumatics.java +++ b/src/main/java/frc/robot/commands/mailbox/DeployPneumatics.java @@ -38,6 +38,7 @@ public void execute() {} // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { + mailboxPneumatics.retract(); } // Returns true when the command should end. diff --git a/src/main/java/frc/robot/commands/mailbox/FireNote.java b/src/main/java/frc/robot/commands/mailbox/FireNote.java new file mode 100644 index 00000000..34842fad --- /dev/null +++ b/src/main/java/frc/robot/commands/mailbox/FireNote.java @@ -0,0 +1,21 @@ +// 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. + +package frc.robot.commands.mailbox; + +import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; +import frc.robot.RobotContainer; + +// NOTE: Consider using this command inline, rather than writing a subclass. For more +// information, see: +// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html +public class FireNote extends ParallelCommandGroup { + /** Creates a new FireNote. */ + public FireNote() { + // Add your commands in the addCommands() call, e.g. + // addCommands(new FooCommand(), new BarCommand()); + addCommands(new DeployMailbox(), new DeindexNote()); + } + +} diff --git a/src/main/java/frc/robot/commands/mailbox/OutputNote.java b/src/main/java/frc/robot/commands/mailbox/OutputNote.java deleted file mode 100644 index 3c9a18d9..00000000 --- a/src/main/java/frc/robot/commands/mailbox/OutputNote.java +++ /dev/null @@ -1,48 +0,0 @@ -// 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. - -package frc.robot.commands.mailbox; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.RobotContainer; -import frc.robot.subsystems.mailbox.Mailbox; -import frc.robot.subsystems.mailbox.MailboxBelts; -import frc.robot.subsystems.mailbox.MailboxPneumatics; - - - -public class OutputNote extends Command { - /** Creates a new OutputNote. */ - - private MailboxBelts mailboxBelts; - private MailboxPneumatics mailboxPneumatics; - private Mailbox mailbox; - - public OutputNote() { - - this.mailboxBelts = RobotContainer.mailboxBelts; - this.mailboxPneumatics = RobotContainer.mailboxPneumatics; - this.mailbox = RobotContainer.mailbox; - - addRequirements(mailboxBelts, mailboxPneumatics); - } - - // Called when the command is initially scheduled. - @Override - public void initialize() {} - - // Called every time the scheduler runs while the command is scheduled. - @Override - public void execute() {} - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) {} - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/commands/mailbox/RetractPneumatics.java b/src/main/java/frc/robot/commands/mailbox/RetractPneumatics.java deleted file mode 100644 index 61686690..00000000 --- a/src/main/java/frc/robot/commands/mailbox/RetractPneumatics.java +++ /dev/null @@ -1,40 +0,0 @@ -// 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. - -package frc.robot.commands.mailbox; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.RobotContainer; -import frc.robot.subsystems.mailbox.MailboxPneumatics; - -public class RetractPneumatics extends Command { - - private MailboxPneumatics mailboxPneumatics; - - /** Creates a new RetractPneumatics. */ - public RetractPneumatics() { - mailboxPneumatics = RobotContainer.mailboxPneumatics; - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - mailboxPneumatics.retract(); - } - - // Called every time the scheduler runs while the command is scheduled. - @Override - public void execute() {} - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) {} - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} From 5a0a7860a12dc54084427857a0d53b2382658076 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:36:56 -0600 Subject: [PATCH 17/29] XBox Controller fires note with Y --- src/main/java/frc/robot/RobotContainer.java | 4 +++- src/main/java/frc/robot/commands/mailbox/FireNote.java | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 64b37c1b..4bada2b3 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -22,6 +22,7 @@ import frc.robot.commands.mailbox.DeindexNote; import frc.robot.commands.mailbox.DeployMailbox; import frc.robot.commands.mailbox.DeployPneumatics; +import frc.robot.commands.mailbox.FireNote; import frc.robot.commands.mailbox.RunBelts; import frc.robot.subsystems.Drive; import frc.robot.subsystems.Intake; @@ -70,6 +71,7 @@ public class RobotContainer { private RunBelts runBelts = new RunBelts(); private DeployMailbox deployMailbox = new DeployMailbox(); private DeindexNote deindexNote = new DeindexNote(); + private FireNote fireNote = new FireNote(); private RunIntake runIntake = new RunIntake(); /* @@ -97,7 +99,7 @@ private void configureBindings() { driverController.x().onTrue(enterXMode); driverController.a().onTrue(runIntake); - driverController.y().onTrue(deployPneumatics); + driverController.y().onTrue(fireNote); } /** diff --git a/src/main/java/frc/robot/commands/mailbox/FireNote.java b/src/main/java/frc/robot/commands/mailbox/FireNote.java index 34842fad..8e0c7d62 100644 --- a/src/main/java/frc/robot/commands/mailbox/FireNote.java +++ b/src/main/java/frc/robot/commands/mailbox/FireNote.java @@ -7,14 +7,10 @@ import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; import frc.robot.RobotContainer; -// NOTE: Consider using this command inline, rather than writing a subclass. For more -// information, see: -// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html + public class FireNote extends ParallelCommandGroup { /** Creates a new FireNote. */ public FireNote() { - // Add your commands in the addCommands() call, e.g. - // addCommands(new FooCommand(), new BarCommand()); addCommands(new DeployMailbox(), new DeindexNote()); } From ec6912331504be6b4ea289c8b1ac69b3bd51ddf5 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:37:35 -0600 Subject: [PATCH 18/29] Removed unused class --- .../robot/commands/mailbox/RetractMailbox.java | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 src/main/java/frc/robot/commands/mailbox/RetractMailbox.java diff --git a/src/main/java/frc/robot/commands/mailbox/RetractMailbox.java b/src/main/java/frc/robot/commands/mailbox/RetractMailbox.java deleted file mode 100644 index 8e66b188..00000000 --- a/src/main/java/frc/robot/commands/mailbox/RetractMailbox.java +++ /dev/null @@ -1,15 +0,0 @@ -// 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. - -package frc.robot.commands.mailbox; - -import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; - -public class RetractMailbox extends ParallelCommandGroup { - /** Creates a new DeployMailbox. */ - public RetractMailbox() { - addCommands(new DeployPneumatics(), new RunBelts()); - } -} From d660fe88add003359d5285f48e9a9815bc5e1dd0 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:43:07 -0600 Subject: [PATCH 19/29] javadoc --- src/main/java/frc/robot/commands/mailbox/DeindexNote.java | 2 ++ src/main/java/frc/robot/commands/mailbox/FireNote.java | 2 +- src/main/java/frc/robot/subsystems/mailbox/Mailbox.java | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/commands/mailbox/DeindexNote.java b/src/main/java/frc/robot/commands/mailbox/DeindexNote.java index 09391cd6..16a98bdc 100644 --- a/src/main/java/frc/robot/commands/mailbox/DeindexNote.java +++ b/src/main/java/frc/robot/commands/mailbox/DeindexNote.java @@ -9,6 +9,7 @@ import frc.robot.subsystems.Intake; import frc.robot.subsystems.mailbox.Mailbox; +/** Outputs the note from the index belts into the mailbox belts. */ public class DeindexNote extends Command { private Intake intake; @@ -28,6 +29,7 @@ public void initialize() {} // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { + /* If the mailbox is fully raised, run the intake. */ if (mailbox.getLimitSwitch()) { intake.runIntake(); } diff --git a/src/main/java/frc/robot/commands/mailbox/FireNote.java b/src/main/java/frc/robot/commands/mailbox/FireNote.java index 8e0c7d62..0a1c019a 100644 --- a/src/main/java/frc/robot/commands/mailbox/FireNote.java +++ b/src/main/java/frc/robot/commands/mailbox/FireNote.java @@ -7,7 +7,7 @@ import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; import frc.robot.RobotContainer; - +/** Scores the note into the amp. Raises the mailbox, runs the mailbox belts, and then runs the index belts to send the note into the belts. */ public class FireNote extends ParallelCommandGroup { /** Creates a new FireNote. */ public FireNote() { diff --git a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java index ac6e2809..331f525c 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java +++ b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java @@ -18,6 +18,7 @@ /** Subsystem for the mailbox that outputs game pieces from our robot. */ public class Mailbox extends SubsystemBase { + /** Limit switch that detects when the mailbox is raised. */ private DigitalInput limitSwitch; /** Creates a new Mailbox. */ @@ -26,6 +27,9 @@ public Mailbox() { this.limitSwitch = new DigitalInput(Constants.Mailbox.MAILBOX_LIMIT_SWITCH_DIO_PORT); } + /** Gets the Mailbox Limit Switch's Value. + * @return true if the mailbox is fully raised. False otherwise. + */ public boolean getLimitSwitch() { return limitSwitch.get(); } From 3e58a28e2d6e3c226f23a4551df06e6c93fe0223 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:43:32 -0600 Subject: [PATCH 20/29] spotless --- src/main/java/frc/robot/Constants.java | 1 + .../frc/robot/commands/mailbox/DeindexNote.java | 7 +++++++ .../java/frc/robot/commands/mailbox/FireNote.java | 14 +++++++++++--- .../java/frc/robot/subsystems/mailbox/Mailbox.java | 4 +++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 6f1707d0..4a3bc168 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -29,6 +29,7 @@ public static class Mailbox { /** DIO Port ID for the Mailbox limit switch. */ public static final int MAILBOX_LIMIT_SWITCH_DIO_PORT = 0; } + /** Constants for the Pneumatics system. */ public static class MailboxPneumatics { /** The channel on the PCM for the forward direction on the left solenoid. */ diff --git a/src/main/java/frc/robot/commands/mailbox/DeindexNote.java b/src/main/java/frc/robot/commands/mailbox/DeindexNote.java index 16a98bdc..37d45433 100644 --- a/src/main/java/frc/robot/commands/mailbox/DeindexNote.java +++ b/src/main/java/frc/robot/commands/mailbox/DeindexNote.java @@ -2,6 +2,13 @@ // 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.commands.mailbox; import edu.wpi.first.wpilibj2.command.Command; diff --git a/src/main/java/frc/robot/commands/mailbox/FireNote.java b/src/main/java/frc/robot/commands/mailbox/FireNote.java index 0a1c019a..672a35a7 100644 --- a/src/main/java/frc/robot/commands/mailbox/FireNote.java +++ b/src/main/java/frc/robot/commands/mailbox/FireNote.java @@ -2,16 +2,24 @@ // 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.commands.mailbox; import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; -import frc.robot.RobotContainer; -/** Scores the note into the amp. Raises the mailbox, runs the mailbox belts, and then runs the index belts to send the note into the belts. */ +/** + * Scores the note into the amp. Raises the mailbox, runs the mailbox belts, and then runs the index + * belts to send the note into the belts. + */ public class FireNote extends ParallelCommandGroup { /** Creates a new FireNote. */ public FireNote() { addCommands(new DeployMailbox(), new DeindexNote()); } - } diff --git a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java index 331f525c..cf41bab6 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java +++ b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java @@ -27,7 +27,9 @@ public Mailbox() { this.limitSwitch = new DigitalInput(Constants.Mailbox.MAILBOX_LIMIT_SWITCH_DIO_PORT); } - /** Gets the Mailbox Limit Switch's Value. + /** + * Gets the Mailbox Limit Switch's Value. + * * @return true if the mailbox is fully raised. False otherwise. */ public boolean getLimitSwitch() { From 29e6ca2c332e906a164d71b901216dc74bf80753 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:49:33 -0600 Subject: [PATCH 21/29] fixed import --- 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 d47917db..a27f92ee 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -15,7 +15,7 @@ import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; -import frc.robot.commands.DeployPneumatics; +import frc.robot.commands.mailbox.DeployPneumatics; import frc.robot.commands.EnterXMode; import frc.robot.commands.RunIntake; import frc.robot.commands.mailbox.DeindexNote; From f133c7e0a223d80731a004b0fc9b53ef09923da7 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:50:11 -0600 Subject: [PATCH 22/29] spotless --- src/main/java/frc/robot/RobotContainer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index a27f92ee..176a1276 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -15,15 +15,15 @@ import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; -import frc.robot.commands.mailbox.DeployPneumatics; import frc.robot.commands.EnterXMode; import frc.robot.commands.RunIntake; +import frc.robot.commands.drive.DriveFieldOriented; +import frc.robot.commands.drive.DriveRobotOriented; import frc.robot.commands.mailbox.DeindexNote; import frc.robot.commands.mailbox.DeployMailbox; +import frc.robot.commands.mailbox.DeployPneumatics; import frc.robot.commands.mailbox.FireNote; import frc.robot.commands.mailbox.RunBelts; -import frc.robot.commands.drive.DriveFieldOriented; -import frc.robot.commands.drive.DriveRobotOriented; import frc.robot.subsystems.Drive; import frc.robot.subsystems.Intake; import frc.robot.subsystems.mailbox.Mailbox; From 17c3c8f94a1ef1dc7471d1a6684a9cadcb33aabb Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:01:26 -0600 Subject: [PATCH 23/29] spotless --- 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 c3bcf5e2..3e72a88f 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -27,8 +27,8 @@ import frc.robot.commands.mailbox.RunBelts; import frc.robot.subsystems.Drive; import frc.robot.subsystems.Intake; -import frc.robot.subsystems.mailbox.Mailbox; import frc.robot.subsystems.UrMom; +import frc.robot.subsystems.mailbox.Mailbox; import frc.robot.subsystems.mailbox.MailboxBelts; import frc.robot.subsystems.mailbox.MailboxPneumatics; From b4729e0f0cd00010af3eae739eb24b2c2b328cec Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:50:32 -0600 Subject: [PATCH 24/29] Renamed FireNote to FireNoteRoutine --- src/main/java/frc/robot/RobotContainer.java | 4 ++-- .../commands/mailbox/{FireNote.java => FireNoteRoutine.java} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/main/java/frc/robot/commands/mailbox/{FireNote.java => FireNoteRoutine.java} (91%) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 3e72a88f..2d9bf115 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -23,7 +23,7 @@ import frc.robot.commands.mailbox.DeindexNote; import frc.robot.commands.mailbox.DeployMailbox; import frc.robot.commands.mailbox.DeployPneumatics; -import frc.robot.commands.mailbox.FireNote; +import frc.robot.commands.mailbox.FireNoteRoutine; import frc.robot.commands.mailbox.RunBelts; import frc.robot.subsystems.Drive; import frc.robot.subsystems.Intake; @@ -76,7 +76,7 @@ public class RobotContainer { private RunBelts runBelts = new RunBelts(); private DeployMailbox deployMailbox = new DeployMailbox(); private DeindexNote deindexNote = new DeindexNote(); - private FireNote fireNote = new FireNote(); + private FireNoteRoutine fireNote = new FireNoteRoutine(); private RunIntake runIntake = new RunIntake(); private DeployUrMom deployUrMom = new DeployUrMom(); diff --git a/src/main/java/frc/robot/commands/mailbox/FireNote.java b/src/main/java/frc/robot/commands/mailbox/FireNoteRoutine.java similarity index 91% rename from src/main/java/frc/robot/commands/mailbox/FireNote.java rename to src/main/java/frc/robot/commands/mailbox/FireNoteRoutine.java index 672a35a7..4d32786d 100644 --- a/src/main/java/frc/robot/commands/mailbox/FireNote.java +++ b/src/main/java/frc/robot/commands/mailbox/FireNoteRoutine.java @@ -17,9 +17,9 @@ * Scores the note into the amp. Raises the mailbox, runs the mailbox belts, and then runs the index * belts to send the note into the belts. */ -public class FireNote extends ParallelCommandGroup { +public class FireNoteRoutine extends ParallelCommandGroup { /** Creates a new FireNote. */ - public FireNote() { + public FireNoteRoutine() { addCommands(new DeployMailbox(), new DeindexNote()); } } From da587394e66a8fee6441fef18047f2f43dffac38 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:51:19 -0600 Subject: [PATCH 25/29] Added javadoc --- src/main/java/frc/robot/subsystems/mailbox/Mailbox.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java index cf41bab6..18f62469 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java +++ b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java @@ -23,12 +23,11 @@ public class Mailbox extends SubsystemBase { /** Creates a new Mailbox. */ public Mailbox() { - this.limitSwitch = new DigitalInput(Constants.Mailbox.MAILBOX_LIMIT_SWITCH_DIO_PORT); } /** - * Gets the Mailbox Limit Switch's Value. + * Gets the Mailbox Limit Switch's Value. Assumes the limitSwitch reports false when open. * * @return true if the mailbox is fully raised. False otherwise. */ From ad1a3ae6fd198eb4c2b5e1f2e4c210abaf9f3aca Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Mon, 5 Feb 2024 15:00:24 -0600 Subject: [PATCH 26/29] Added comment --- src/main/java/frc/robot/subsystems/mailbox/Mailbox.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java index 18f62469..8a47653c 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java +++ b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java @@ -32,6 +32,7 @@ public Mailbox() { * @return true if the mailbox is fully raised. False otherwise. */ public boolean getLimitSwitch() { + /* Assumes the limit switch is wired to be normally open. */ return limitSwitch.get(); } From 40718d27b7827ce044f09e43ec84fcbb9483faed Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Mon, 5 Feb 2024 15:53:21 -0600 Subject: [PATCH 27/29] capitilization --- src/main/java/frc/robot/subsystems/mailbox/Mailbox.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java index 8a47653c..51232f28 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java +++ b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java @@ -28,8 +28,8 @@ public Mailbox() { /** * Gets the Mailbox Limit Switch's Value. Assumes the limitSwitch reports false when open. - * - * @return true if the mailbox is fully raised. False otherwise. + * + * @return True if the mailbox is fully raised. False otherwise. */ public boolean getLimitSwitch() { /* Assumes the limit switch is wired to be normally open. */ From 889594d0ee1e66e2a14d32d878bc4849c2627817 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:04:19 -0600 Subject: [PATCH 28/29] spotless --- src/main/java/frc/robot/subsystems/mailbox/Mailbox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java index 51232f28..34140278 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java +++ b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java @@ -28,7 +28,7 @@ public Mailbox() { /** * Gets the Mailbox Limit Switch's Value. Assumes the limitSwitch reports false when open. - * + * * @return True if the mailbox is fully raised. False otherwise. */ public boolean getLimitSwitch() { From bc1f9c5200f2b641b313fd412a4ef8364aa5a492 Mon Sep 17 00:00:00 2001 From: Berdenson <91093973+Berdenson@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:10:49 -0600 Subject: [PATCH 29/29] javadoc --- src/main/java/frc/robot/subsystems/mailbox/Mailbox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java index 34140278..60d5c747 100644 --- a/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java +++ b/src/main/java/frc/robot/subsystems/mailbox/Mailbox.java @@ -27,7 +27,7 @@ public Mailbox() { } /** - * Gets the Mailbox Limit Switch's Value. Assumes the limitSwitch reports false when open. + * Gets the Mailbox Limit Switch's Value. * * @return True if the mailbox is fully raised. False otherwise. */