From 8e3703cde142d972d5c62e17105fa050d0dbdd9e Mon Sep 17 00:00:00 2001 From: Damir Lipovac Date: Sun, 10 Mar 2024 21:14:43 -0700 Subject: [PATCH 01/12] Fix PnuematicNumbers, Created Elevator tweaked the numbers for the pnuematics on the REVPH since they were changed today, also created controls and subsystem for the elevator. Please double check me since I probably screwed up somewhere --- src/main/java/frc/robot/Constants.java | 7 +-- .../frc/robot/commands/ElevatorControl.java | 51 +++++++++++++++++++ src/main/java/frc/robot/subsystems/Dump.java | 2 +- .../java/frc/robot/subsystems/Elevator.java | 40 +++++++++++++++ 4 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 src/main/java/frc/robot/commands/ElevatorControl.java create mode 100644 src/main/java/frc/robot/subsystems/Elevator.java diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index c9984f1..dfe1052 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -40,13 +40,14 @@ public static final class HardwareConstants { public static final class PneumaticsConstants { public static final class DumpConstants { // Uppy Downy solonoid - public static final int OUT = 1; - public static final int IN = 0; + public static final int OUT = 0; + public static final int IN = 15; } public static final class ElevatorConstants { // upy downy chain lift thing - + public static final int IN = 2; + public static final int OUT = 13; } } diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java new file mode 100644 index 0000000..63a99a3 --- /dev/null +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -0,0 +1,51 @@ +// 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.wpilibj.Joystick; +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.Constants.OperatorConstants; +import frc.robot.subsystems.Dump; +import frc.robot.subsystems.Elevator; + +public class ElevatorControl extends Command { + + private static Elevator Elevatorsubsystem; + + private static Joystick ElevatorJoystick = new Joystick(OperatorConstants.COPILOT_CONTROLLER); + + /** Creates a new PneumaticsControl. */ + public ElevatorControl(Elevator subsystem) { + ElevatorSubsystem = subsystem; + addRequirements(subsystem); + // 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() { + // TODO: Change this to the correct button + if (ElevatorJoystick.getRawButton(11)) { + ElevatorSubsystem.open(); + // TODO: Change this to the correct button + } else if (ElevatorJoystick.getRawButton(12)) { + ElevatorSubsystem.close(); + } + } + + // 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/subsystems/Dump.java b/src/main/java/frc/robot/subsystems/Dump.java index cf3ad1f..9cdda14 100644 --- a/src/main/java/frc/robot/subsystems/Dump.java +++ b/src/main/java/frc/robot/subsystems/Dump.java @@ -24,7 +24,7 @@ public class Dump extends SubsystemBase { /** Creates a new Pneumatics subsystem. */ public Dump() { - System.out.println("Pneumatics initialized"); + System.out.println("Pneumatic Dump initialized"); SmartDashboard.putBoolean(getName(), false); } diff --git a/src/main/java/frc/robot/subsystems/Elevator.java b/src/main/java/frc/robot/subsystems/Elevator.java new file mode 100644 index 0000000..4a710fe --- /dev/null +++ b/src/main/java/frc/robot/subsystems/Elevator.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.subsystems; + +import edu.wpi.first.math.proto.System; +import edu.wpi.first.wpilibj.DoubleSolenoid; +import edu.wpi.first.wpilibj.PneumaticsModuleType; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.Constants.HardwareConstants; +import frc.robot.Constants.PneumaticsConstants.ElevatorConstants; +import frc.robot.util.Time; + +public class Elevator { + +// double solenoid to control the pistons */ + private DoubleSolenoid doubleSolenoid = + new DoubleSolenoid( + HardwareConstants.REV_PH_ID, + PneumaticsModuleType.REVPH, + ElevatorConstants.IN, + ElevatorConstants.OUT); + + /** Create new pnuematic system */ + public elevator() { + System.out.println("Pneumatic Elevator initialized"); + SmartDashboard.putBoolean(getName(), false); + } +/** Open pistons to go up */ +public void open() { + doubleSolenoid.set(DoubleSolenoid.Value.kForward); + SmartDashboard.putBoolean(getName(), true); + } +/** Closes pistons to go down */ +public void close() { + doubleSolenoid.set(DoubleSolenoid.Value.kReverse); + SmartDashboard.putBoolean(getName(), false) +} \ No newline at end of file From 9637fe577bcfe88e99e77a891e310d9fb04eafb1 Mon Sep 17 00:00:00 2001 From: Damir Lipovac Date: Sun, 10 Mar 2024 23:22:40 -0700 Subject: [PATCH 02/12] added semicolen, and others added missing semicolen, also removed a unessiary line. *my spelling sucks --- src/main/java/frc/robot/commands/ElevatorControl.java | 1 - src/main/java/frc/robot/subsystems/Elevator.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index 63a99a3..f81f11e 100644 --- a/src/main/java/frc/robot/commands/ElevatorControl.java +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -7,7 +7,6 @@ import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.Constants.OperatorConstants; -import frc.robot.subsystems.Dump; import frc.robot.subsystems.Elevator; public class ElevatorControl extends Command { diff --git a/src/main/java/frc/robot/subsystems/Elevator.java b/src/main/java/frc/robot/subsystems/Elevator.java index 4a710fe..886e491 100644 --- a/src/main/java/frc/robot/subsystems/Elevator.java +++ b/src/main/java/frc/robot/subsystems/Elevator.java @@ -36,5 +36,5 @@ public void open() { /** Closes pistons to go down */ public void close() { doubleSolenoid.set(DoubleSolenoid.Value.kReverse); - SmartDashboard.putBoolean(getName(), false) + SmartDashboard.putBoolean(getName(), false); } \ No newline at end of file From c30254fd58ed32defc31cade7d6c389c1fb26d9c Mon Sep 17 00:00:00 2001 From: Damir Lipovac Date: Mon, 11 Mar 2024 07:30:13 -0700 Subject: [PATCH 03/12] added elevator stuff to Robot Container --- src/main/java/frc/robot/RobotContainer.java | 3 +++ src/main/java/frc/robot/commands/ElevatorControl.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 111f31f..f20756c 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -28,6 +28,7 @@ import frc.robot.subsystems.Dump; import frc.robot.subsystems.FlyWheel; import frc.robot.subsystems.Intake; +import frc.robot.subsystems.Elevator; import frc.robot.subsystems.swervedrive.SwerveSubsystem; import java.io.File; @@ -54,6 +55,7 @@ public class RobotContainer { private final Dump dump = new Dump(); private final Conveyor conveyor = new Conveyor(); private final FlyWheel flyWheel = new FlyWheel(); + private final Flywheel elevator = new elevator(); /** The container for the robot. Contains subsystems, OI devices, and commands. */ public RobotContainer() { @@ -62,6 +64,7 @@ public RobotContainer() { dump.setDefaultCommand(new DumpControl(dump)); conveyor.setDefaultCommand(new ConveyorCommand(conveyor)); flyWheel.setDefaultCommand(new FlyWCommand(flyWheel)); + elevator.setDefaultCommand(new ElevatorControl(elevator)); // Configure the trigger bindings configureBindings(); diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index f81f11e..4860c30 100644 --- a/src/main/java/frc/robot/commands/ElevatorControl.java +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -11,7 +11,7 @@ public class ElevatorControl extends Command { - private static Elevator Elevatorsubsystem; + private static Elevator ElevatorSubsystem; private static Joystick ElevatorJoystick = new Joystick(OperatorConstants.COPILOT_CONTROLLER); From acb27d49ed41bd66ed1419714877a64cd3019b84 Mon Sep 17 00:00:00 2001 From: Damir Lipovac Date: Mon, 11 Mar 2024 14:20:03 -0700 Subject: [PATCH 04/12] FIxing constants and adding things, --- src/main/java/frc/robot/Constants.java | 4 ++-- src/main/java/frc/robot/subsystems/Elevator.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index dfe1052..7284107 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -46,8 +46,8 @@ public static final class DumpConstants { public static final class ElevatorConstants { // upy downy chain lift thing - public static final int IN = 2; - public static final int OUT = 13; + public static final int IN = 3; + public static final int OUT = 8; } } diff --git a/src/main/java/frc/robot/subsystems/Elevator.java b/src/main/java/frc/robot/subsystems/Elevator.java index 886e491..48ba98c 100644 --- a/src/main/java/frc/robot/subsystems/Elevator.java +++ b/src/main/java/frc/robot/subsystems/Elevator.java @@ -13,7 +13,7 @@ import frc.robot.Constants.PneumaticsConstants.ElevatorConstants; import frc.robot.util.Time; -public class Elevator { +public class Elevator extends SubsystemBase { // double solenoid to control the pistons */ private DoubleSolenoid doubleSolenoid = @@ -24,7 +24,7 @@ public class Elevator { ElevatorConstants.OUT); /** Create new pnuematic system */ - public elevator() { + public Elevator() { System.out.println("Pneumatic Elevator initialized"); SmartDashboard.putBoolean(getName(), false); } @@ -37,4 +37,5 @@ public void open() { public void close() { doubleSolenoid.set(DoubleSolenoid.Value.kReverse); SmartDashboard.putBoolean(getName(), false); +} } \ No newline at end of file From 4e1e667b5864afaa0a5b859eca6ce42f8f1e6cb9 Mon Sep 17 00:00:00 2001 From: DLipovac93 Date: Mon, 11 Mar 2024 19:23:14 +0000 Subject: [PATCH 05/12] [Spotless] Apply formatting --- src/main/java/frc/robot/RobotContainer.java | 1 - .../frc/robot/commands/ElevatorControl.java | 4 +-- .../java/frc/robot/subsystems/Elevator.java | 29 ++++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index f20756c..f4a5432 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -28,7 +28,6 @@ import frc.robot.subsystems.Dump; import frc.robot.subsystems.FlyWheel; import frc.robot.subsystems.Intake; -import frc.robot.subsystems.Elevator; import frc.robot.subsystems.swervedrive.SwerveSubsystem; import java.io.File; diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index 4860c30..b0a0ade 100644 --- a/src/main/java/frc/robot/commands/ElevatorControl.java +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -11,7 +11,7 @@ public class ElevatorControl extends Command { - private static Elevator ElevatorSubsystem; + private static Elevator ElevatorSubsystem; private static Joystick ElevatorJoystick = new Joystick(OperatorConstants.COPILOT_CONTROLLER); @@ -21,7 +21,7 @@ public ElevatorControl(Elevator subsystem) { addRequirements(subsystem); // Use addRequirements() here to declare subsystem dependencies. } - + // Called when the command is initially scheduled. @Override public void initialize() {} diff --git a/src/main/java/frc/robot/subsystems/Elevator.java b/src/main/java/frc/robot/subsystems/Elevator.java index 48ba98c..5a3bb61 100644 --- a/src/main/java/frc/robot/subsystems/Elevator.java +++ b/src/main/java/frc/robot/subsystems/Elevator.java @@ -11,31 +11,32 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants.HardwareConstants; import frc.robot.Constants.PneumaticsConstants.ElevatorConstants; -import frc.robot.util.Time; public class Elevator extends SubsystemBase { - -// double solenoid to control the pistons */ - private DoubleSolenoid doubleSolenoid = + + // double solenoid to control the pistons */ + private DoubleSolenoid doubleSolenoid = new DoubleSolenoid( HardwareConstants.REV_PH_ID, PneumaticsModuleType.REVPH, ElevatorConstants.IN, ElevatorConstants.OUT); - /** Create new pnuematic system */ - public Elevator() { - System.out.println("Pneumatic Elevator initialized"); + /** Create new pnuematic system */ + public Elevator() { + System.out.println("Pneumatic Elevator initialized"); SmartDashboard.putBoolean(getName(), false); - } -/** Open pistons to go up */ -public void open() { + } + + /** Open pistons to go up */ + public void open() { doubleSolenoid.set(DoubleSolenoid.Value.kForward); SmartDashboard.putBoolean(getName(), true); - } -/** Closes pistons to go down */ -public void close() { + } + + /** Closes pistons to go down */ + public void close() { doubleSolenoid.set(DoubleSolenoid.Value.kReverse); SmartDashboard.putBoolean(getName(), false); + } } -} \ No newline at end of file From 9dc2ba27d4e9be0b33498452f2d98202feef64ed Mon Sep 17 00:00:00 2001 From: OakvilleDynamicsProgrammer Date: Mon, 11 Mar 2024 15:25:43 -0500 Subject: [PATCH 06/12] Fixed Red Lines Fixed all of the redlines, not sure if it works as the bot is in multiple pieces at the time of this commit being made. --- src/main/java/frc/robot/RobotContainer.java | 12 +++++++----- src/main/java/frc/robot/subsystems/Elevator.java | 3 +-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index f4a5432..a0d374d 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -21,14 +21,16 @@ import frc.robot.Constants.OperatorConstants; import frc.robot.commands.ConveyorCommand; import frc.robot.commands.DumpControl; -import frc.robot.commands.FlyWCommand; import frc.robot.commands.IntakeCommand; import frc.robot.commands.swervedrive.drivebase.AbsoluteDriveAdv; import frc.robot.subsystems.Conveyor; import frc.robot.subsystems.Dump; -import frc.robot.subsystems.FlyWheel; import frc.robot.subsystems.Intake; import frc.robot.subsystems.swervedrive.SwerveSubsystem; +import frc.robot.commands.FlyWCommand; +import frc.robot.commands.ElevatorControl; +import frc.robot.subsystems.Elevator; +import frc.robot.subsystems.FlyWheel; import java.io.File; /** @@ -53,8 +55,8 @@ public class RobotContainer { private final Intake intake = new Intake(); private final Dump dump = new Dump(); private final Conveyor conveyor = new Conveyor(); - private final FlyWheel flyWheel = new FlyWheel(); - private final Flywheel elevator = new elevator(); + private final FlyWheel FlyWheel = new FlyWheel(); + private final Elevator elevator = new Elevator(); /** The container for the robot. Contains subsystems, OI devices, and commands. */ public RobotContainer() { @@ -62,7 +64,7 @@ public RobotContainer() { intake.setDefaultCommand(new IntakeCommand(intake)); dump.setDefaultCommand(new DumpControl(dump)); conveyor.setDefaultCommand(new ConveyorCommand(conveyor)); - flyWheel.setDefaultCommand(new FlyWCommand(flyWheel)); + FlyWheel.setDefaultCommand(new FlyWCommand(FlyWheel)); elevator.setDefaultCommand(new ElevatorControl(elevator)); // Configure the trigger bindings diff --git a/src/main/java/frc/robot/subsystems/Elevator.java b/src/main/java/frc/robot/subsystems/Elevator.java index 5a3bb61..b7fd9fe 100644 --- a/src/main/java/frc/robot/subsystems/Elevator.java +++ b/src/main/java/frc/robot/subsystems/Elevator.java @@ -4,7 +4,6 @@ package frc.robot.subsystems; -import edu.wpi.first.math.proto.System; import edu.wpi.first.wpilibj.DoubleSolenoid; import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; @@ -24,7 +23,7 @@ public class Elevator extends SubsystemBase { /** Create new pnuematic system */ public Elevator() { - System.out.println("Pneumatic Elevator initialized"); + System.out.println("Elevator Initialized"); SmartDashboard.putBoolean(getName(), false); } From 8f176ec386cd9089e864e05f53f4caae804d1363 Mon Sep 17 00:00:00 2001 From: EuphoniumPlayer Date: Mon, 11 Mar 2024 20:26:35 +0000 Subject: [PATCH 07/12] [Spotless] Apply formatting --- src/main/java/frc/robot/RobotContainer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index a0d374d..8762e98 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -21,16 +21,16 @@ import frc.robot.Constants.OperatorConstants; import frc.robot.commands.ConveyorCommand; import frc.robot.commands.DumpControl; +import frc.robot.commands.ElevatorControl; +import frc.robot.commands.FlyWCommand; import frc.robot.commands.IntakeCommand; import frc.robot.commands.swervedrive.drivebase.AbsoluteDriveAdv; import frc.robot.subsystems.Conveyor; import frc.robot.subsystems.Dump; -import frc.robot.subsystems.Intake; -import frc.robot.subsystems.swervedrive.SwerveSubsystem; -import frc.robot.commands.FlyWCommand; -import frc.robot.commands.ElevatorControl; import frc.robot.subsystems.Elevator; import frc.robot.subsystems.FlyWheel; +import frc.robot.subsystems.Intake; +import frc.robot.subsystems.swervedrive.SwerveSubsystem; import java.io.File; /** From badab7c95a30b43c51331b916e372902aecbb483 Mon Sep 17 00:00:00 2001 From: OakvilleDynamicsProgrammer Date: Mon, 11 Mar 2024 15:29:08 -0500 Subject: [PATCH 08/12] Fixed Additional Redlines More fixed, still not tested as of the time of committing --- src/main/java/frc/robot/RobotContainer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index a0d374d..8762e98 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -21,16 +21,16 @@ import frc.robot.Constants.OperatorConstants; import frc.robot.commands.ConveyorCommand; import frc.robot.commands.DumpControl; +import frc.robot.commands.ElevatorControl; +import frc.robot.commands.FlyWCommand; import frc.robot.commands.IntakeCommand; import frc.robot.commands.swervedrive.drivebase.AbsoluteDriveAdv; import frc.robot.subsystems.Conveyor; import frc.robot.subsystems.Dump; -import frc.robot.subsystems.Intake; -import frc.robot.subsystems.swervedrive.SwerveSubsystem; -import frc.robot.commands.FlyWCommand; -import frc.robot.commands.ElevatorControl; import frc.robot.subsystems.Elevator; import frc.robot.subsystems.FlyWheel; +import frc.robot.subsystems.Intake; +import frc.robot.subsystems.swervedrive.SwerveSubsystem; import java.io.File; /** From c93b010b1d496c178cc8ddcc171a4070a73840c3 Mon Sep 17 00:00:00 2001 From: OakvilleDynamicsProgrammer Date: Mon, 11 Mar 2024 16:35:38 -0500 Subject: [PATCH 09/12] Squashed commit of the following: commit 3767375703cd5df339565f259a6299b9efb01cef Author: EuphoniumPlayer Date: Sun Mar 10 12:40:05 2024 -0500 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 commit 5f8df6452dbfa525c9a94aadc6c10d7bcf3d489e Author: OakvilleDynamicsProgramer <159196208+OakvilleDynamicsProgrammer@users.noreply.github.com> Date: Fri Mar 8 18:04:01 2024 -0600 Fixed Conveyor Direction STILL NEEDS REVIEW WITH BOTH BELTS FUNCTIONAL! But it seems that the problem is fixed. commit a35a082d4ede92882dc1dd2914c48535c94cbc36 Author: OakvilleDynamicsProgramer <159196208+OakvilleDynamicsProgrammer@users.noreply.github.com> Date: Fri Mar 8 17:55:44 2024 -0600 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. commit d1c991a852f6b98e93acb1e9a8ad04d1c98006b4 Author: EuphoniumPlayer Date: Thu Mar 7 21:34:02 2024 -0600 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. commit 3c9240e1954da6c8323c48c6eb7f717b3a419425 Author: EuphoniumPlayer Date: Thu Mar 7 17:36:07 2024 -0600 Implement full speed Full speed (100%) is now default forward POV speed (not 65%). To go 65% speed, press button 12. commit 100b174f67a4858f020d4c2230449a806999c7d0 Author: EuphoniumPlayer Date: Tue Mar 5 20:14:59 2024 -0600 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). commit bb112616e746204b040fc38493cad92e0999b429 Merge: 43ecc28 624c997 Author: EuphoniumPlayer Date: Tue Mar 5 19:59:54 2024 -0600 Updated Remap commit 43ecc2823769a14a909320957ad8ff42db2b364d Author: EuphoniumPlayer Date: Tue Mar 5 19:19:29 2024 -0600 Renamed Joystick for Clarity Matched the name of the joystick in the FlyWCommand class to match the pattern found within all other Command classes. commit bef3f9192429c5bd5f1a24914fb8cf1f1d68ba9b Author: EuphoniumPlayer Date: Tue Mar 5 19:14:04 2024 -0600 Buttons remapped All buttons for intake control have been remapped as suggested by Andrew. commit 29b49bda6023bf64b10cb408be469d387099bc54 Merge: e5c8162 32b7e6d Author: EuphoniumPlayer Date: Tue Mar 5 17:46:00 2024 -0600 Merge branch 'Temporary-copy-to-add-flywheels-to-remap' into remap-intake-buttons commit e5c8162195d8987f2865363d6c9a16110d5d0bfd Author: OakvilleDynamicsProgrammer Date: Tue Mar 5 15:56:03 2024 -0600 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). --- .vscode/launch.json | 12 ++++++--- src/main/java/frc/robot/Constants.java | 7 +++--- .../frc/robot/commands/ConveyorCommand.java | 14 +++++------ .../java/frc/robot/commands/DumpControl.java | 2 -- .../java/frc/robot/commands/FlyWCommand.java | 21 +++++++++------- .../frc/robot/commands/IntakeCommand.java | 25 +++++++++++++------ .../java/frc/robot/subsystems/Conveyor.java | 2 +- src/main/java/frc/robot/subsystems/Dump.java | 4 +-- .../java/frc/robot/subsystems/FlyWheel.java | 16 ++++++++---- .../java/frc/robot/subsystems/Intake.java | 15 ++++++++--- 10 files changed, 75 insertions(+), 43 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/Constants.java b/src/main/java/frc/robot/Constants.java index 7284107..e0b7445 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -83,8 +83,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 @@ -92,7 +92,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/ConveyorCommand.java b/src/main/java/frc/robot/commands/ConveyorCommand.java index 1ac0685..fdcb2c2 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; @@ -24,11 +25,10 @@ public void initialize() {} @Override public void execute() { - // TODO: Change this to the correct button - if (ConveyorJoystick.getRawButton(6) == true) { - m_ConveyorSubsystem.enableConveyor(); - // TODO: Change this to the correct button - } else if (ConveyorJoystick.getRawButton(5) == true) { + if (ConveyorJoystick.getRawButton(5) == true | ConveyorJoystick.getRawButton(3) == true) { + m_ConveyorSubsystem.intakeConveyor(); + } else if (ConveyorJoystick.getRawButton(6) == true + | ConveyorJoystick.getRawButton(4) == true) { m_ConveyorSubsystem.reverseConveyor(); System.out.println("Conveyor Moving in Reverse"); } else { @@ -39,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/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 a2e1d0e..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 ConveyorJoystick = new Joystick(1); + private final Joystick FlyWJoystick = new Joystick(OperatorConstants.COPILOT_CONTROLLER); public FlyWCommand(FlyWheel subsystem) { m_FlyWSubsystem = subsystem; @@ -24,15 +25,17 @@ public void initialize() {} @Override public void execute() { - // TODO: Change this to the correct button - if (ConveyorJoystick.getRawButton(7) == true) { - m_FlyWSubsystem.enableflywheelfast(); - // TODO: Change this to the correct button - } else if (ConveyorJoystick.getRawButton(8) == true) { + 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(); + } else if (FlyWJoystick.getRawButton(12) == true) { + m_FlyWSubsystem.enableflywheelreduced(); + } 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/commands/IntakeCommand.java b/src/main/java/frc/robot/commands/IntakeCommand.java index 995114f..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; @@ -24,13 +25,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 +47,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/Conveyor.java b/src/main/java/frc/robot/subsystems/Conveyor.java index 1e453cf..4e81f2a 100644 --- a/src/main/java/frc/robot/subsystems/Conveyor.java +++ b/src/main/java/frc/robot/subsystems/Conveyor.java @@ -23,7 +23,7 @@ public Conveyor() { } /** Sets the Conveyor motors to 100% power. */ - public void enableConveyor() { + public void intakeConveyor() { conveyorMotor1.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); conveyorMotor2.set(MechanismConstants.CONVEYOR_MOTOR_SPEED); } diff --git a/src/main/java/frc/robot/subsystems/Dump.java b/src/main/java/frc/robot/subsystems/Dump.java index 9cdda14..5c9f02e 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); } diff --git a/src/main/java/frc/robot/subsystems/FlyWheel.java b/src/main/java/frc/robot/subsystems/FlyWheel.java index df05dae..60a1a76 100644 --- a/src/main/java/frc/robot/subsystems/FlyWheel.java +++ b/src/main/java/frc/robot/subsystems/FlyWheel.java @@ -23,13 +23,19 @@ 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 */ - public void enableflywheelslow() { + /** 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 enableflywheellow() { 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 bc1d46e..56ce047 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,8 +46,12 @@ 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); + } + + /** Sets the front intake motors to -100% power (Reverse direction) */ + public void reverseIntakeFront() { intakeFront.set(-MechanismConstants.INTAKE_MOTOR_SPEED_FRONT); } From 89a1899274aad5a0066d15531d8452143a4716eb Mon Sep 17 00:00:00 2001 From: OakvilleDynamicsProgrammer Date: Mon, 11 Mar 2024 16:44:36 -0500 Subject: [PATCH 10/12] Added elevator controls Elevator control systems still need to be implemented, but the control values have been implemented --- src/main/java/frc/robot/commands/ElevatorControl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index b0a0ade..4d6e738 100644 --- a/src/main/java/frc/robot/commands/ElevatorControl.java +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -29,11 +29,9 @@ 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 (ElevatorJoystick.getRawButton(11)) { + if (ElevatorJoystick.getThrottle() <= 15) { ElevatorSubsystem.open(); - // TODO: Change this to the correct button - } else if (ElevatorJoystick.getRawButton(12)) { + } else if (ElevatorJoystick.getThrottle() >= 85) { ElevatorSubsystem.close(); } } From a3f9d38434963aced1081f9375220a78aee1df83 Mon Sep 17 00:00:00 2001 From: OakvilleDynamicsProgrammer Date: Mon, 11 Mar 2024 16:48:18 -0500 Subject: [PATCH 11/12] Sensible names Made the action names for moving the bot "up" and "down" instead of "open" and "closed" --- src/main/java/frc/robot/commands/ElevatorControl.java | 4 ++-- src/main/java/frc/robot/subsystems/Elevator.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index 4d6e738..2d4d352 100644 --- a/src/main/java/frc/robot/commands/ElevatorControl.java +++ b/src/main/java/frc/robot/commands/ElevatorControl.java @@ -30,9 +30,9 @@ public void initialize() {} @Override public void execute() { if (ElevatorJoystick.getThrottle() <= 15) { - ElevatorSubsystem.open(); + ElevatorSubsystem.up(); } else if (ElevatorJoystick.getThrottle() >= 85) { - ElevatorSubsystem.close(); + ElevatorSubsystem.down(); } } diff --git a/src/main/java/frc/robot/subsystems/Elevator.java b/src/main/java/frc/robot/subsystems/Elevator.java index b7fd9fe..b8b4633 100644 --- a/src/main/java/frc/robot/subsystems/Elevator.java +++ b/src/main/java/frc/robot/subsystems/Elevator.java @@ -28,13 +28,13 @@ public Elevator() { } /** Open pistons to go up */ - public void open() { + public void up() { doubleSolenoid.set(DoubleSolenoid.Value.kForward); SmartDashboard.putBoolean(getName(), true); } /** Closes pistons to go down */ - public void close() { + public void down() { doubleSolenoid.set(DoubleSolenoid.Value.kReverse); SmartDashboard.putBoolean(getName(), false); } From 20c341223d186649455e7a95fff7b29fc54f1938 Mon Sep 17 00:00:00 2001 From: OakvilleDynamicsProgrammer <159196208+OakvilleDynamicsProgrammer@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:59:35 -0500 Subject: [PATCH 12/12] Updated Elevator Control #'s --- src/main/java/frc/robot/commands/ElevatorControl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/ElevatorControl.java b/src/main/java/frc/robot/commands/ElevatorControl.java index 2d4d352..1706da0 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() <= 15) { + if (ElevatorJoystick.getThrottle() <= -0.85) { ElevatorSubsystem.up(); - } else if (ElevatorJoystick.getThrottle() >= 85) { + } else if (ElevatorJoystick.getThrottle() >= 0.85) { ElevatorSubsystem.down(); } }