From 115a65b0f8ce7e0cf55b8a8ff3d32fb59a755853 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Jan 2024 09:34:52 -0500 Subject: [PATCH 1/6] [#112] added clim system test --- src/main/java/frc/robot/Constants.java | 2 + .../frc/robot/command/ClimbMotorTest.java | 41 +++++++++++++++++++ .../java/frc/robot/command/ClimbTest.java | 27 ++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 src/main/java/frc/robot/command/ClimbMotorTest.java create mode 100644 src/main/java/frc/robot/command/ClimbTest.java diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 62d50248..c40c74b8 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -376,5 +376,7 @@ public class ClimbConstants { //TODO: find real values public static final double CLIMB_PID_SETPOINT_EXTENDED = 10; //TODO: find real values public static final double CLIMB_PID_SETPOINT_RETRACTED = 0; public static final double CLIMB_EXTENSION_TOLERANCE = 0; + + public static final double CLIMB_TEST_POWER = .1; } } diff --git a/src/main/java/frc/robot/command/ClimbMotorTest.java b/src/main/java/frc/robot/command/ClimbMotorTest.java new file mode 100644 index 00000000..3d3e17e5 --- /dev/null +++ b/src/main/java/frc/robot/command/ClimbMotorTest.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.command.tests; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Climber; +import frc.robot.Constants.ClimbConstants; + +public class ClimbMotorTest extends Command { + Climber climber; + private double power; + public ClimbMotorTest(Climber climber, double power) { + this.climber = climber; + this.power = power; + addRequirements(climber); + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + climber.setPower(ClimbConstants.CLIMB_TEST_POWER * power); + } + + // 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) { + climber.setPower(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/command/ClimbTest.java b/src/main/java/frc/robot/command/ClimbTest.java new file mode 100644 index 00000000..c5a62bee --- /dev/null +++ b/src/main/java/frc/robot/command/ClimbTest.java @@ -0,0 +1,27 @@ +// 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.command.tests; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.thunder.command.TimedCommand; +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; +import edu.wpi.first.wpilibj2.command.WaitCommand; +import frc.robot.subsystems.Climb; +public class ClimbTest extends SequentialCommandGroup { + + private Climber climber; + + public ClimbTest(Climber climber) { + this.climber = climber; + addCommands( + + new WaitCommand(0.5), + new TimedCommand(new ClimbMotorTest(climber, 1), 2), // climber out + new WaitCommand(1), + new TimedCommand(new ClimbMotorTest(climber, -1), 2), // climber 1 in + + ) + } +} From 56ba7562a31f9d6094777b50bfca81b1c4e68e12 Mon Sep 17 00:00:00 2001 From: Meh243 <120067923+Meh243@users.noreply.github.com> Date: Sat, 27 Jan 2024 15:29:10 -0500 Subject: [PATCH 2/6] [#112] changed the files so it's actually good :) --- .../frc/robot/command/ClimbMotorTest.java | 41 ------------------- .../java/frc/robot/command/ClimbTest.java | 27 ------------ .../frc/robot/command/tests/ClimbTest.java | 19 +++++++++ 3 files changed, 19 insertions(+), 68 deletions(-) delete mode 100644 src/main/java/frc/robot/command/ClimbMotorTest.java delete mode 100644 src/main/java/frc/robot/command/ClimbTest.java create mode 100644 src/main/java/frc/robot/command/tests/ClimbTest.java diff --git a/src/main/java/frc/robot/command/ClimbMotorTest.java b/src/main/java/frc/robot/command/ClimbMotorTest.java deleted file mode 100644 index 3d3e17e5..00000000 --- a/src/main/java/frc/robot/command/ClimbMotorTest.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.command.tests; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.Climber; -import frc.robot.Constants.ClimbConstants; - -public class ClimbMotorTest extends Command { - Climber climber; - private double power; - public ClimbMotorTest(Climber climber, double power) { - this.climber = climber; - this.power = power; - addRequirements(climber); - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - climber.setPower(ClimbConstants.CLIMB_TEST_POWER * power); - } - - // 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) { - climber.setPower(0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/command/ClimbTest.java b/src/main/java/frc/robot/command/ClimbTest.java deleted file mode 100644 index c5a62bee..00000000 --- a/src/main/java/frc/robot/command/ClimbTest.java +++ /dev/null @@ -1,27 +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.command.tests; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.thunder.command.TimedCommand; -import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; -import edu.wpi.first.wpilibj2.command.WaitCommand; -import frc.robot.subsystems.Climb; -public class ClimbTest extends SequentialCommandGroup { - - private Climber climber; - - public ClimbTest(Climber climber) { - this.climber = climber; - addCommands( - - new WaitCommand(0.5), - new TimedCommand(new ClimbMotorTest(climber, 1), 2), // climber out - new WaitCommand(1), - new TimedCommand(new ClimbMotorTest(climber, -1), 2), // climber 1 in - - ) - } -} diff --git a/src/main/java/frc/robot/command/tests/ClimbTest.java b/src/main/java/frc/robot/command/tests/ClimbTest.java new file mode 100644 index 00000000..a5b4e9d5 --- /dev/null +++ b/src/main/java/frc/robot/command/tests/ClimbTest.java @@ -0,0 +1,19 @@ +// 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.command.tests; + +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; + +// 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 ClimbTest extends SequentialCommandGroup { + /** Creates a new ClimbTest. */ + public ClimbTest() { + // Add your commands in the addCommands() call, e.g. + // addCommands(new FooCommand(), new BarCommand()); + addCommands(); + } +} From 9c4f3e2be078541ea194c6929033a28748476b4a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Jan 2024 18:40:14 -0500 Subject: [PATCH 3/6] [#112] fixed syntax davi :( --- src/main/java/frc/thunder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/thunder b/src/main/java/frc/thunder index cd540794..9605b432 160000 --- a/src/main/java/frc/thunder +++ b/src/main/java/frc/thunder @@ -1 +1 @@ -Subproject commit cd54079489d55b374a3d96cf4a81e697bae7e236 +Subproject commit 9605b43298b268d6f709309df307e35b3e234261 From fdd34cab910b086983322a86efcf648af18083f7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Jan 2024 18:45:29 -0500 Subject: [PATCH 4/6] [#112] fix synax --- .../java/frc/robot/command/ClimbTest.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/command/ClimbTest.java b/src/main/java/frc/robot/command/ClimbTest.java index c5a62bee..da973009 100644 --- a/src/main/java/frc/robot/command/ClimbTest.java +++ b/src/main/java/frc/robot/command/ClimbTest.java @@ -1,4 +1,4 @@ -// Copyright (c) FIRST and other WPILib contributors. +/*// 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. @@ -25,3 +25,40 @@ public ClimbTest(Climber climber) { ) } } +*/ + +// 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.command.tests; + +import com.ctre.phoenix6.mechanisms.swerve.SwerveRequest; + +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; +import edu.wpi.first.wpilibj2.command.WaitCommand; +import frc.robot.command.tests.testCommands.DriveTest; +import frc.robot.subsystems.Swerve; +import frc.thunder.command.TimedCommand; +import frc.thunder.testing.SystemTestCommandGroup; +import edu.wpi.first.wpilibj2.command.Command; + +public class DrivetrainSystemTest extends SystemTestCommandGroup { + + public ClimbSystemTest(Climber climber, double power) { + super( + new SequentialCommandGroup( + new WaitCommand(0.5), + new TimedCommand(new ClimbMotorTest(climber, power), 1), // UP + new WaitCommand(1), + new TimedCommand(new ClimbMotorTest(climber, power), -1), // DOWN + new WaitCommand(1), + new TimedCommand(new ClimbMotorTest(climber, power), 1), // UP + new WaitCommand(1), + new TimedCommand(new ClimbMotorTest(climber, power), -1), // DOWN + new WaitCommand(0.5) + ) + ); + } + +} From 3043ea5fd2c25d132e0703119691daa2351446dd Mon Sep 17 00:00:00 2001 From: HeroSoLos Date: Mon, 29 Jan 2024 20:13:31 -0500 Subject: [PATCH 5/6] [#112] fixed kyle (i tried) --- .../ClimbSystemTest.java} | 11 ++--- .../frc/robot/command/tests/ClimbTest.java | 19 ------- .../command/tests/testCommands/ClimbTest.java | 49 +++++++++++++++++++ 3 files changed, 52 insertions(+), 27 deletions(-) rename src/main/java/frc/robot/command/{ClimbTest.java => tests/ClimbSystemTest.java} (79%) delete mode 100644 src/main/java/frc/robot/command/tests/ClimbTest.java create mode 100644 src/main/java/frc/robot/command/tests/testCommands/ClimbTest.java diff --git a/src/main/java/frc/robot/command/ClimbTest.java b/src/main/java/frc/robot/command/tests/ClimbSystemTest.java similarity index 79% rename from src/main/java/frc/robot/command/ClimbTest.java rename to src/main/java/frc/robot/command/tests/ClimbSystemTest.java index da973009..8a08d089 100644 --- a/src/main/java/frc/robot/command/ClimbTest.java +++ b/src/main/java/frc/robot/command/tests/ClimbSystemTest.java @@ -45,18 +45,13 @@ public ClimbTest(Climber climber) { public class DrivetrainSystemTest extends SystemTestCommandGroup { - public ClimbSystemTest(Climber climber, double power) { + public ClimbSystemTest(Climber climber) { super( new SequentialCommandGroup( new WaitCommand(0.5), - new TimedCommand(new ClimbMotorTest(climber, power), 1), // UP + new TimedCommand(new ClimbTest(climber, 1), 1), // UP new WaitCommand(1), - new TimedCommand(new ClimbMotorTest(climber, power), -1), // DOWN - new WaitCommand(1), - new TimedCommand(new ClimbMotorTest(climber, power), 1), // UP - new WaitCommand(1), - new TimedCommand(new ClimbMotorTest(climber, power), -1), // DOWN - new WaitCommand(0.5) + new TimedCommand(new ClimbTest(climber, -1), 1), // DOWN ) ); } diff --git a/src/main/java/frc/robot/command/tests/ClimbTest.java b/src/main/java/frc/robot/command/tests/ClimbTest.java deleted file mode 100644 index a5b4e9d5..00000000 --- a/src/main/java/frc/robot/command/tests/ClimbTest.java +++ /dev/null @@ -1,19 +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.command.tests; - -import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; - -// 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 ClimbTest extends SequentialCommandGroup { - /** Creates a new ClimbTest. */ - public ClimbTest() { - // Add your commands in the addCommands() call, e.g. - // addCommands(new FooCommand(), new BarCommand()); - addCommands(); - } -} diff --git a/src/main/java/frc/robot/command/tests/testCommands/ClimbTest.java b/src/main/java/frc/robot/command/tests/testCommands/ClimbTest.java new file mode 100644 index 00000000..cd42e074 --- /dev/null +++ b/src/main/java/frc/robot/command/tests/testCommands/ClimbTest.java @@ -0,0 +1,49 @@ +// 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.command.tests; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Climber; +import frc.robot.Constants.ClimbConstants; + +public class ClimbMotorTest extends Command { + + private Climber climber; + private double power; + + /** + * System test command for testing climb motors + * @param climber climber subsystem + * @param power power to control up or down + */ + public ClimbMotorTest(Climber climber, double power) { + this.climber = climber; + this.power = power; + + addRequirements(climber); + } + + // 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() { + climber.setPower(ClimbConstants.CLIMB_TEST_POWER * power); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + climber.setPower(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} \ No newline at end of file From fc7b88a46ee702bbb373ba0f12b02dd4bdbcecf1 Mon Sep 17 00:00:00 2001 From: HeroSoLos Date: Mon, 29 Jan 2024 21:01:11 -0500 Subject: [PATCH 6/6] [#112] it builds woohoo --- .../robot/command/tests/ClimbSystemTest.java | 40 ++----------------- .../command/tests/testCommands/ClimbTest.java | 6 +-- src/main/java/frc/thunder | 2 +- 3 files changed, 8 insertions(+), 40 deletions(-) diff --git a/src/main/java/frc/robot/command/tests/ClimbSystemTest.java b/src/main/java/frc/robot/command/tests/ClimbSystemTest.java index 8a08d089..2018a57a 100644 --- a/src/main/java/frc/robot/command/tests/ClimbSystemTest.java +++ b/src/main/java/frc/robot/command/tests/ClimbSystemTest.java @@ -1,49 +1,17 @@ -/*// 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.command.tests; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.thunder.command.TimedCommand; -import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; -import edu.wpi.first.wpilibj2.command.WaitCommand; -import frc.robot.subsystems.Climb; -public class ClimbTest extends SequentialCommandGroup { - - private Climber climber; - - public ClimbTest(Climber climber) { - this.climber = climber; - addCommands( - - new WaitCommand(0.5), - new TimedCommand(new ClimbMotorTest(climber, 1), 2), // climber out - new WaitCommand(1), - new TimedCommand(new ClimbMotorTest(climber, -1), 2), // climber 1 in - - ) - } -} -*/ - // 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.command.tests; -import com.ctre.phoenix6.mechanisms.swerve.SwerveRequest; - import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import edu.wpi.first.wpilibj2.command.WaitCommand; -import frc.robot.command.tests.testCommands.DriveTest; -import frc.robot.subsystems.Swerve; +import frc.robot.command.tests.testCommands.ClimbTest; +import frc.robot.subsystems.Climber; import frc.thunder.command.TimedCommand; import frc.thunder.testing.SystemTestCommandGroup; -import edu.wpi.first.wpilibj2.command.Command; -public class DrivetrainSystemTest extends SystemTestCommandGroup { +public class ClimbSystemTest extends SystemTestCommandGroup { public ClimbSystemTest(Climber climber) { super( @@ -51,7 +19,7 @@ public ClimbSystemTest(Climber climber) { new WaitCommand(0.5), new TimedCommand(new ClimbTest(climber, 1), 1), // UP new WaitCommand(1), - new TimedCommand(new ClimbTest(climber, -1), 1), // DOWN + new TimedCommand(new ClimbTest(climber, -1), 1) // DOWN ) ); } diff --git a/src/main/java/frc/robot/command/tests/testCommands/ClimbTest.java b/src/main/java/frc/robot/command/tests/testCommands/ClimbTest.java index cd42e074..814a67b8 100644 --- a/src/main/java/frc/robot/command/tests/testCommands/ClimbTest.java +++ b/src/main/java/frc/robot/command/tests/testCommands/ClimbTest.java @@ -2,13 +2,13 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.command.tests; +package frc.robot.command.tests.testCommands; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Climber; import frc.robot.Constants.ClimbConstants; -public class ClimbMotorTest extends Command { +public class ClimbTest extends Command { private Climber climber; private double power; @@ -18,7 +18,7 @@ public class ClimbMotorTest extends Command { * @param climber climber subsystem * @param power power to control up or down */ - public ClimbMotorTest(Climber climber, double power) { + public ClimbTest(Climber climber, double power) { this.climber = climber; this.power = power; diff --git a/src/main/java/frc/thunder b/src/main/java/frc/thunder index 9605b432..cd540794 160000 --- a/src/main/java/frc/thunder +++ b/src/main/java/frc/thunder @@ -1 +1 @@ -Subproject commit 9605b43298b268d6f709309df307e35b3e234261 +Subproject commit cd54079489d55b374a3d96cf4a81e697bae7e236