From e5c8162195d8987f2865363d6c9a16110d5d0bfd Mon Sep 17 00:00:00 2001 From: OakvilleDynamicsProgrammer Date: Tue, 5 Mar 2024 15:56:03 -0600 Subject: [PATCH 01/13] Buttons remapped The intake commands for the sushi rollers and the front rollers have been split up and assigned to different buttons. Sushi in: 5, Sushi out: 6, Front in, 3, Front out: 4. The conveyor runs in the appropriate direction for each button (5 & 3 in, 3 & 4 out). --- src/main/java/frc/robot/RobotContainer.java | 2 +- .../frc/robot/commands/ConveyorCommand.java | 5 ++--- .../frc/robot/commands/IntakeCommand.java | 22 +++++++++++++------ .../java/frc/robot/subsystems/Intake.java | 16 ++++++++++---- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index efc0c2b..3c2d612 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -102,7 +102,7 @@ public RobotContainer() { () -> MathUtil.applyDeadband(driverXbox.getLeftX(), OperatorConstants.LEFT_X_DEADBAND), () -> driverXbox.getRawAxis(2)); - drivebase.setDefaultCommand(closedAbsoluteDriveAdv); + drivebase.setDefaultCommand(driveFieldOrientedDirectAngle); } /** diff --git a/src/main/java/frc/robot/commands/ConveyorCommand.java b/src/main/java/frc/robot/commands/ConveyorCommand.java index 1ac0685..1ac4092 100644 --- a/src/main/java/frc/robot/commands/ConveyorCommand.java +++ b/src/main/java/frc/robot/commands/ConveyorCommand.java @@ -24,11 +24,10 @@ public void initialize() {} @Override public void execute() { - // TODO: Change this to the correct button - if (ConveyorJoystick.getRawButton(6) == true) { + if (ConveyorJoystick.getRawButton(5) == true | ConveyorJoystick.getRawButton(3) == true) { m_ConveyorSubsystem.enableConveyor(); // TODO: Change this to the correct button - } else if (ConveyorJoystick.getRawButton(5) == true) { + } else if (ConveyorJoystick.getRawButton(6) == true | ConveyorJoystick.getRawButton(4)) { m_ConveyorSubsystem.reverseConveyor(); System.out.println("Conveyor Moving in Reverse"); } else { diff --git a/src/main/java/frc/robot/commands/IntakeCommand.java b/src/main/java/frc/robot/commands/IntakeCommand.java index 995114f..ff0c9d9 100644 --- a/src/main/java/frc/robot/commands/IntakeCommand.java +++ b/src/main/java/frc/robot/commands/IntakeCommand.java @@ -24,13 +24,20 @@ public void initialize() {} @Override public void execute() { - // TODO: Change this to the correct button - if (IntakeJoystick.getRawButton(3) == true) { - m_intakeSubsystem.enableIntake(); - // TODO: Change this to the correct button + if (IntakeJoystick.getRawButton(5) == true) { + // sushi in + m_intakeSubsystem.enableIntakeSushi(); + } else if (IntakeJoystick.getRawButton(3) == true) { + // front in + m_intakeSubsystem.enableIntakeFront(); } else if (IntakeJoystick.getRawButton(4) == true) { - m_intakeSubsystem.reverseIntake(); - System.out.println("Intake Moving in Reverse"); + // front out + m_intakeSubsystem.reverseIntakeFront(); + System.out.println("Front Rollers Moving in Reverse"); + } else if (IntakeJoystick.getRawButton(6) == true) { + // sushi out + m_intakeSubsystem.reverseIntakeSushi(); + System.out.println("Sushi Rollers Moving in Reverse"); } else { m_intakeSubsystem.disableIntake(); } @@ -39,7 +46,8 @@ public void execute() { @Override public void end(boolean interrupted) { m_intakeSubsystem.disableIntake(); - m_intakeSubsystem.enableIntake(); + m_intakeSubsystem.enableIntakeSushi(); + m_intakeSubsystem.enableIntakeFront(); } @Override diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index bc1d46e..4587c61 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -28,9 +28,14 @@ public Intake() { intakeFront.setIdleMode(IdleMode.kBrake); } - /** Sets the intake motors to 100% power. */ - public void enableIntake() { + /** Sets the sushi motors to 100% power. */ + public void enableIntakeSushi() { intakeSushi.set(MechanismConstants.INTAKE_MOTOR_SPEED_SUSHI); + //intakeFront.set(MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); + } + + /** Sets the front intake motors to 100% power. */ + public void enableIntakeFront() { intakeFront.set(MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); } @@ -41,11 +46,14 @@ public void disableIntake() { } /** Sets the intake motors to -100% power. (Reverse direction) */ - public void reverseIntake() { + public void reverseIntakeSushi() { intakeSushi.set(-MechanismConstants.INTAKE_MOTOR_SPEED_SUSHI); - intakeFront.set(-MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); } + /** Sets the front intake motors to -100% power (Reverse direction) */ + public void reverseIntakeFront() { + intakeFront.set(-MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); + } @Override public void periodic() { // This method will be called once per scheduler run From bef3f9192429c5bd5f1a24914fb8cf1f1d68ba9b Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Tue, 5 Mar 2024 19:14:04 -0600 Subject: [PATCH 02/13] Buttons remapped All buttons for intake control have been remapped as suggested by Andrew. --- src/main/java/frc/robot/commands/FlyWCommand.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc/robot/commands/FlyWCommand.java b/src/main/java/frc/robot/commands/FlyWCommand.java index 7dde141..b71b62c 100644 --- a/src/main/java/frc/robot/commands/FlyWCommand.java +++ b/src/main/java/frc/robot/commands/FlyWCommand.java @@ -12,7 +12,7 @@ public class FlyWCommand extends Command { private final FlyWheel m_FlyWSubsystem; // controller // TODO: Change this to the correct controller - private final Joystick ConveyorJoystick = new Joystick(1); + private final Joystick Joystick = new Joystick(1); public FlyWCommand(FlyWheel subsystem) { m_FlyWSubsystem = subsystem; @@ -24,13 +24,11 @@ public void initialize() {} @Override public void execute() { - // TODO: Change this to the correct button - if (ConveyorJoystick.getRawButton(3) == true) { + if (Joystick.getPOV() != -1) { m_FlyWSubsystem.enableflywheel(); - // TODO: Change this to the correct button - } else if (ConveyorJoystick.getRawButton(4) == true) { + } else if (Joystick.getRawButton(7) == true) { m_FlyWSubsystem.reverseflywheel(); - System.out.println("Conveyor Moving in Reverse"); + System.out.println("Flywheels Moving in Reverse"); } else { m_FlyWSubsystem.disableflywheel(); } From 43ecc2823769a14a909320957ad8ff42db2b364d Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Tue, 5 Mar 2024 19:19:29 -0600 Subject: [PATCH 03/13] Renamed Joystick for Clarity Matched the name of the joystick in the FlyWCommand class to match the pattern found within all other Command classes. --- src/main/java/frc/robot/commands/FlyWCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/commands/FlyWCommand.java b/src/main/java/frc/robot/commands/FlyWCommand.java index b71b62c..c0a7d3e 100644 --- a/src/main/java/frc/robot/commands/FlyWCommand.java +++ b/src/main/java/frc/robot/commands/FlyWCommand.java @@ -12,7 +12,7 @@ public class FlyWCommand extends Command { private final FlyWheel m_FlyWSubsystem; // controller // TODO: Change this to the correct controller - private final Joystick Joystick = new Joystick(1); + private final Joystick FlyWJoystick = new Joystick(1); public FlyWCommand(FlyWheel subsystem) { m_FlyWSubsystem = subsystem; @@ -24,9 +24,9 @@ public void initialize() {} @Override public void execute() { - if (Joystick.getPOV() != -1) { + if (FlyWJoystick.getPOV() != -1) { m_FlyWSubsystem.enableflywheel(); - } else if (Joystick.getRawButton(7) == true) { + } else if (FlyWJoystick.getRawButton(7) == true) { m_FlyWSubsystem.reverseflywheel(); System.out.println("Flywheels Moving in Reverse"); } else { From 100b174f67a4858f020d4c2230449a806999c7d0 Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Tue, 5 Mar 2024 20:14:59 -0600 Subject: [PATCH 04/13] Flywheels remapped Upwards to the 45s and center is temporarily set to reduced speed until they clear to go full/adjusted speed. Downwards is 15% speed (center and 45s). Button 7 is reverse (reverse is set to 15% speed). --- src/main/java/frc/robot/Constants.java | 3 ++- src/main/java/frc/robot/commands/FlyWCommand.java | 10 +++++----- src/main/java/frc/robot/subsystems/FlyWheel.java | 14 ++++++++++---- src/main/java/frc/robot/subsystems/Intake.java | 5 +++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index c9984f1..683f0e5 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -91,7 +91,8 @@ public static class MechanismConstants { public static final int FLYWHEEL_MOTOR_2 = 4; public static final boolean FLYWHEEL_MOTOR_1_INVERTED = true; public static final boolean FLYWHEEL_MOTOR_2_INVERTED = false; - public static final double FLYWHEEL_MOTOR_SPEED = 1.0; + public static final double FLYWHEEL_MOTOR_FULL_SPEED = 1.0; + public static final double FLYWHEEL_MOTOR_REDUCED_SPEED = 0.65; public static final double FLYWHEEL_MOTOR_SPEED_SLOW = 0.15; } } diff --git a/src/main/java/frc/robot/commands/FlyWCommand.java b/src/main/java/frc/robot/commands/FlyWCommand.java index a6a3375..b155b23 100644 --- a/src/main/java/frc/robot/commands/FlyWCommand.java +++ b/src/main/java/frc/robot/commands/FlyWCommand.java @@ -24,13 +24,13 @@ public void initialize() {} @Override public void execute() { - if (FlyWJoystick.getPOV() != -1) { - m_FlyWSubsystem.enableflywheel(); + if (FlyWJoystick.getPOV() == 215 | FlyWJoystick.getPOV() == 0 | FlyWJoystick.getPOV() == 45) { + m_FlyWSubsystem.enableflywheelreduced(); + } else if (FlyWJoystick.getPOV() == 225 | FlyWJoystick.getPOV() == 180 | FlyWJoystick.getPOV() == 135) { + m_FlyWSubsystem.enableflywheelslow(); } else if (FlyWJoystick.getRawButton(7) == true) { m_FlyWSubsystem.reverseflywheel(); - System.out.println("Conveyor Moving in Reverse"); - } else if (ConveyorJoystick.getRawButton(9) == true) { - m_FlyWSubsystem.enableflywheelslow(); + System.out.println("Flywheels Moving in Reverse"); } else { m_FlyWSubsystem.disableflywheel(); } diff --git a/src/main/java/frc/robot/subsystems/FlyWheel.java b/src/main/java/frc/robot/subsystems/FlyWheel.java index df05dae..5c42ccc 100644 --- a/src/main/java/frc/robot/subsystems/FlyWheel.java +++ b/src/main/java/frc/robot/subsystems/FlyWheel.java @@ -23,12 +23,18 @@ public FlyWheel() { } /** Sets the flywheel motors to 100% power. */ - public void enableflywheelfast() { - flywheelMotor1.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED); - flywheelMotor2.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED); + public void enableflywheelfull() { + flywheelMotor1.set(MechanismConstants.FLYWHEEL_MOTOR_FULL_SPEED); + flywheelMotor2.set(MechanismConstants.FLYWHEEL_MOTOR_FULL_SPEED); } - /** Sets the flywheel motors to slow speed */ + /** Sets the flywheel speed to 65% power. */ + public void enableflywheelreduced() { + flywheelMotor1.set(MechanismConstants.FLYWHEEL_MOTOR_REDUCED_SPEED); + flywheelMotor2.set(MechanismConstants.FLYWHEEL_MOTOR_REDUCED_SPEED); + } + + /** Sets the flywheel motors to 15% */ public void enableflywheelslow() { flywheelMotor1.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED_SLOW); flywheelMotor2.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED_SLOW); diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index 4587c61..56ce047 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -31,9 +31,9 @@ public Intake() { /** Sets the sushi motors to 100% power. */ public void enableIntakeSushi() { intakeSushi.set(MechanismConstants.INTAKE_MOTOR_SPEED_SUSHI); - //intakeFront.set(MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); + // intakeFront.set(MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); } - + /** Sets the front intake motors to 100% power. */ public void enableIntakeFront() { intakeFront.set(MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); @@ -54,6 +54,7 @@ public void reverseIntakeSushi() { public void reverseIntakeFront() { intakeFront.set(-MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); } + @Override public void periodic() { // This method will be called once per scheduler run From 3c9240e1954da6c8323c48c6eb7f717b3a419425 Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Thu, 7 Mar 2024 17:36:07 -0600 Subject: [PATCH 05/13] Implement full speed Full speed (100%) is now default forward POV speed (not 65%). To go 65% speed, press button 12. --- src/main/java/frc/robot/commands/FlyWCommand.java | 6 ++++-- src/main/java/frc/robot/subsystems/FlyWheel.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/commands/FlyWCommand.java b/src/main/java/frc/robot/commands/FlyWCommand.java index b155b23..f45cc81 100644 --- a/src/main/java/frc/robot/commands/FlyWCommand.java +++ b/src/main/java/frc/robot/commands/FlyWCommand.java @@ -25,9 +25,11 @@ public void initialize() {} @Override public void execute() { if (FlyWJoystick.getPOV() == 215 | FlyWJoystick.getPOV() == 0 | FlyWJoystick.getPOV() == 45) { - m_FlyWSubsystem.enableflywheelreduced(); + m_FlyWSubsystem.enableflywheelfull(); } else if (FlyWJoystick.getPOV() == 225 | FlyWJoystick.getPOV() == 180 | FlyWJoystick.getPOV() == 135) { - m_FlyWSubsystem.enableflywheelslow(); + m_FlyWSubsystem.enableflywheellow(); + } else if (FlyWJoystick.getRawButton(12) == true) { + m_FlyWSubsystem.enableflywheelreduced(); } else if (FlyWJoystick.getRawButton(7) == true) { m_FlyWSubsystem.reverseflywheel(); System.out.println("Flywheels Moving in Reverse"); diff --git a/src/main/java/frc/robot/subsystems/FlyWheel.java b/src/main/java/frc/robot/subsystems/FlyWheel.java index 5c42ccc..60a1a76 100644 --- a/src/main/java/frc/robot/subsystems/FlyWheel.java +++ b/src/main/java/frc/robot/subsystems/FlyWheel.java @@ -35,7 +35,7 @@ public void enableflywheelreduced() { } /** Sets the flywheel motors to 15% */ - public void enableflywheelslow() { + public void enableflywheellow() { flywheelMotor1.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED_SLOW); flywheelMotor2.set(MechanismConstants.FLYWHEEL_MOTOR_SPEED_SLOW); } From d1c991a852f6b98e93acb1e9a8ad04d1c98006b4 Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Thu, 7 Mar 2024 21:34:02 -0600 Subject: [PATCH 06/13] Fixed a POV Value Typo "FlyWJoystick.getPOV() == >>>215<<<" has been corrected to "FlyWJoystick.getPOV() == >>>315<<<" in FlyWCommand.java. Additionally, some completed //TODO's have been cleared due to completion of their task in previous commits. --- .vscode/launch.json | 12 +++++++++--- .../java/frc/robot/commands/ConveyorCommand.java | 1 - src/main/java/frc/robot/commands/DumpControl.java | 2 -- src/main/java/frc/robot/commands/FlyWCommand.java | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index c9c9713..1f39ec5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,18 +4,24 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - + { + "type": "java", + "name": "Main", + "request": "launch", + "mainClass": "frc.robot.Main", + "projectName": "2024-Robot" + }, { "type": "wpilib", "name": "WPILib Desktop Debug", "request": "launch", - "desktop": true, + "desktop": true }, { "type": "wpilib", "name": "WPILib roboRIO Debug", "request": "launch", - "desktop": false, + "desktop": false } ] } diff --git a/src/main/java/frc/robot/commands/ConveyorCommand.java b/src/main/java/frc/robot/commands/ConveyorCommand.java index 1ac4092..cf86812 100644 --- a/src/main/java/frc/robot/commands/ConveyorCommand.java +++ b/src/main/java/frc/robot/commands/ConveyorCommand.java @@ -26,7 +26,6 @@ public void initialize() {} public void execute() { if (ConveyorJoystick.getRawButton(5) == true | ConveyorJoystick.getRawButton(3) == true) { m_ConveyorSubsystem.enableConveyor(); - // TODO: Change this to the correct button } else if (ConveyorJoystick.getRawButton(6) == true | ConveyorJoystick.getRawButton(4)) { m_ConveyorSubsystem.reverseConveyor(); System.out.println("Conveyor Moving in Reverse"); diff --git a/src/main/java/frc/robot/commands/DumpControl.java b/src/main/java/frc/robot/commands/DumpControl.java index 2bd1d0f..2bef950 100644 --- a/src/main/java/frc/robot/commands/DumpControl.java +++ b/src/main/java/frc/robot/commands/DumpControl.java @@ -29,10 +29,8 @@ public void initialize() {} // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - // TODO: Change this to the correct button if (DumpJoystick.getRawButton(1)) { DumpSubsystem.open(); - // TODO: Change this to the correct button } else if (DumpJoystick.getRawButton(2)) { DumpSubsystem.close(); } diff --git a/src/main/java/frc/robot/commands/FlyWCommand.java b/src/main/java/frc/robot/commands/FlyWCommand.java index f45cc81..a7643e5 100644 --- a/src/main/java/frc/robot/commands/FlyWCommand.java +++ b/src/main/java/frc/robot/commands/FlyWCommand.java @@ -24,7 +24,7 @@ public void initialize() {} @Override public void execute() { - if (FlyWJoystick.getPOV() == 215 | FlyWJoystick.getPOV() == 0 | FlyWJoystick.getPOV() == 45) { + if (FlyWJoystick.getPOV() == 315 | FlyWJoystick.getPOV() == 0 | FlyWJoystick.getPOV() == 45) { m_FlyWSubsystem.enableflywheelfull(); } else if (FlyWJoystick.getPOV() == 225 | FlyWJoystick.getPOV() == 180 | FlyWJoystick.getPOV() == 135) { m_FlyWSubsystem.enableflywheellow(); From a35a082d4ede92882dc1dd2914c48535c94cbc36 Mon Sep 17 00:00:00 2001 From: OakvilleDynamicsProgramer <159196208+OakvilleDynamicsProgrammer@users.noreply.github.com> Date: Fri, 8 Mar 2024 17:55:44 -0600 Subject: [PATCH 07/13] Fixed Dump Dump commands were flipped (fixed), openThenClose starts death spiral that disables the bot. As a result, openThenClose has been abandoned for the time being. --- src/main/java/frc/robot/commands/ConveyorCommand.java | 3 ++- src/main/java/frc/robot/commands/FlyWCommand.java | 7 +++++-- src/main/java/frc/robot/commands/IntakeCommand.java | 3 ++- src/main/java/frc/robot/subsystems/Dump.java | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc/robot/commands/ConveyorCommand.java b/src/main/java/frc/robot/commands/ConveyorCommand.java index cf86812..159e06b 100644 --- a/src/main/java/frc/robot/commands/ConveyorCommand.java +++ b/src/main/java/frc/robot/commands/ConveyorCommand.java @@ -6,13 +6,14 @@ import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.Constants.OperatorConstants; import frc.robot.subsystems.Conveyor; public class ConveyorCommand extends Command { private final Conveyor m_ConveyorSubsystem; // controller // TODO: Change this to the correct controller - private final Joystick ConveyorJoystick = new Joystick(1); + private final Joystick ConveyorJoystick = new Joystick(OperatorConstants.COPILOT_CONTROLLER); public ConveyorCommand(Conveyor subsystem) { m_ConveyorSubsystem = subsystem; diff --git a/src/main/java/frc/robot/commands/FlyWCommand.java b/src/main/java/frc/robot/commands/FlyWCommand.java index a7643e5..b8df780 100644 --- a/src/main/java/frc/robot/commands/FlyWCommand.java +++ b/src/main/java/frc/robot/commands/FlyWCommand.java @@ -6,13 +6,14 @@ import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.Constants.OperatorConstants; import frc.robot.subsystems.FlyWheel; public class FlyWCommand extends Command { private final FlyWheel m_FlyWSubsystem; // controller // TODO: Change this to the correct controller - private final Joystick FlyWJoystick = new Joystick(1); + private final Joystick FlyWJoystick = new Joystick(OperatorConstants.COPILOT_CONTROLLER); public FlyWCommand(FlyWheel subsystem) { m_FlyWSubsystem = subsystem; @@ -26,7 +27,9 @@ public void initialize() {} public void execute() { if (FlyWJoystick.getPOV() == 315 | FlyWJoystick.getPOV() == 0 | FlyWJoystick.getPOV() == 45) { m_FlyWSubsystem.enableflywheelfull(); - } else if (FlyWJoystick.getPOV() == 225 | FlyWJoystick.getPOV() == 180 | FlyWJoystick.getPOV() == 135) { + } else if (FlyWJoystick.getPOV() == 225 + | FlyWJoystick.getPOV() == 180 + | FlyWJoystick.getPOV() == 135) { m_FlyWSubsystem.enableflywheellow(); } else if (FlyWJoystick.getRawButton(12) == true) { m_FlyWSubsystem.enableflywheelreduced(); diff --git a/src/main/java/frc/robot/commands/IntakeCommand.java b/src/main/java/frc/robot/commands/IntakeCommand.java index ff0c9d9..91a7c32 100644 --- a/src/main/java/frc/robot/commands/IntakeCommand.java +++ b/src/main/java/frc/robot/commands/IntakeCommand.java @@ -6,13 +6,14 @@ import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.Constants.OperatorConstants; import frc.robot.subsystems.Intake; public class IntakeCommand extends Command { private final Intake m_intakeSubsystem; // controller // TODO: Change this to the correct controller - private final Joystick IntakeJoystick = new Joystick(1); + private final Joystick IntakeJoystick = new Joystick(OperatorConstants.COPILOT_CONTROLLER); public IntakeCommand(Intake subsystem) { m_intakeSubsystem = subsystem; diff --git a/src/main/java/frc/robot/subsystems/Dump.java b/src/main/java/frc/robot/subsystems/Dump.java index cf3ad1f..97be7f2 100644 --- a/src/main/java/frc/robot/subsystems/Dump.java +++ b/src/main/java/frc/robot/subsystems/Dump.java @@ -29,13 +29,13 @@ public Dump() { } /** Opens the piston */ - public void open() { + public void close() { doubleSolenoid.set(DoubleSolenoid.Value.kForward); SmartDashboard.putBoolean(getName(), true); } /** Closes the piston */ - public void close() { + public void open() { doubleSolenoid.set(DoubleSolenoid.Value.kReverse); SmartDashboard.putBoolean(getName(), false); } From 5f8df6452dbfa525c9a94aadc6c10d7bcf3d489e Mon Sep 17 00:00:00 2001 From: OakvilleDynamicsProgramer <159196208+OakvilleDynamicsProgrammer@users.noreply.github.com> Date: Fri, 8 Mar 2024 18:04:01 -0600 Subject: [PATCH 08/13] Fixed Conveyor Direction STILL NEEDS REVIEW WITH BOTH BELTS FUNCTIONAL! But it seems that the problem is fixed. --- src/main/java/frc/robot/commands/ConveyorCommand.java | 7 ++++--- src/main/java/frc/robot/subsystems/Conveyor.java | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/frc/robot/commands/ConveyorCommand.java b/src/main/java/frc/robot/commands/ConveyorCommand.java index 159e06b..fdcb2c2 100644 --- a/src/main/java/frc/robot/commands/ConveyorCommand.java +++ b/src/main/java/frc/robot/commands/ConveyorCommand.java @@ -26,8 +26,9 @@ public void initialize() {} @Override public void execute() { if (ConveyorJoystick.getRawButton(5) == true | ConveyorJoystick.getRawButton(3) == true) { - m_ConveyorSubsystem.enableConveyor(); - } else if (ConveyorJoystick.getRawButton(6) == true | ConveyorJoystick.getRawButton(4)) { + m_ConveyorSubsystem.intakeConveyor(); + } else if (ConveyorJoystick.getRawButton(6) == true + | ConveyorJoystick.getRawButton(4) == true) { m_ConveyorSubsystem.reverseConveyor(); System.out.println("Conveyor Moving in Reverse"); } else { @@ -38,7 +39,7 @@ public void execute() { @Override public void end(boolean interrupted) { m_ConveyorSubsystem.disableConveyor(); - m_ConveyorSubsystem.enableConveyor(); + m_ConveyorSubsystem.intakeConveyor(); } @Override diff --git a/src/main/java/frc/robot/subsystems/Conveyor.java b/src/main/java/frc/robot/subsystems/Conveyor.java index 1e453cf..745b04a 100644 --- a/src/main/java/frc/robot/subsystems/Conveyor.java +++ b/src/main/java/frc/robot/subsystems/Conveyor.java @@ -23,9 +23,9 @@ public Conveyor() { } /** Sets the Conveyor motors to 100% power. */ - public void enableConveyor() { - conveyorMotor1.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); - conveyorMotor2.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); + public void intakeConveyor() { + conveyorMotor1.set(-MechanismConstants.CONVEYOR_MOTOR_SPEED); + conveyorMotor2.set(-MechanismConstants.CONVEYOR_MOTOR_SPEED); } /** Sets the Conveyor motors to 0% power. */ @@ -36,8 +36,8 @@ public void disableConveyor() { /** Sets the Conveyor motors to -100% power. (Reverse direction) */ public void reverseConveyor() { - conveyorMotor1.set(-MechanismConstants.CONVEYOR_MOTOR_SPEED); - conveyorMotor2.set(-MechanismConstants.CONVEYOR_MOTOR_SPEED); + conveyorMotor1.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); + conveyorMotor2.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); } @Override From 3767375703cd5df339565f259a6299b9efb01cef Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Sun, 10 Mar 2024 12:40:05 -0500 Subject: [PATCH 09/13] Attempt to fix Conveyor Direction REQUIRES TESTING, IF IT DOES NOT WORK CHANGE CONVEYOR_MOTOR_1_INVERTED BACK TO TRUE AND 2 BACK TO FALSE --- src/main/java/frc/robot/Constants.java | 4 ++-- src/main/java/frc/robot/subsystems/Conveyor.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 683f0e5..042799c 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -82,8 +82,8 @@ public static class MechanismConstants { // Conveyor Motors public static final int CONVEYOR_MOTOR_1 = 1; public static final int CONVEYOR_MOTOR_2 = 2; - public static final boolean CONVEYOR_MOTOR_1_INVERTED = true; - public static final boolean CONVEYOR_MOTOR_2_INVERTED = false; + public static final boolean CONVEYOR_MOTOR_1_INVERTED = false; + public static final boolean CONVEYOR_MOTOR_2_INVERTED = true; public static final double CONVEYOR_MOTOR_SPEED = 0.38; // Flywheel Motors diff --git a/src/main/java/frc/robot/subsystems/Conveyor.java b/src/main/java/frc/robot/subsystems/Conveyor.java index 745b04a..4e81f2a 100644 --- a/src/main/java/frc/robot/subsystems/Conveyor.java +++ b/src/main/java/frc/robot/subsystems/Conveyor.java @@ -24,8 +24,8 @@ public Conveyor() { /** Sets the Conveyor motors to 100% power. */ public void intakeConveyor() { - conveyorMotor1.set(-MechanismConstants.CONVEYOR_MOTOR_SPEED); - conveyorMotor2.set(-MechanismConstants.CONVEYOR_MOTOR_SPEED); + conveyorMotor1.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); + conveyorMotor2.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); } /** Sets the Conveyor motors to 0% power. */ @@ -36,8 +36,8 @@ public void disableConveyor() { /** Sets the Conveyor motors to -100% power. (Reverse direction) */ public void reverseConveyor() { - conveyorMotor1.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); - conveyorMotor2.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); + conveyorMotor1.set(-MechanismConstants.CONVEYOR_MOTOR_SPEED); + conveyorMotor2.set(-MechanismConstants.CONVEYOR_MOTOR_SPEED); } @Override From c68fa81877f4590a5524ffb47a618d48ea973f89 Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Mon, 11 Mar 2024 21:29:42 -0500 Subject: [PATCH 10/13] Added backup buttons Added backup buttons for elevator control in the event that the throttle does not trigger actions correctly --- src/main/java/frc/robot/commands/ElevatorControl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index 1706da0..00f4300 100644 --- a/src/main/java/frc/robot/commands/ElevatorControl.java +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -33,6 +33,12 @@ public void execute() { ElevatorSubsystem.up(); } else if (ElevatorJoystick.getThrottle() >= 0.85) { ElevatorSubsystem.down(); + } else if (ElevatorJoystick.getRawButton(10)) { + ElevatorSubsystem.up(); + System.out.println("BACKUP ELEVATOR ASCENT ACTIVATED"); + } else if (ElevatorJoystick.getRawButton(9)) { + ElevatorSubsystem.down(); + System.out.println("BACKUP ELEVATOR DESCENT ACTIVATED"); } } From 2ede5f1779f7f7d24273d4b9a60cfdb13cb8edd1 Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Mon, 11 Mar 2024 21:35:46 -0500 Subject: [PATCH 11/13] Undid Previous Commit Kinda useless --- src/main/java/frc/robot/commands/ElevatorControl.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index 00f4300..1706da0 100644 --- a/src/main/java/frc/robot/commands/ElevatorControl.java +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -33,12 +33,6 @@ public void execute() { ElevatorSubsystem.up(); } else if (ElevatorJoystick.getThrottle() >= 0.85) { ElevatorSubsystem.down(); - } else if (ElevatorJoystick.getRawButton(10)) { - ElevatorSubsystem.up(); - System.out.println("BACKUP ELEVATOR ASCENT ACTIVATED"); - } else if (ElevatorJoystick.getRawButton(9)) { - ElevatorSubsystem.down(); - System.out.println("BACKUP ELEVATOR DESCENT ACTIVATED"); } } From 29661e51865c5a327dbb176c8768c43063e6f93b Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Mon, 11 Mar 2024 21:45:19 -0500 Subject: [PATCH 12/13] Removed a TODO Removed a TODO and an empty space --- src/main/java/frc/robot/commands/ConveyorCommand.java | 1 - src/main/java/frc/robot/commands/ElevatorControl.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/ConveyorCommand.java b/src/main/java/frc/robot/commands/ConveyorCommand.java index fdcb2c2..1883c3d 100644 --- a/src/main/java/frc/robot/commands/ConveyorCommand.java +++ b/src/main/java/frc/robot/commands/ConveyorCommand.java @@ -12,7 +12,6 @@ public class ConveyorCommand extends Command { private final Conveyor m_ConveyorSubsystem; // controller - // TODO: Change this to the correct controller private final Joystick ConveyorJoystick = new Joystick(OperatorConstants.COPILOT_CONTROLLER); public ConveyorCommand(Conveyor subsystem) { diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index 1706da0..9745c3a 100644 --- a/src/main/java/frc/robot/commands/ElevatorControl.java +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -45,4 +45,4 @@ public void end(boolean interrupted) {} public boolean isFinished() { return false; } -} +} \ No newline at end of file From 9be43bc58d7708ebe9310704c28a87b3db7f0493 Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Mon, 11 Mar 2024 22:06:57 -0500 Subject: [PATCH 13/13] Reformatted Input Detections Reformatted to make the if (true)'s less lengthy and messy. Additionally, the fly wheels now reverse from button 11 AND 7 (pulled it closer). One more thing, the conveyor can now be controlled separately from other parts of the intake by using button 9 to reverse it and button 10 to advance it. --- .../java/frc/robot/commands/ConveyorCommand.java | 5 ++--- .../java/frc/robot/commands/ElevatorControl.java | 6 +++--- .../java/frc/robot/commands/FlyWCommand.java | 10 ++++------ .../java/frc/robot/commands/IntakeCommand.java | 16 ++++++++-------- src/main/java/frc/robot/subsystems/Intake.java | 4 ++-- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/main/java/frc/robot/commands/ConveyorCommand.java b/src/main/java/frc/robot/commands/ConveyorCommand.java index 1883c3d..4997710 100644 --- a/src/main/java/frc/robot/commands/ConveyorCommand.java +++ b/src/main/java/frc/robot/commands/ConveyorCommand.java @@ -24,10 +24,9 @@ public void initialize() {} @Override public void execute() { - if (ConveyorJoystick.getRawButton(5) == true | ConveyorJoystick.getRawButton(3) == true) { + if (ConveyorJoystick.getRawButton(5 | 3 | 10)) { m_ConveyorSubsystem.intakeConveyor(); - } else if (ConveyorJoystick.getRawButton(6) == true - | ConveyorJoystick.getRawButton(4) == true) { + } else if (ConveyorJoystick.getRawButton(6 | 4 | 9)) { m_ConveyorSubsystem.reverseConveyor(); System.out.println("Conveyor Moving in Reverse"); } else { diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index 9745c3a..e23517a 100644 --- a/src/main/java/frc/robot/commands/ElevatorControl.java +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -29,9 +29,9 @@ public void initialize() {} // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if (ElevatorJoystick.getThrottle() <= -0.85) { + if (ElevatorJoystick.getThrottle() <= -0.75) { ElevatorSubsystem.up(); - } else if (ElevatorJoystick.getThrottle() >= 0.85) { + } else if (ElevatorJoystick.getThrottle() >= 0.75) { ElevatorSubsystem.down(); } } @@ -45,4 +45,4 @@ public void end(boolean interrupted) {} public boolean isFinished() { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/frc/robot/commands/FlyWCommand.java b/src/main/java/frc/robot/commands/FlyWCommand.java index b8df780..3b8b995 100644 --- a/src/main/java/frc/robot/commands/FlyWCommand.java +++ b/src/main/java/frc/robot/commands/FlyWCommand.java @@ -25,15 +25,13 @@ public void initialize() {} @Override public void execute() { - if (FlyWJoystick.getPOV() == 315 | FlyWJoystick.getPOV() == 0 | FlyWJoystick.getPOV() == 45) { + if (FlyWJoystick.getPOV() == (315 | 0 | 45)) { m_FlyWSubsystem.enableflywheelfull(); - } else if (FlyWJoystick.getPOV() == 225 - | FlyWJoystick.getPOV() == 180 - | FlyWJoystick.getPOV() == 135) { + } else if (FlyWJoystick.getPOV() == (225 | 180 | 135)) { m_FlyWSubsystem.enableflywheellow(); - } else if (FlyWJoystick.getRawButton(12) == true) { + } else if (FlyWJoystick.getRawButton(12)) { m_FlyWSubsystem.enableflywheelreduced(); - } else if (FlyWJoystick.getRawButton(7) == true) { + } else if (FlyWJoystick.getRawButton(11 | 7)) { m_FlyWSubsystem.reverseflywheel(); System.out.println("Flywheels Moving in Reverse"); } else { diff --git a/src/main/java/frc/robot/commands/IntakeCommand.java b/src/main/java/frc/robot/commands/IntakeCommand.java index 91a7c32..753e63e 100644 --- a/src/main/java/frc/robot/commands/IntakeCommand.java +++ b/src/main/java/frc/robot/commands/IntakeCommand.java @@ -25,18 +25,18 @@ public void initialize() {} @Override public void execute() { - if (IntakeJoystick.getRawButton(5) == true) { - // sushi in + if (IntakeJoystick.getRawButton(5)) { + // sushi + Conveyor in m_intakeSubsystem.enableIntakeSushi(); - } else if (IntakeJoystick.getRawButton(3) == true) { - // front in + } else if (IntakeJoystick.getRawButton(3)) { + // front + Conveyor in m_intakeSubsystem.enableIntakeFront(); - } else if (IntakeJoystick.getRawButton(4) == true) { - // front out + } else if (IntakeJoystick.getRawButton(4)) { + // front + Conveyor out m_intakeSubsystem.reverseIntakeFront(); System.out.println("Front Rollers Moving in Reverse"); - } else if (IntakeJoystick.getRawButton(6) == true) { - // sushi out + } else if (IntakeJoystick.getRawButton(6)) { + // sushi + Conveyor out m_intakeSubsystem.reverseIntakeSushi(); System.out.println("Sushi Rollers Moving in Reverse"); } else { diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index 56ce047..01acf35 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -39,13 +39,13 @@ public void enableIntakeFront() { intakeFront.set(MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); } - /** Sets the intake motors to 0% power. */ + /** Sets both intake motors to 0% power. */ public void disableIntake() { intakeSushi.set(0); intakeFront.set(0); } - /** Sets the intake motors to -100% power. (Reverse direction) */ + /** Sets the sushi motors to -100% power. (Reverse direction) */ public void reverseIntakeSushi() { intakeSushi.set(-MechanismConstants.INTAKE_MOTOR_SPEED_SUSHI); }