From 3d02d72ea745d389cf375e1837ed55cd9415db4e Mon Sep 17 00:00:00 2001 From: shay Date: Wed, 17 Jan 2024 20:31:15 +0200 Subject: [PATCH 01/28] trap speed command added trap speed command --- .../java/frc/robot/commands/setSpeedTrap.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/main/java/frc/robot/commands/setSpeedTrap.java diff --git a/src/main/java/frc/robot/commands/setSpeedTrap.java b/src/main/java/frc/robot/commands/setSpeedTrap.java new file mode 100644 index 0000000..4ebc496 --- /dev/null +++ b/src/main/java/frc/robot/commands/setSpeedTrap.java @@ -0,0 +1,41 @@ +// 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.subsystems.SubsystemTrap; + +public class setSpeedTrap extends Command { + private final SubsystemTrap subsystemTrap = SubsystemTrap.getInstance(); + private final + double speed; + /** Creates a new setSpeedTrap. */ + public setSpeedTrap(double speed) { + this.addRequirements(subsystemTrap); + this.speed = speed; + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + this.subsystemTrap.setSpeed(speed); + + } + + // 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 9b95c074a896abe11c91913aabcfa99957b46267 Mon Sep 17 00:00:00 2001 From: shay Date: Wed, 17 Jan 2024 20:31:58 +0200 Subject: [PATCH 02/28] trap subsystm added trap subsystem --- .../frc/robot/subsystems/SubsystemTrap.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/main/java/frc/robot/subsystems/SubsystemTrap.java diff --git a/src/main/java/frc/robot/subsystems/SubsystemTrap.java b/src/main/java/frc/robot/subsystems/SubsystemTrap.java new file mode 100644 index 0000000..31ca806 --- /dev/null +++ b/src/main/java/frc/robot/subsystems/SubsystemTrap.java @@ -0,0 +1,43 @@ +// 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 com.ctre.phoenix.motorcontrol.TalonSRXControlMode; +import com.ctre.phoenix.motorcontrol.can.TalonSRX; +import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; +import com.ctre.phoenix6.hardware.TalonFX; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; + +public class SubsystemTrap extends SubsystemBase { + private WPI_TalonSRX trapMotor; + double speed; + private static SubsystemTrap instance; + + public static SubsystemTrap getInstance() + { + if (instance == null) + { + instance = new SubsystemTrap(); + } + return instance; + } + + + /** Creates a new SubsystemTrap. */ + public SubsystemTrap() { + + } + public void setSpeed(double speed){ + trapMotor.set(speed); + + } + + + @Override + public void periodic() { + // This method will be called once per scheduler run + } +} From cc5c352491d34defc8837a7deae3767790222677 Mon Sep 17 00:00:00 2001 From: shay Date: Thu, 18 Jan 2024 00:42:03 +0200 Subject: [PATCH 03/28] set speed command to both climbing motors added command --- .../commands/ClimbingMotorsSetSpeed.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/java/frc/robot/commands/ClimbingMotorsSetSpeed.java diff --git a/src/main/java/frc/robot/commands/ClimbingMotorsSetSpeed.java b/src/main/java/frc/robot/commands/ClimbingMotorsSetSpeed.java new file mode 100644 index 0000000..38db2c6 --- /dev/null +++ b/src/main/java/frc/robot/commands/ClimbingMotorsSetSpeed.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.subsystems.ClimbingSubsystem; + +public class ClimbingMotorsSetSpeed extends Command { + private final ClimbingSubsystem climbingSubsystem = ClimbingSubsystem.getInstance(); + double speed; + /** Creates a new ClimbingMotorsSetSpeed. */ + public ClimbingMotorsSetSpeed(double speed) { + this.addRequirements(climbingSubsystem); + this.speed = speed; + + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + this.climbingSubsystem.setSpeedClimbing(speed); + } + + // 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 177e7456828735e66a76b408e9edbc52f9bf09bb Mon Sep 17 00:00:00 2001 From: shay Date: Thu, 18 Jan 2024 00:42:34 +0200 Subject: [PATCH 04/28] command to left motor climbing added left motor climbing command --- .../commands/LeftMotorClimbingSetSpeed.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/main/java/frc/robot/commands/LeftMotorClimbingSetSpeed.java diff --git a/src/main/java/frc/robot/commands/LeftMotorClimbingSetSpeed.java b/src/main/java/frc/robot/commands/LeftMotorClimbingSetSpeed.java new file mode 100644 index 0000000..a55d402 --- /dev/null +++ b/src/main/java/frc/robot/commands/LeftMotorClimbingSetSpeed.java @@ -0,0 +1,39 @@ +// 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.subsystems.ClimbingSubsystem; + +public class LeftMotorClimbingSetSpeed extends Command { + private final ClimbingSubsystem leftMotorClimbing = ClimbingSubsystem.getInstance(); + double speed; + /** Creates a new LeftMotorClimbingSetSpeed. */ + public LeftMotorClimbingSetSpeed(double speed) { + this.addRequirements(leftMotorClimbing); + this.speed = speed; + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + this.leftMotorClimbing.setSpeedClimbing(speed); + } + + // 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 1ae728e0e861af1bbde408b68ea6ef8a9d0c645b Mon Sep 17 00:00:00 2001 From: shay Date: Thu, 18 Jan 2024 00:42:54 +0200 Subject: [PATCH 05/28] right motor climbing command added right motor climbing command --- .../commands/RightMotorClimbingSetSpeed.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/java/frc/robot/commands/RightMotorClimbingSetSpeed.java diff --git a/src/main/java/frc/robot/commands/RightMotorClimbingSetSpeed.java b/src/main/java/frc/robot/commands/RightMotorClimbingSetSpeed.java new file mode 100644 index 0000000..9198cf0 --- /dev/null +++ b/src/main/java/frc/robot/commands/RightMotorClimbingSetSpeed.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.subsystems.ClimbingSubsystem; + +public class RightMotorClimbingSetSpeed extends Command { + private final ClimbingSubsystem rightMotorClimbing = ClimbingSubsystem.getInstance(); + double speed; + /** Creates a new RightMotorClimbingSetSpeed. */ + public RightMotorClimbingSetSpeed(double speed) { + this.addRequirements(rightMotorClimbing); + this.speed = speed; + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + this.rightMotorClimbing.setSpeedClimbing(speed); + + } + + // 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 8c4dbce0b3f31b8b5f4ffb12712c926f115a6c0a Mon Sep 17 00:00:00 2001 From: shay Date: Thu, 18 Jan 2024 00:43:39 +0200 Subject: [PATCH 06/28] set speed trap command added command to set speed trap command --- src/main/java/frc/robot/commands/setSpeedTrap.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/setSpeedTrap.java b/src/main/java/frc/robot/commands/setSpeedTrap.java index 4ebc496..3e36ab7 100644 --- a/src/main/java/frc/robot/commands/setSpeedTrap.java +++ b/src/main/java/frc/robot/commands/setSpeedTrap.java @@ -7,9 +7,9 @@ import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.SubsystemTrap; + public class setSpeedTrap extends Command { private final SubsystemTrap subsystemTrap = SubsystemTrap.getInstance(); - private final double speed; /** Creates a new setSpeedTrap. */ public setSpeedTrap(double speed) { @@ -22,7 +22,7 @@ public setSpeedTrap(double speed) { @Override public void initialize() { this.subsystemTrap.setSpeed(speed); - + } // Called every time the scheduler runs while the command is scheduled. From 7d3843d3916b69209c2af4f9e1779f3664085e5a Mon Sep 17 00:00:00 2001 From: shay Date: Thu, 18 Jan 2024 00:44:07 +0200 Subject: [PATCH 07/28] climbing subsystem added climbing subsystem --- .../robot/subsystems/ClimbingSubsystem.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/main/java/frc/robot/subsystems/ClimbingSubsystem.java diff --git a/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java b/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java new file mode 100644 index 0000000..9524508 --- /dev/null +++ b/src/main/java/frc/robot/subsystems/ClimbingSubsystem.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.subsystems; + +import com.revrobotics.CANSparkMax; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; + + +public class ClimbingSubsystem extends SubsystemBase { + /** Creates a new ClimbingSubsystem. */ + private CANSparkMax m_climbingRight; + private CANSparkMax m_climbingLeft; + double speed; + + private static ClimbingSubsystem instance; + + public static ClimbingSubsystem getInstance() + { + if (instance == null) + { + instance = new ClimbingSubsystem(); + } + return instance; + } + + + public ClimbingSubsystem() + { + + } + public void setSpeedClimbing(double speed){ + m_climbingLeft.set(speed); + m_climbingRight.set(speed); + } + + public void setRightSpeed(double speed){ + m_climbingRight.set(speed); + } + public void setLeftSpeed(double speed) + { + m_climbingLeft.set(speed); + } + + @Override + public void periodic() { + // This method will be called once per scheduler run + } +} From d16c6f7ad4ff8c816d7734b56078fb80313491bc Mon Sep 17 00:00:00 2001 From: shay Date: Thu, 18 Jan 2024 01:01:42 +0200 Subject: [PATCH 08/28] create new motor and private constructive action 1- changed to create new motor and private constructive action --- src/main/java/frc/robot/subsystems/SubsystemTrap.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/SubsystemTrap.java b/src/main/java/frc/robot/subsystems/SubsystemTrap.java index 31ca806..4633c75 100644 --- a/src/main/java/frc/robot/subsystems/SubsystemTrap.java +++ b/src/main/java/frc/robot/subsystems/SubsystemTrap.java @@ -8,6 +8,7 @@ import com.ctre.phoenix.motorcontrol.can.TalonSRX; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; import com.ctre.phoenix6.hardware.TalonFX; +import static frc.robot.Constants.trapConstants.*; import edu.wpi.first.wpilibj2.command.SubsystemBase; @@ -27,10 +28,11 @@ public static SubsystemTrap getInstance() /** Creates a new SubsystemTrap. */ - public SubsystemTrap() { + private SubsystemTrap() { } - public void setSpeed(double speed){ + private void setSpeed(double speed){ + trapMotor = new WPI_TalonSRX(DEVICE_NUMBER); trapMotor.set(speed); } From fec7b926ed3e48b4a6d151b032fad66db8be550b Mon Sep 17 00:00:00 2001 From: shay Date: Thu, 18 Jan 2024 01:01:54 +0200 Subject: [PATCH 09/28] added trap constants --- src/main/java/frc/robot/Constants.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 18c62d2..7eb8c80 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -223,4 +223,9 @@ public static class Vision { public static final Pose2d target = new Pose2d(1, 1, new Rotation2d(Units.degreesToRadians(0))); } + public static class trapConstants { + public static final int DEVICE_NUMBER = 0; + + + } } From 281c7de8039caf24d6eaa8478a1988ee30df4244 Mon Sep 17 00:00:00 2001 From: shay Date: Thu, 18 Jan 2024 10:02:02 +0200 Subject: [PATCH 10/28] set speed --- src/main/java/frc/robot/subsystems/SubsystemTrap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/SubsystemTrap.java b/src/main/java/frc/robot/subsystems/SubsystemTrap.java index 4633c75..4495a59 100644 --- a/src/main/java/frc/robot/subsystems/SubsystemTrap.java +++ b/src/main/java/frc/robot/subsystems/SubsystemTrap.java @@ -31,7 +31,7 @@ public static SubsystemTrap getInstance() private SubsystemTrap() { } - private void setSpeed(double speed){ + public void setSpeed(double speed){ trapMotor = new WPI_TalonSRX(DEVICE_NUMBER); trapMotor.set(speed); From dbe2aaa05c1848e188a6bb08805d1570222f46ac Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:00:00 +0200 Subject: [PATCH 11/28] motor = new motor added motor = new motor to both motors left and right --- src/main/java/frc/robot/subsystems/ClimbingSubsystem.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java b/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java index 9524508..68708db 100644 --- a/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java +++ b/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java @@ -5,8 +5,10 @@ package frc.robot.subsystems; import com.revrobotics.CANSparkMax; +import com.revrobotics.CANSparkLowLevel.MotorType; import edu.wpi.first.wpilibj2.command.SubsystemBase; +import static frc.robot.Constants.trapConstants.*; public class ClimbingSubsystem extends SubsystemBase { @@ -29,6 +31,10 @@ public static ClimbingSubsystem getInstance() public ClimbingSubsystem() { + m_climbingLeft = new CANSparkMax(M_CLIMBINGLEFT_MOTOR_ID, MotorType.kBrushless); + m_climbingRight = new CANSparkMax(M_CLIMBINGRIGHT_MOTOR_ID, MotorType.kBrushless); + + } public void setSpeedClimbing(double speed){ From 2be41615d4570ce74f3e5eb6d7459de51b2e20d5 Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:01:00 +0200 Subject: [PATCH 12/28] trapMotor = new WPI_TalonSRX(TRAP_MOTOR_ID); added trapMotor = new WPI_TalonSRX(TRAP_MOTOR_ID); --- src/main/java/frc/robot/subsystems/SubsystemTrap.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/SubsystemTrap.java b/src/main/java/frc/robot/subsystems/SubsystemTrap.java index 4495a59..aa976f3 100644 --- a/src/main/java/frc/robot/subsystems/SubsystemTrap.java +++ b/src/main/java/frc/robot/subsystems/SubsystemTrap.java @@ -29,11 +29,12 @@ public static SubsystemTrap getInstance() /** Creates a new SubsystemTrap. */ private SubsystemTrap() { + trapMotor = new WPI_TalonSRX(TRAP_MOTOR_ID); + } public void setSpeed(double speed){ - trapMotor = new WPI_TalonSRX(DEVICE_NUMBER); - trapMotor.set(speed); + trapMotor.set(speed); } From e191dcd3ae28db03af790f35fcf80ef6bf4253ad Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:01:24 +0200 Subject: [PATCH 13/28] motors ID to Constants added motors ID to Constants --- src/main/java/frc/robot/Constants.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 7eb8c80..af78946 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -224,7 +224,10 @@ public static class Vision { public static final Pose2d target = new Pose2d(1, 1, new Rotation2d(Units.degreesToRadians(0))); } public static class trapConstants { - public static final int DEVICE_NUMBER = 0; + public static final int TRAP_MOTOR_ID = 0; + public static final int M_CLIMBINGRIGHT_MOTOR_ID = 1; + public static final int M_CLIMBINGLEFT_MOTOR_ID = 2; + } From d50fcbe5f5cdf693ab282e4f5a79f751145fb1f4 Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:02:49 +0200 Subject: [PATCH 14/28] changed motor name changed to m_trapMotor --- src/main/java/frc/robot/subsystems/SubsystemTrap.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/SubsystemTrap.java b/src/main/java/frc/robot/subsystems/SubsystemTrap.java index aa976f3..fee404b 100644 --- a/src/main/java/frc/robot/subsystems/SubsystemTrap.java +++ b/src/main/java/frc/robot/subsystems/SubsystemTrap.java @@ -13,7 +13,7 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; public class SubsystemTrap extends SubsystemBase { - private WPI_TalonSRX trapMotor; + private WPI_TalonSRX m_trapMotor; double speed; private static SubsystemTrap instance; @@ -29,12 +29,12 @@ public static SubsystemTrap getInstance() /** Creates a new SubsystemTrap. */ private SubsystemTrap() { - trapMotor = new WPI_TalonSRX(TRAP_MOTOR_ID); + m_trapMotor = new WPI_TalonSRX(TRAP_MOTOR_ID); } public void setSpeed(double speed){ - trapMotor.set(speed); + m_trapMotor.set(speed); } From cdc62c0f7cd0e431fb4c0ad76cc55ad000a165e1 Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:06:38 +0200 Subject: [PATCH 15/28] changed to instant command changed to instant command --- .../commands/LeftMotorClimbingSetSpeed.java | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 src/main/java/frc/robot/commands/LeftMotorClimbingSetSpeed.java diff --git a/src/main/java/frc/robot/commands/LeftMotorClimbingSetSpeed.java b/src/main/java/frc/robot/commands/LeftMotorClimbingSetSpeed.java deleted file mode 100644 index a55d402..0000000 --- a/src/main/java/frc/robot/commands/LeftMotorClimbingSetSpeed.java +++ /dev/null @@ -1,39 +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; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.ClimbingSubsystem; - -public class LeftMotorClimbingSetSpeed extends Command { - private final ClimbingSubsystem leftMotorClimbing = ClimbingSubsystem.getInstance(); - double speed; - /** Creates a new LeftMotorClimbingSetSpeed. */ - public LeftMotorClimbingSetSpeed(double speed) { - this.addRequirements(leftMotorClimbing); - this.speed = speed; - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - this.leftMotorClimbing.setSpeedClimbing(speed); - } - - // 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 0136827a0e74ee6d11c3c8cc2a82c889f5dea81c Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:06:44 +0200 Subject: [PATCH 16/28] changed to instant command changed to instant command --- .../commands/SetSpeedLeftMotorClimbing.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/frc/robot/commands/SetSpeedLeftMotorClimbing.java diff --git a/src/main/java/frc/robot/commands/SetSpeedLeftMotorClimbing.java b/src/main/java/frc/robot/commands/SetSpeedLeftMotorClimbing.java new file mode 100644 index 0000000..e596ff1 --- /dev/null +++ b/src/main/java/frc/robot/commands/SetSpeedLeftMotorClimbing.java @@ -0,0 +1,28 @@ +// 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.InstantCommand; +import frc.robot.subsystems.ClimbingSubsystem; + +// 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 SetSpeedLeftMotorClimbing extends InstantCommand { + private final ClimbingSubsystem leftMotorClimbing = ClimbingSubsystem.getInstance(); + double speed; + public SetSpeedLeftMotorClimbing(double speed) { + this.addRequirements(leftMotorClimbing); + this.speed = speed; + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + this.leftMotorClimbing.setSpeedClimbing(speed); + + } +} From 2511bed1555a6527b477ca2ed5e5523947945d13 Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:08:55 +0200 Subject: [PATCH 17/28] changed to instant command - right motor climbing changed to instant command - right motor climbing --- .../commands/RightMotorClimbingSetSpeed.java | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/main/java/frc/robot/commands/RightMotorClimbingSetSpeed.java diff --git a/src/main/java/frc/robot/commands/RightMotorClimbingSetSpeed.java b/src/main/java/frc/robot/commands/RightMotorClimbingSetSpeed.java deleted file mode 100644 index 9198cf0..0000000 --- a/src/main/java/frc/robot/commands/RightMotorClimbingSetSpeed.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; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.ClimbingSubsystem; - -public class RightMotorClimbingSetSpeed extends Command { - private final ClimbingSubsystem rightMotorClimbing = ClimbingSubsystem.getInstance(); - double speed; - /** Creates a new RightMotorClimbingSetSpeed. */ - public RightMotorClimbingSetSpeed(double speed) { - this.addRequirements(rightMotorClimbing); - this.speed = speed; - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - this.rightMotorClimbing.setSpeedClimbing(speed); - - } - - // 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 1c28ea94c005ec7ac79b0b22aa57db4eada5192b Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:09:02 +0200 Subject: [PATCH 18/28] changed to instant command - right motor climbing changed to instant command - right motor climbing --- .../commands/SetSpeedRightMotorClimbing.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/frc/robot/commands/SetSpeedRightMotorClimbing.java diff --git a/src/main/java/frc/robot/commands/SetSpeedRightMotorClimbing.java b/src/main/java/frc/robot/commands/SetSpeedRightMotorClimbing.java new file mode 100644 index 0000000..fb443fd --- /dev/null +++ b/src/main/java/frc/robot/commands/SetSpeedRightMotorClimbing.java @@ -0,0 +1,29 @@ +// 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.InstantCommand; +import frc.robot.subsystems.ClimbingSubsystem; + +// 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 SetSpeedRightMotorClimbing extends InstantCommand { + private final ClimbingSubsystem rightMotorClimbing = ClimbingSubsystem.getInstance(); + double speed; + public SetSpeedRightMotorClimbing(double speed) { + this.addRequirements(rightMotorClimbing); + this.speed = speed; + + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + this.rightMotorClimbing.setSpeedClimbing(speed); + + } +} From e64f168747eae13df14f5d464fc0446369f1f0ab Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:12:34 +0200 Subject: [PATCH 19/28] changed to instant command - set speed trap changed to instant command - set speed trap --- .../java/frc/robot/commands/setSpeedTrap.java | 41 ------------------- 1 file changed, 41 deletions(-) delete mode 100644 src/main/java/frc/robot/commands/setSpeedTrap.java diff --git a/src/main/java/frc/robot/commands/setSpeedTrap.java b/src/main/java/frc/robot/commands/setSpeedTrap.java deleted file mode 100644 index 3e36ab7..0000000 --- a/src/main/java/frc/robot/commands/setSpeedTrap.java +++ /dev/null @@ -1,41 +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; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.SubsystemTrap; - - -public class setSpeedTrap extends Command { - private final SubsystemTrap subsystemTrap = SubsystemTrap.getInstance(); - double speed; - /** Creates a new setSpeedTrap. */ - public setSpeedTrap(double speed) { - this.addRequirements(subsystemTrap); - this.speed = speed; - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - this.subsystemTrap.setSpeed(speed); - - } - - // 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 c3ed8a904c692fdb9da5b086fe8c6701774575c1 Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:12:40 +0200 Subject: [PATCH 20/28] changed to instant command - set speed trap changed to instant command - set speed trap --- .../java/frc/robot/commands/TrapSetSpeed.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main/java/frc/robot/commands/TrapSetSpeed.java diff --git a/src/main/java/frc/robot/commands/TrapSetSpeed.java b/src/main/java/frc/robot/commands/TrapSetSpeed.java new file mode 100644 index 0000000..e0b8d27 --- /dev/null +++ b/src/main/java/frc/robot/commands/TrapSetSpeed.java @@ -0,0 +1,30 @@ +// 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.InstantCommand; +import frc.robot.subsystems.SubsystemTrap; + +// 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 TrapSetSpeed extends InstantCommand { + private final SubsystemTrap subsystemTrap = SubsystemTrap.getInstance(); + double speed; + public TrapSetSpeed(double speed) { + this.addRequirements(subsystemTrap); + this.speed = speed; + + + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + this.subsystemTrap.setSpeed(speed); + + } +} From b4af48f2db5ce8ef36e7cb80f6e4d9e2da757bf4 Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:19:31 +0200 Subject: [PATCH 21/28] put in folder climbing folder put in folder climbing folder --- .../ClimbingMotorsSetSpeed.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/java/frc/robot/commands/ClimbingCommands/ClimbingMotorsSetSpeed.java diff --git a/src/main/java/frc/robot/commands/ClimbingCommands/ClimbingMotorsSetSpeed.java b/src/main/java/frc/robot/commands/ClimbingCommands/ClimbingMotorsSetSpeed.java new file mode 100644 index 0000000..c26711f --- /dev/null +++ b/src/main/java/frc/robot/commands/ClimbingCommands/ClimbingMotorsSetSpeed.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.ClimbingCommands; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.ClimbingSubsystem; + +public class ClimbingMotorsSetSpeed extends Command { + private final ClimbingSubsystem climbingSubsystem = ClimbingSubsystem.getInstance(); + double speed; + /** Creates a new ClimbingMotorsSetSpeed. */ + public ClimbingMotorsSetSpeed(double speed) { + this.addRequirements(climbingSubsystem); + this.speed = speed; + + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + this.climbingSubsystem.setSpeedClimbing(speed); + } + + // 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 636e6d25f4d9cbe1b0d2f8c2f9c95ddb2c85f6e4 Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 19 Jan 2024 14:19:44 +0200 Subject: [PATCH 22/28] put in folder climbing folder --- .../SetSpeedLeftMotorClimbing.java | 2 +- .../SetSpeedRightMotorClimbing.java | 2 +- .../commands/ClimbingMotorsSetSpeed.java | 40 ------------------- 3 files changed, 2 insertions(+), 42 deletions(-) rename src/main/java/frc/robot/commands/{ => ClimbingCommands}/SetSpeedLeftMotorClimbing.java (95%) rename src/main/java/frc/robot/commands/{ => ClimbingCommands}/SetSpeedRightMotorClimbing.java (95%) delete mode 100644 src/main/java/frc/robot/commands/ClimbingMotorsSetSpeed.java diff --git a/src/main/java/frc/robot/commands/SetSpeedLeftMotorClimbing.java b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedLeftMotorClimbing.java similarity index 95% rename from src/main/java/frc/robot/commands/SetSpeedLeftMotorClimbing.java rename to src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedLeftMotorClimbing.java index e596ff1..ed76198 100644 --- a/src/main/java/frc/robot/commands/SetSpeedLeftMotorClimbing.java +++ b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedLeftMotorClimbing.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.ClimbingCommands; import edu.wpi.first.wpilibj2.command.InstantCommand; import frc.robot.subsystems.ClimbingSubsystem; diff --git a/src/main/java/frc/robot/commands/SetSpeedRightMotorClimbing.java b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedRightMotorClimbing.java similarity index 95% rename from src/main/java/frc/robot/commands/SetSpeedRightMotorClimbing.java rename to src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedRightMotorClimbing.java index fb443fd..4f7bfc2 100644 --- a/src/main/java/frc/robot/commands/SetSpeedRightMotorClimbing.java +++ b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedRightMotorClimbing.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.ClimbingCommands; import edu.wpi.first.wpilibj2.command.InstantCommand; import frc.robot.subsystems.ClimbingSubsystem; diff --git a/src/main/java/frc/robot/commands/ClimbingMotorsSetSpeed.java b/src/main/java/frc/robot/commands/ClimbingMotorsSetSpeed.java deleted file mode 100644 index 38db2c6..0000000 --- a/src/main/java/frc/robot/commands/ClimbingMotorsSetSpeed.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; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.ClimbingSubsystem; - -public class ClimbingMotorsSetSpeed extends Command { - private final ClimbingSubsystem climbingSubsystem = ClimbingSubsystem.getInstance(); - double speed; - /** Creates a new ClimbingMotorsSetSpeed. */ - public ClimbingMotorsSetSpeed(double speed) { - this.addRequirements(climbingSubsystem); - this.speed = speed; - - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - this.climbingSubsystem.setSpeedClimbing(speed); - } - - // 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 dafa1bd145a5c4c311ee9f903963091bf9e26c17 Mon Sep 17 00:00:00 2001 From: shay Date: Mon, 22 Jan 2024 16:34:20 +0200 Subject: [PATCH 23/28] made it instant command made it instant command --- .../ClimbingMotorsSetSpeed.java | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/main/java/frc/robot/commands/ClimbingCommands/ClimbingMotorsSetSpeed.java diff --git a/src/main/java/frc/robot/commands/ClimbingCommands/ClimbingMotorsSetSpeed.java b/src/main/java/frc/robot/commands/ClimbingCommands/ClimbingMotorsSetSpeed.java deleted file mode 100644 index c26711f..0000000 --- a/src/main/java/frc/robot/commands/ClimbingCommands/ClimbingMotorsSetSpeed.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.ClimbingCommands; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.ClimbingSubsystem; - -public class ClimbingMotorsSetSpeed extends Command { - private final ClimbingSubsystem climbingSubsystem = ClimbingSubsystem.getInstance(); - double speed; - /** Creates a new ClimbingMotorsSetSpeed. */ - public ClimbingMotorsSetSpeed(double speed) { - this.addRequirements(climbingSubsystem); - this.speed = speed; - - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - this.climbingSubsystem.setSpeedClimbing(speed); - } - - // 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 1ecc97fd6c5caa0af380ba40d376cd77757ae988 Mon Sep 17 00:00:00 2001 From: shay Date: Mon, 22 Jan 2024 16:34:33 +0200 Subject: [PATCH 24/28] changed instance changed instance --- .../ClimbingCommands/SetSpeedLeftMotorClimbing.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedLeftMotorClimbing.java b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedLeftMotorClimbing.java index ed76198..a39d092 100644 --- a/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedLeftMotorClimbing.java +++ b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedLeftMotorClimbing.java @@ -11,10 +11,10 @@ // information, see: // https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html public class SetSpeedLeftMotorClimbing extends InstantCommand { - private final ClimbingSubsystem leftMotorClimbing = ClimbingSubsystem.getInstance(); + private final ClimbingSubsystem climbingSubsystem = ClimbingSubsystem.getInstance(); double speed; public SetSpeedLeftMotorClimbing(double speed) { - this.addRequirements(leftMotorClimbing); + this.addRequirements(climbingSubsystem); this.speed = speed; // Use addRequirements() here to declare subsystem dependencies. } @@ -22,7 +22,7 @@ public SetSpeedLeftMotorClimbing(double speed) { // Called when the command is initially scheduled. @Override public void initialize() { - this.leftMotorClimbing.setSpeedClimbing(speed); + this.climbingSubsystem.setSpeedClimbing(speed); } } From 95c74d2b9643478a2fa6933ddadae034de56c23d Mon Sep 17 00:00:00 2001 From: shay Date: Mon, 22 Jan 2024 16:34:53 +0200 Subject: [PATCH 25/28] the instant command motors climbing the instant command --- .../SetSpeedMotorsClimbing.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedMotorsClimbing.java diff --git a/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedMotorsClimbing.java b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedMotorsClimbing.java new file mode 100644 index 0000000..4dc8bf0 --- /dev/null +++ b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedMotorsClimbing.java @@ -0,0 +1,28 @@ +// 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.ClimbingCommands; + +import edu.wpi.first.wpilibj2.command.InstantCommand; +import frc.robot.subsystems.ClimbingSubsystem; + +// 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 SetSpeedMotorsClimbing extends InstantCommand { + private final ClimbingSubsystem climbingSubsystem = ClimbingSubsystem.getInstance(); + double speed; + public SetSpeedMotorsClimbing(double speed) { + this.addRequirements(climbingSubsystem); + this.speed = speed; + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + this.climbingSubsystem.setSpeedClimbing(speed); + + } +} From ec55a9bc1996fddfcd35faee79a541dbe0a2e326 Mon Sep 17 00:00:00 2001 From: shay Date: Mon, 22 Jan 2024 16:35:07 +0200 Subject: [PATCH 26/28] changed instant2 changed instant2 --- .../ClimbingCommands/SetSpeedRightMotorClimbing.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedRightMotorClimbing.java b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedRightMotorClimbing.java index 4f7bfc2..cf961fb 100644 --- a/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedRightMotorClimbing.java +++ b/src/main/java/frc/robot/commands/ClimbingCommands/SetSpeedRightMotorClimbing.java @@ -11,10 +11,10 @@ // information, see: // https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html public class SetSpeedRightMotorClimbing extends InstantCommand { - private final ClimbingSubsystem rightMotorClimbing = ClimbingSubsystem.getInstance(); + private final ClimbingSubsystem climbingSubsystem = ClimbingSubsystem.getInstance(); double speed; public SetSpeedRightMotorClimbing(double speed) { - this.addRequirements(rightMotorClimbing); + this.addRequirements(climbingSubsystem); this.speed = speed; // Use addRequirements() here to declare subsystem dependencies. @@ -23,7 +23,7 @@ public SetSpeedRightMotorClimbing(double speed) { // Called when the command is initially scheduled. @Override public void initialize() { - this.rightMotorClimbing.setSpeedClimbing(speed); + this.climbingSubsystem.setSpeedClimbing(speed); } } From 9f5cfca6d6f1256ada22b4d4f43de11459dc105f Mon Sep 17 00:00:00 2001 From: shay Date: Mon, 22 Jan 2024 16:35:21 +0200 Subject: [PATCH 27/28] changed to private changed to private --- src/main/java/frc/robot/subsystems/ClimbingSubsystem.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java b/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java index 68708db..acc1779 100644 --- a/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java +++ b/src/main/java/frc/robot/subsystems/ClimbingSubsystem.java @@ -8,7 +8,8 @@ import com.revrobotics.CANSparkLowLevel.MotorType; import edu.wpi.first.wpilibj2.command.SubsystemBase; -import static frc.robot.Constants.trapConstants.*; +import static frc.robot.Constants.climbingConstants.*; + public class ClimbingSubsystem extends SubsystemBase { @@ -29,7 +30,7 @@ public static ClimbingSubsystem getInstance() } - public ClimbingSubsystem() + private ClimbingSubsystem() { m_climbingLeft = new CANSparkMax(M_CLIMBINGLEFT_MOTOR_ID, MotorType.kBrushless); m_climbingRight = new CANSparkMax(M_CLIMBINGRIGHT_MOTOR_ID, MotorType.kBrushless); From 652a559bb5eefe43a5e8d65c36e498ac7cefdcc3 Mon Sep 17 00:00:00 2001 From: shay Date: Mon, 22 Jan 2024 16:35:38 +0200 Subject: [PATCH 28/28] added climbing constants added climbing constants --- src/main/java/frc/robot/Constants.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index af78946..c525926 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -225,10 +225,10 @@ public static class Vision { } public static class trapConstants { public static final int TRAP_MOTOR_ID = 0; + + } + public static class climbingConstants{ public static final int M_CLIMBINGRIGHT_MOTOR_ID = 1; public static final int M_CLIMBINGLEFT_MOTOR_ID = 2; - - - } }