From 03cdfadb6d3ce7ba69bd0e9bdde704b661c7790e Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Tue, 30 Jan 2024 18:18:22 -0500 Subject: [PATCH 01/31] Guideur guideur guiderHaut --- src/main/java/frc/robot/command/GuiderHaut.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/command/GuiderHaut.java b/src/main/java/frc/robot/command/GuiderHaut.java index 586ebbd..1eb052e 100644 --- a/src/main/java/frc/robot/command/GuiderHaut.java +++ b/src/main/java/frc/robot/command/GuiderHaut.java @@ -10,7 +10,7 @@ import frc.robot.subsystem.Guideur; public class GuiderHaut extends Command { private Guideur guideur; /** Creates a new GuiderHaut. */ - public GuiderHaut() { + public GuiderHaut(Guideur guideur) { this.guideur = guideur; addRequirements(guideur); // Use addRequirements() here to declare subsystem dependencies. From f810501f420a8e41424ab758dad2556851e8e596 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 30 Jan 2024 19:52:09 -0500 Subject: [PATCH 02/31] --- networktables.json | 1 + simgui-ds.json | 92 +++++++++++++++++++ simgui.json | 12 +++ src/main/java/frc/robot/RobotContainer.java | 9 +- .../java/frc/robot/command/GrimpeurBas.java | 51 ---------- .../java/frc/robot/command/GuiderHaut.java | 2 +- .../java/frc/robot/subsystem/Guideur.java | 2 +- 7 files changed, 113 insertions(+), 56 deletions(-) create mode 100644 networktables.json create mode 100644 simgui-ds.json create mode 100644 simgui.json delete mode 100644 src/main/java/frc/robot/command/GrimpeurBas.java diff --git a/networktables.json b/networktables.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/networktables.json @@ -0,0 +1 @@ +[] diff --git a/simgui-ds.json b/simgui-ds.json new file mode 100644 index 0000000..73cc713 --- /dev/null +++ b/simgui-ds.json @@ -0,0 +1,92 @@ +{ + "keyboardJoysticks": [ + { + "axisConfig": [ + { + "decKey": 65, + "incKey": 68 + }, + { + "decKey": 87, + "incKey": 83 + }, + { + "decKey": 69, + "decayRate": 0.0, + "incKey": 82, + "keyRate": 0.009999999776482582 + } + ], + "axisCount": 3, + "buttonCount": 4, + "buttonKeys": [ + 90, + 88, + 67, + 86 + ], + "povConfig": [ + { + "key0": 328, + "key135": 323, + "key180": 322, + "key225": 321, + "key270": 324, + "key315": 327, + "key45": 329, + "key90": 326 + } + ], + "povCount": 1 + }, + { + "axisConfig": [ + { + "decKey": 74, + "incKey": 76 + }, + { + "decKey": 73, + "incKey": 75 + } + ], + "axisCount": 2, + "buttonCount": 4, + "buttonKeys": [ + 77, + 44, + 46, + 47 + ], + "povCount": 0 + }, + { + "axisConfig": [ + { + "decKey": 263, + "incKey": 262 + }, + { + "decKey": 265, + "incKey": 264 + } + ], + "axisCount": 2, + "buttonCount": 6, + "buttonKeys": [ + 260, + 268, + 266, + 261, + 269, + 267 + ], + "povCount": 0 + }, + { + "axisCount": 0, + "buttonCount": 0, + "povCount": 0 + } + ] +} diff --git a/simgui.json b/simgui.json new file mode 100644 index 0000000..4da2b3d --- /dev/null +++ b/simgui.json @@ -0,0 +1,12 @@ +{ + "NTProvider": { + "types": { + "/FMSInfo": "FMSInfo", + "/SmartDashboard/Field": "Field2d", + "/SmartDashboard/Pigeon IMU [0]": "Gyro" + } + }, + "NetworkTables Info": { + "visible": true + } +} diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 7303389..e2edab8 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -13,7 +13,8 @@ import edu.wpi.first.wpilibj2.command.RunCommand; // Manette import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; - +import frc.robot.command.GuiderBas; +import frc.robot.command.GuiderHaut; // Subsystem import frc.robot.subsystem.Accumulateur; import frc.robot.subsystem.Balayeuse; @@ -31,14 +32,16 @@ public class RobotContainer { Grimpeur grimpeur = new Grimpeur(); Guideur guideur = new Guideur(); Lanceur lanceur = new Lanceur(); - + GuiderHaut guiderHaut = new GuiderHaut(guideur); + GuiderBas guiderBas = new GuiderBas(guideur); CommandJoystick joystick = new CommandJoystick(0); CommandXboxController manette = new CommandXboxController(1); public RobotContainer() { CameraServer.startAutomaticCapture(); - + manette.a().onTrue(guiderBas); + manette.b().onTrue(guiderHaut); configureBindings(); drive.setDefaultCommand(new RunCommand(()->{ drive.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2)); diff --git a/src/main/java/frc/robot/command/GrimpeurBas.java b/src/main/java/frc/robot/command/GrimpeurBas.java deleted file mode 100644 index 47b2a53..0000000 --- a/src/main/java/frc/robot/command/GrimpeurBas.java +++ /dev/null @@ -1,51 +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; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystem.Grimpeur; - -public class GrimpeurBas extends Command { - private Grimpeur grimpeur; - /** Creates a new GrimpeurBas. */ - public GrimpeurBas(Grimpeur grimpeur) { - this.grimpeur = grimpeur; - addRequirements(grimpeur); - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - grimpeur.resetencodeurd(); - grimpeur.resetencodeurg(); - } - - // Called every time the scheduler runs while the command is scheduled. - @Override - public void execute() { - if(grimpeur.droite()){ - grimpeur.resetencodeurd(); - grimpeur.gauche(0); - } - if(grimpeur.gauche()){ - grimpeur.resetencodeurg(); - grimpeur.gauche(0); - } - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - grimpeur.droit(0); - grimpeur.gauche(0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/command/GuiderHaut.java b/src/main/java/frc/robot/command/GuiderHaut.java index 586ebbd..1eb052e 100644 --- a/src/main/java/frc/robot/command/GuiderHaut.java +++ b/src/main/java/frc/robot/command/GuiderHaut.java @@ -10,7 +10,7 @@ import frc.robot.subsystem.Guideur; public class GuiderHaut extends Command { private Guideur guideur; /** Creates a new GuiderHaut. */ - public GuiderHaut() { + public GuiderHaut(Guideur guideur) { this.guideur = guideur; addRequirements(guideur); // Use addRequirements() here to declare subsystem dependencies. diff --git a/src/main/java/frc/robot/subsystem/Guideur.java b/src/main/java/frc/robot/subsystem/Guideur.java index 08ffab9..359a04c 100644 --- a/src/main/java/frc/robot/subsystem/Guideur.java +++ b/src/main/java/frc/robot/subsystem/Guideur.java @@ -16,7 +16,7 @@ public class Guideur extends SubsystemBase { final WPI_TalonSRX guideur = new WPI_TalonSRX(Constants.guideur); final DigitalInput guideurhaut = new DigitalInput(Constants.guideurhaut); - final DigitalInput guideurbas = new DigitalInput(Constants.guideurhaut); + final DigitalInput guideurbas = new DigitalInput(Constants.guideurbas); public void guider(double vitesse){ guideur.set(vitesse); From 9303d6f87a672faebe642038c02b5fad0bbd290e Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Tue, 30 Jan 2024 19:52:21 -0500 Subject: [PATCH 03/31] vbj --- src/main/java/frc/robot/RobotContainer.java | 5 +- .../java/frc/robot/command/Lancerampli.java | 46 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 src/main/java/frc/robot/command/Lancerampli.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 7303389..452fe9d 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -13,7 +13,7 @@ import edu.wpi.first.wpilibj2.command.RunCommand; // Manette import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; - +import frc.robot.command.Balayer; // Subsystem import frc.robot.subsystem.Accumulateur; import frc.robot.subsystem.Balayeuse; @@ -31,6 +31,7 @@ public class RobotContainer { Grimpeur grimpeur = new Grimpeur(); Guideur guideur = new Guideur(); Lanceur lanceur = new Lanceur(); + Balayer balayer = new Balayer(balayeuse, accumulateur); CommandJoystick joystick = new CommandJoystick(0); CommandXboxController manette = new CommandXboxController(1); @@ -47,7 +48,7 @@ public class RobotContainer { private void configureBindings() { - + joystick.button(3).toggleOnTrue(balayer); } diff --git a/src/main/java/frc/robot/command/Lancerampli.java b/src/main/java/frc/robot/command/Lancerampli.java new file mode 100644 index 0000000..4e7aafb --- /dev/null +++ b/src/main/java/frc/robot/command/Lancerampli.java @@ -0,0 +1,46 @@ +// 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; + +import com.revrobotics.CANSparkMax; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystem.Accumulateur; +import frc.robot.subsystem.Lanceur; + +public class Lancerampli extends Command { + /** Creates a new Lanceur. */ + + private Lanceur lancer; + private Lanceur lancer2; + private Lanceur lancer3; + private Lanceur lancer4; + public Lancerampli() { + // Use addRequirements() here to declare subsystem dependencies. + addRequirements(lancer,lancer2,lancer3,lancer4); + } + + // 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() { + lancer.lancer(0.1); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + lancer.lancer(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From 442b537517acca468fd5c0e80b0c9069c6da7ac1 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Tue, 30 Jan 2024 19:53:18 -0500 Subject: [PATCH 04/31] k, --- src/main/java/frc/robot/RobotContainer.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index e3fa430..cc4a6c6 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -13,12 +13,9 @@ import edu.wpi.first.wpilibj2.command.RunCommand; // Manette import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; -<<<<<<< HEAD import frc.robot.command.Balayer; -======= import frc.robot.command.GuiderBas; import frc.robot.command.GuiderHaut; ->>>>>>> 33990971eb46b4232501c29b34451800e658504b // Subsystem import frc.robot.subsystem.Accumulateur; import frc.robot.subsystem.Balayeuse; @@ -37,9 +34,9 @@ public class RobotContainer { Guideur guideur = new Guideur(); Lanceur lanceur = new Lanceur(); Balayer balayer = new Balayer(balayeuse, accumulateur); - GuiderHaut guiderHaut = new GuiderHaut(guideur); GuiderBas guiderBas = new GuiderBas(guideur); + CommandJoystick joystick = new CommandJoystick(0); CommandXboxController manette = new CommandXboxController(1); From c4b1b419cdcd299d81a94aaff081d5b2ba5fd52e Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 30 Jan 2024 19:53:24 -0500 Subject: [PATCH 05/31] --- .vscode/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4ed293b..337aac5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,5 +25,6 @@ } }, ], - "java.test.defaultConfig": "WPIlibUnitTests" + "java.test.defaultConfig": "WPIlibUnitTests", + "java.debug.settings.onBuildFailureProceed": true } From 8d4d47504141423b046190f3f55e26641e862d8d Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Tue, 30 Jan 2024 19:54:07 -0500 Subject: [PATCH 06/31] ; --- src/main/java/frc/robot/RobotContainer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index cc4a6c6..4f8b451 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -10,13 +10,16 @@ import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.RunCommand; -// Manette +// Manettes import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; + +// Commands import frc.robot.command.Balayer; import frc.robot.command.GuiderBas; import frc.robot.command.GuiderHaut; -// Subsystem + +// Subsystems import frc.robot.subsystem.Accumulateur; import frc.robot.subsystem.Balayeuse; import frc.robot.subsystem.Drive; From 010264c09c9583b58ed3c345cedd12185c7166ef Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Tue, 30 Jan 2024 19:57:33 -0500 Subject: [PATCH 07/31] s --- src/main/java/frc/robot/command/Balayer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/frc/robot/command/Balayer.java b/src/main/java/frc/robot/command/Balayer.java index d13cb6d..31b57f1 100644 --- a/src/main/java/frc/robot/command/Balayer.java +++ b/src/main/java/frc/robot/command/Balayer.java @@ -14,6 +14,7 @@ public class Balayer extends Command { /** Creates a new Balayer. */ public Balayer(Balayeuse balayeuse, Accumulateur accumulateur) { this.balayeuse = balayeuse; + this.accumulateur = accumulateur; addRequirements(balayeuse, accumulateur);} // Use addRequirements() here to declare subsystem dependencies. // Called when the command is initially scheduled. From 948f725b3799b8742f2c6d030d652fe568a81d21 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Tue, 30 Jan 2024 20:02:47 -0500 Subject: [PATCH 08/31] b --- src/main/java/frc/robot/subsystem/Accumulateur.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystem/Accumulateur.java b/src/main/java/frc/robot/subsystem/Accumulateur.java index 2ae3c97..fb3b646 100644 --- a/src/main/java/frc/robot/subsystem/Accumulateur.java +++ b/src/main/java/frc/robot/subsystem/Accumulateur.java @@ -9,7 +9,8 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; -import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout; From f857cad15510778757f03468c3f7dc437bbf7af4 Mon Sep 17 00:00:00 2001 From: Olivier Demers Date: Wed, 31 Jan 2024 17:00:37 +0000 Subject: [PATCH 09/31] add build test --- .gitlab-ci.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8738ecb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,13 @@ +default: + image: gradle:jdk17-alpine + tags: + - robot + +stages: # List of stages for jobs, and their order of execution + - build + +build-job: # This job runs in the build stage, which runs first. + stage: build + script: + - chmod +x gradlew + - ./gradlew build From 900d7adf18f4915af25fde1d36add88312f75814 Mon Sep 17 00:00:00 2001 From: Olivier Demers Date: Wed, 31 Jan 2024 17:02:44 +0000 Subject: [PATCH 10/31] non-alpine gradle --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8738ecb..8a907cd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ default: - image: gradle:jdk17-alpine + image: gradle:jdk17 tags: - robot From bb21b106f32d5c2f48094ff23395f8851f1763ee Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Thu, 1 Feb 2024 17:25:01 -0500 Subject: [PATCH 11/31] hygyhyhguguhgukhkjhuhuhukhkjhhukhjhukhujhkuhuhuukhuhjhjiuytruyhgyft --- src/main/java/frc/robot/RobotContainer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index cc4a6c6..46a02b3 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -9,7 +9,7 @@ import edu.wpi.first.math.MathUtil; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.RunCommand; - +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; // Manette import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; @@ -58,6 +58,6 @@ public class RobotContainer { } public Command getAutonomousCommand() { - return Commands.print("No autonomous command configured"); + return new SequentialCommandGroup(null); } } From 35e4d6a686df0d2c73a50c6a178f2a734006c767 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Thu, 1 Feb 2024 17:27:42 -0500 Subject: [PATCH 12/31] samuel lanceur --- src/main/java/frc/robot/command/Lancer.java | 13 +++--- .../java/frc/robot/command/LancerNote.java | 44 +++++++++++++++++++ .../java/frc/robot/command/Lancerampli.java | 13 +++--- .../java/frc/robot/subsystem/Lanceur.java | 3 ++ 4 files changed, 58 insertions(+), 15 deletions(-) create mode 100644 src/main/java/frc/robot/command/LancerNote.java diff --git a/src/main/java/frc/robot/command/Lancer.java b/src/main/java/frc/robot/command/Lancer.java index 804f019..8ed1c79 100644 --- a/src/main/java/frc/robot/command/Lancer.java +++ b/src/main/java/frc/robot/command/Lancer.java @@ -12,14 +12,11 @@ import frc.robot.subsystem.Lanceur; public class Lancer extends Command { /** Creates a new Lanceur. */ - - private Lanceur lancer; - private Lanceur lancer2; - private Lanceur lancer3; - private Lanceur lancer4; + private Lanceur lanceur; public Lancer() { + this.lanceur = lanceur; // Use addRequirements() here to declare subsystem dependencies. - addRequirements(lancer,lancer2,lancer3,lancer4); + addRequirements(lanceur); } // Called when the command is initially scheduled. @@ -29,13 +26,13 @@ public class Lancer extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - lancer.lancer(0.3); + lanceur.lancer(0.3); } // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { - lancer.lancer(0); + lanceur.lancer(0); } // Returns true when the command should end. diff --git a/src/main/java/frc/robot/command/LancerNote.java b/src/main/java/frc/robot/command/LancerNote.java new file mode 100644 index 0000000..76fed0d --- /dev/null +++ b/src/main/java/frc/robot/command/LancerNote.java @@ -0,0 +1,44 @@ +// 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; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystem.Accumulateur; +import frc.robot.subsystem.Lanceur; + +public class LancerNote extends Command { + private Lanceur lancer; + private Accumulateur accumulateur; + /** Creates a new LancerNote. */ + public LancerNote(Lanceur lancer, Accumulateur accumulateur) { + this.lancer = lancer; + this.accumulateur = accumulateur; + // 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() { + double vitesse = 100; + lancer.lancer(vitesse); + if(lancer.vitesse(vitesse)>vitesse){ + accumulateur.Accumuler(0.6); + } + } + + // 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/command/Lancerampli.java b/src/main/java/frc/robot/command/Lancerampli.java index 4e7aafb..fbf4594 100644 --- a/src/main/java/frc/robot/command/Lancerampli.java +++ b/src/main/java/frc/robot/command/Lancerampli.java @@ -13,13 +13,12 @@ import frc.robot.subsystem.Lanceur; public class Lancerampli extends Command { /** Creates a new Lanceur. */ - private Lanceur lancer; - private Lanceur lancer2; - private Lanceur lancer3; - private Lanceur lancer4; + private Lanceur lanceur; + public Lancerampli() { // Use addRequirements() here to declare subsystem dependencies. - addRequirements(lancer,lancer2,lancer3,lancer4); + addRequirements(lanceur); + this.lanceur = lanceur; } // Called when the command is initially scheduled. @@ -29,13 +28,13 @@ public class Lancerampli extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - lancer.lancer(0.1); + lanceur.lancer(0.1); } // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { - lancer.lancer(0); + lanceur.lancer(0); } // Returns true when the command should end. diff --git a/src/main/java/frc/robot/subsystem/Lanceur.java b/src/main/java/frc/robot/subsystem/Lanceur.java index 7ae2c2c..7e0c817 100644 --- a/src/main/java/frc/robot/subsystem/Lanceur.java +++ b/src/main/java/frc/robot/subsystem/Lanceur.java @@ -23,6 +23,9 @@ public class Lanceur extends SubsystemBase { public void lancer(double vitesse){ lancer.set(vitesse); + } + public double vitesse(double vitesse){ + return lancer.getEncoder().getVelocity(); } public void lanceur(){ lancer2.follow(lancer); From d9e5fbde750dfdce87d7dc79b1b90edff903608e Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Thu, 1 Feb 2024 18:09:36 -0500 Subject: [PATCH 13/31] lanceur --- src/main/java/frc/robot/RobotContainer.java | 1 - src/main/java/frc/robot/command/Lancer.java | 4 ++-- src/main/java/frc/robot/command/Lancerampli.java | 4 ++-- src/main/java/frc/robot/subsystem/Balayeuse.java | 2 +- src/main/java/frc/robot/subsystem/Lanceur.java | 4 +++- 5 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 a5c4bd9..1f1e0ef 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -7,7 +7,6 @@ package frc.robot; import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.math.MathUtil; import edu.wpi.first.wpilibj2.command.Command; -import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; // Manette diff --git a/src/main/java/frc/robot/command/Lancer.java b/src/main/java/frc/robot/command/Lancer.java index 804f019..0fdc5eb 100644 --- a/src/main/java/frc/robot/command/Lancer.java +++ b/src/main/java/frc/robot/command/Lancer.java @@ -4,10 +4,10 @@ package frc.robot.command; -import com.revrobotics.CANSparkMax; + import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystem.Accumulateur; + import frc.robot.subsystem.Lanceur; public class Lancer extends Command { diff --git a/src/main/java/frc/robot/command/Lancerampli.java b/src/main/java/frc/robot/command/Lancerampli.java index 4e7aafb..f3588b9 100644 --- a/src/main/java/frc/robot/command/Lancerampli.java +++ b/src/main/java/frc/robot/command/Lancerampli.java @@ -4,10 +4,10 @@ package frc.robot.command; -import com.revrobotics.CANSparkMax; + import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystem.Accumulateur; + import frc.robot.subsystem.Lanceur; public class Lancerampli extends Command { diff --git a/src/main/java/frc/robot/subsystem/Balayeuse.java b/src/main/java/frc/robot/subsystem/Balayeuse.java index 8fc5987..79ed37f 100644 --- a/src/main/java/frc/robot/subsystem/Balayeuse.java +++ b/src/main/java/frc/robot/subsystem/Balayeuse.java @@ -4,7 +4,7 @@ package frc.robot.subsystem; -import com.ctre.phoenix.motorcontrol.can.TalonSRX; + import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; import edu.wpi.first.wpilibj2.command.SubsystemBase; diff --git a/src/main/java/frc/robot/subsystem/Lanceur.java b/src/main/java/frc/robot/subsystem/Lanceur.java index 7ae2c2c..9edc79b 100644 --- a/src/main/java/frc/robot/subsystem/Lanceur.java +++ b/src/main/java/frc/robot/subsystem/Lanceur.java @@ -20,7 +20,9 @@ public class Lanceur extends SubsystemBase { final CANSparkMax lancer2 = new CANSparkMax(Constants.lancer2, MotorType.kBrushless); final CANSparkMax lancer3 = new CANSparkMax(Constants.lancer3, MotorType.kBrushless); final CANSparkMax lancer4 = new CANSparkMax(Constants.lancer4, MotorType.kBrushless); - + public void pid(){ + lancer.getPIDController(); + } public void lancer(double vitesse){ lancer.set(vitesse); } From 76c55bf9847a0fe82c70c48b092e107d75b634b8 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Thu, 1 Feb 2024 19:20:32 -0500 Subject: [PATCH 14/31] mode auto --- src/main/deploy/pathplanner/autos/1.1.auto | 17 +++- .../pathplanner/autos/{1.auto => 1.2.auto} | 19 +++- src/main/deploy/pathplanner/autos/1.3.auto | 63 ++++++++++++ src/main/deploy/pathplanner/autos/1.4.auto | 69 ++++++++++++++ src/main/deploy/pathplanner/autos/1.5.auto | 88 +++++++++++++++++ src/main/deploy/pathplanner/autos/2.1.auto | 17 +++- .../pathplanner/autos/{2.auto => 2.2.auto} | 19 +++- src/main/deploy/pathplanner/autos/2.3.auto | 63 ++++++++++++ src/main/deploy/pathplanner/autos/2.4.auto | 69 ++++++++++++++ src/main/deploy/pathplanner/autos/2.5.auto | 88 +++++++++++++++++ src/main/deploy/pathplanner/autos/3.1.auto | 17 +++- .../pathplanner/autos/{3.auto => 3.2.auto} | 19 +++- src/main/deploy/pathplanner/autos/3.3.auto | 63 ++++++++++++ src/main/deploy/pathplanner/autos/3.4.auto | 69 ++++++++++++++ src/main/deploy/pathplanner/autos/3.5.auto | 88 +++++++++++++++++ src/main/deploy/pathplanner/autos/4.1.auto | 17 +++- .../pathplanner/autos/{4.auto => 4.2.auto} | 19 +++- src/main/deploy/pathplanner/autos/4.3.auto | 63 ++++++++++++ src/main/deploy/pathplanner/autos/4.4.auto | 69 ++++++++++++++ src/main/deploy/pathplanner/autos/4.5.auto | 88 +++++++++++++++++ src/main/deploy/pathplanner/autos/5.1.auto | 24 ++++- src/main/deploy/pathplanner/autos/5.2.auto | 51 ++++++++++ src/main/deploy/pathplanner/autos/5.3.auto | 70 ++++++++++++++ src/main/deploy/pathplanner/autos/5.4.auto | 76 +++++++++++++++ src/main/deploy/pathplanner/autos/5.5.auto | 95 +++++++++++++++++++ src/main/deploy/pathplanner/autos/5.auto | 31 ------ src/main/deploy/pathplanner/autos/6.1.auto | 17 +++- .../pathplanner/autos/{6.auto => 6.2.auto} | 19 +++- src/main/deploy/pathplanner/autos/6.3.auto | 63 ++++++++++++ src/main/deploy/pathplanner/autos/6.4.auto | 69 ++++++++++++++ src/main/deploy/pathplanner/autos/6.5.auto | 88 +++++++++++++++++ src/main/java/frc/robot/RobotContainer.java | 19 +++- src/main/java/frc/robot/command/Lancer.java | 2 +- .../java/frc/robot/command/Lancerampli.java | 2 +- 34 files changed, 1586 insertions(+), 64 deletions(-) rename src/main/deploy/pathplanner/autos/{1.auto => 1.2.auto} (53%) create mode 100644 src/main/deploy/pathplanner/autos/1.3.auto create mode 100644 src/main/deploy/pathplanner/autos/1.4.auto create mode 100644 src/main/deploy/pathplanner/autos/1.5.auto rename src/main/deploy/pathplanner/autos/{2.auto => 2.2.auto} (53%) create mode 100644 src/main/deploy/pathplanner/autos/2.3.auto create mode 100644 src/main/deploy/pathplanner/autos/2.4.auto create mode 100644 src/main/deploy/pathplanner/autos/2.5.auto rename src/main/deploy/pathplanner/autos/{3.auto => 3.2.auto} (53%) create mode 100644 src/main/deploy/pathplanner/autos/3.3.auto create mode 100644 src/main/deploy/pathplanner/autos/3.4.auto create mode 100644 src/main/deploy/pathplanner/autos/3.5.auto rename src/main/deploy/pathplanner/autos/{4.auto => 4.2.auto} (53%) create mode 100644 src/main/deploy/pathplanner/autos/4.3.auto create mode 100644 src/main/deploy/pathplanner/autos/4.4.auto create mode 100644 src/main/deploy/pathplanner/autos/4.5.auto create mode 100644 src/main/deploy/pathplanner/autos/5.2.auto create mode 100644 src/main/deploy/pathplanner/autos/5.3.auto create mode 100644 src/main/deploy/pathplanner/autos/5.4.auto create mode 100644 src/main/deploy/pathplanner/autos/5.5.auto delete mode 100644 src/main/deploy/pathplanner/autos/5.auto rename src/main/deploy/pathplanner/autos/{6.auto => 6.2.auto} (54%) create mode 100644 src/main/deploy/pathplanner/autos/6.3.auto create mode 100644 src/main/deploy/pathplanner/autos/6.4.auto create mode 100644 src/main/deploy/pathplanner/autos/6.5.auto diff --git a/src/main/deploy/pathplanner/autos/1.1.auto b/src/main/deploy/pathplanner/autos/1.1.auto index 3be6cd9..819cf26 100644 --- a/src/main/deploy/pathplanner/autos/1.1.auto +++ b/src/main/deploy/pathplanner/autos/1.1.auto @@ -12,9 +12,22 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "1.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } } ] diff --git a/src/main/deploy/pathplanner/autos/1.auto b/src/main/deploy/pathplanner/autos/1.2.auto similarity index 53% rename from src/main/deploy/pathplanner/autos/1.auto rename to src/main/deploy/pathplanner/autos/1.2.auto index 8375003..a557e76 100644 --- a/src/main/deploy/pathplanner/autos/1.auto +++ b/src/main/deploy/pathplanner/autos/1.2.auto @@ -12,15 +12,28 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "1.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } }, { "type": "path", "data": { - "pathName": "1.2" + "pathName": "1.1" } } ] diff --git a/src/main/deploy/pathplanner/autos/1.3.auto b/src/main/deploy/pathplanner/autos/1.3.auto new file mode 100644 index 0000000..f749089 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/1.3.auto @@ -0,0 +1,63 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 1.3, + "y": 5.55 + }, + "rotation": 180.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "1.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "1", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/1.4.auto b/src/main/deploy/pathplanner/autos/1.4.auto new file mode 100644 index 0000000..fa1607d --- /dev/null +++ b/src/main/deploy/pathplanner/autos/1.4.auto @@ -0,0 +1,69 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 1.3, + "y": 5.55 + }, + "rotation": 180.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "1.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "1.2" + } + } + ] + } + }, + "folder": "1", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/1.5.auto b/src/main/deploy/pathplanner/autos/1.5.auto new file mode 100644 index 0000000..8eb44dc --- /dev/null +++ b/src/main/deploy/pathplanner/autos/1.5.auto @@ -0,0 +1,88 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 1.3, + "y": 5.55 + }, + "rotation": 180.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "1.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "1.2" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "1", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/2.1.auto b/src/main/deploy/pathplanner/autos/2.1.auto index 5f0cce7..f1871dc 100644 --- a/src/main/deploy/pathplanner/autos/2.1.auto +++ b/src/main/deploy/pathplanner/autos/2.1.auto @@ -12,9 +12,22 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "2.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } } ] diff --git a/src/main/deploy/pathplanner/autos/2.auto b/src/main/deploy/pathplanner/autos/2.2.auto similarity index 53% rename from src/main/deploy/pathplanner/autos/2.auto rename to src/main/deploy/pathplanner/autos/2.2.auto index 87988db..8cc5cf1 100644 --- a/src/main/deploy/pathplanner/autos/2.auto +++ b/src/main/deploy/pathplanner/autos/2.2.auto @@ -12,15 +12,28 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "2.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } }, { "type": "path", "data": { - "pathName": "2.2" + "pathName": "2.1" } } ] diff --git a/src/main/deploy/pathplanner/autos/2.3.auto b/src/main/deploy/pathplanner/autos/2.3.auto new file mode 100644 index 0000000..9664be9 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/2.3.auto @@ -0,0 +1,63 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 0.7, + "y": 4.4 + }, + "rotation": 120.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "2.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "2", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/2.4.auto b/src/main/deploy/pathplanner/autos/2.4.auto new file mode 100644 index 0000000..4bd326d --- /dev/null +++ b/src/main/deploy/pathplanner/autos/2.4.auto @@ -0,0 +1,69 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 0.7, + "y": 4.4 + }, + "rotation": 120.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "2.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "2.2" + } + } + ] + } + }, + "folder": "2", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/2.5.auto b/src/main/deploy/pathplanner/autos/2.5.auto new file mode 100644 index 0000000..4db4968 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/2.5.auto @@ -0,0 +1,88 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 0.7, + "y": 4.4 + }, + "rotation": 120.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "2.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "2.2" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "2", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/3.1.auto b/src/main/deploy/pathplanner/autos/3.1.auto index d9f0551..60135e2 100644 --- a/src/main/deploy/pathplanner/autos/3.1.auto +++ b/src/main/deploy/pathplanner/autos/3.1.auto @@ -12,9 +12,22 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "3.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } } ] diff --git a/src/main/deploy/pathplanner/autos/3.auto b/src/main/deploy/pathplanner/autos/3.2.auto similarity index 53% rename from src/main/deploy/pathplanner/autos/3.auto rename to src/main/deploy/pathplanner/autos/3.2.auto index 93406f2..fab233e 100644 --- a/src/main/deploy/pathplanner/autos/3.auto +++ b/src/main/deploy/pathplanner/autos/3.2.auto @@ -12,15 +12,28 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "3.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } }, { "type": "path", "data": { - "pathName": "3.2" + "pathName": "3.1" } } ] diff --git a/src/main/deploy/pathplanner/autos/3.3.auto b/src/main/deploy/pathplanner/autos/3.3.auto new file mode 100644 index 0000000..e899dae --- /dev/null +++ b/src/main/deploy/pathplanner/autos/3.3.auto @@ -0,0 +1,63 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 0.7, + "y": 6.7 + }, + "rotation": -120.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "3.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "3", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/3.4.auto b/src/main/deploy/pathplanner/autos/3.4.auto new file mode 100644 index 0000000..ee52ad4 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/3.4.auto @@ -0,0 +1,69 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 0.7, + "y": 6.7 + }, + "rotation": -120.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "3.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "3.2" + } + } + ] + } + }, + "folder": "3", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/3.5.auto b/src/main/deploy/pathplanner/autos/3.5.auto new file mode 100644 index 0000000..a22e873 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/3.5.auto @@ -0,0 +1,88 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 0.7, + "y": 6.7 + }, + "rotation": -120.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "3.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "3.2" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "3", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/4.1.auto b/src/main/deploy/pathplanner/autos/4.1.auto index a7fa3fa..c55e797 100644 --- a/src/main/deploy/pathplanner/autos/4.1.auto +++ b/src/main/deploy/pathplanner/autos/4.1.auto @@ -12,9 +12,22 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "4.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } } ] diff --git a/src/main/deploy/pathplanner/autos/4.auto b/src/main/deploy/pathplanner/autos/4.2.auto similarity index 53% rename from src/main/deploy/pathplanner/autos/4.auto rename to src/main/deploy/pathplanner/autos/4.2.auto index 1eb4acc..873f45d 100644 --- a/src/main/deploy/pathplanner/autos/4.auto +++ b/src/main/deploy/pathplanner/autos/4.2.auto @@ -12,15 +12,28 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "4.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } }, { "type": "path", "data": { - "pathName": "4.2" + "pathName": "4.1" } } ] diff --git a/src/main/deploy/pathplanner/autos/4.3.auto b/src/main/deploy/pathplanner/autos/4.3.auto new file mode 100644 index 0000000..309d666 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/4.3.auto @@ -0,0 +1,63 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.2, + "y": 5.55 + }, + "rotation": 0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "4.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "4", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/4.4.auto b/src/main/deploy/pathplanner/autos/4.4.auto new file mode 100644 index 0000000..1921381 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/4.4.auto @@ -0,0 +1,69 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.2, + "y": 5.55 + }, + "rotation": 0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "4.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "4.2" + } + } + ] + } + }, + "folder": "4", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/4.5.auto b/src/main/deploy/pathplanner/autos/4.5.auto new file mode 100644 index 0000000..3e57efa --- /dev/null +++ b/src/main/deploy/pathplanner/autos/4.5.auto @@ -0,0 +1,88 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.2, + "y": 5.55 + }, + "rotation": 0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "4.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "4.2" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "4", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/5.1.auto b/src/main/deploy/pathplanner/autos/5.1.auto index e839fb2..bc613d0 100644 --- a/src/main/deploy/pathplanner/autos/5.1.auto +++ b/src/main/deploy/pathplanner/autos/5.1.auto @@ -12,9 +12,29 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "5.1" + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + } + ] + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } } ] diff --git a/src/main/deploy/pathplanner/autos/5.2.auto b/src/main/deploy/pathplanner/autos/5.2.auto new file mode 100644 index 0000000..209d455 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/5.2.auto @@ -0,0 +1,51 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.85, + "y": 4.4 + }, + "rotation": 60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + } + ] + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "5.1" + } + } + ] + } + }, + "folder": "5", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/5.3.auto b/src/main/deploy/pathplanner/autos/5.3.auto new file mode 100644 index 0000000..9cd6456 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/5.3.auto @@ -0,0 +1,70 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.85, + "y": 4.4 + }, + "rotation": 60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + } + ] + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "5.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "5", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/5.4.auto b/src/main/deploy/pathplanner/autos/5.4.auto new file mode 100644 index 0000000..dd425d2 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/5.4.auto @@ -0,0 +1,76 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.85, + "y": 4.4 + }, + "rotation": 60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + } + ] + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "5.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "5.2" + } + } + ] + } + }, + "folder": "5", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/5.5.auto b/src/main/deploy/pathplanner/autos/5.5.auto new file mode 100644 index 0000000..a1412af --- /dev/null +++ b/src/main/deploy/pathplanner/autos/5.5.auto @@ -0,0 +1,95 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.85, + "y": 4.4 + }, + "rotation": 60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + } + ] + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "5.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "5.2" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "5", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/5.auto b/src/main/deploy/pathplanner/autos/5.auto deleted file mode 100644 index 0ba9482..0000000 --- a/src/main/deploy/pathplanner/autos/5.auto +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": 1.0, - "startingPose": { - "position": { - "x": 15.85, - "y": 4.4 - }, - "rotation": 60.0 - }, - "command": { - "type": "sequential", - "data": { - "commands": [ - { - "type": "path", - "data": { - "pathName": "5.1" - } - }, - { - "type": "path", - "data": { - "pathName": "5.2" - } - } - ] - } - }, - "folder": "5", - "choreoAuto": false -} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/6.1.auto b/src/main/deploy/pathplanner/autos/6.1.auto index 94fe39d..1733bae 100644 --- a/src/main/deploy/pathplanner/autos/6.1.auto +++ b/src/main/deploy/pathplanner/autos/6.1.auto @@ -12,9 +12,22 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "6.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } } ] diff --git a/src/main/deploy/pathplanner/autos/6.auto b/src/main/deploy/pathplanner/autos/6.2.auto similarity index 54% rename from src/main/deploy/pathplanner/autos/6.auto rename to src/main/deploy/pathplanner/autos/6.2.auto index 4624edd..adc3a77 100644 --- a/src/main/deploy/pathplanner/autos/6.auto +++ b/src/main/deploy/pathplanner/autos/6.2.auto @@ -12,15 +12,28 @@ "data": { "commands": [ { - "type": "path", + "type": "deadline", "data": { - "pathName": "6.1" + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] } }, { "type": "path", "data": { - "pathName": "6.2" + "pathName": "6.1" } } ] diff --git a/src/main/deploy/pathplanner/autos/6.3.auto b/src/main/deploy/pathplanner/autos/6.3.auto new file mode 100644 index 0000000..ca3fe4a --- /dev/null +++ b/src/main/deploy/pathplanner/autos/6.3.auto @@ -0,0 +1,63 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.8, + "y": 6.65 + }, + "rotation": -60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "6.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "6", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/6.4.auto b/src/main/deploy/pathplanner/autos/6.4.auto new file mode 100644 index 0000000..8716b08 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/6.4.auto @@ -0,0 +1,69 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.8, + "y": 6.65 + }, + "rotation": -60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "6.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "6.2" + } + } + ] + } + }, + "folder": "6", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/6.5.auto b/src/main/deploy/pathplanner/autos/6.5.auto new file mode 100644 index 0000000..52cf9b4 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/6.5.auto @@ -0,0 +1,88 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.8, + "y": 6.65 + }, + "rotation": -60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "6.1" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "balyer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + }, + { + "type": "path", + "data": { + "pathName": "6.2" + } + }, + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "lancer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 3.0 + } + } + ] + } + } + ] + } + }, + "folder": "6", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 1f1e0ef..79ac84d 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -4,8 +4,13 @@ package frc.robot; +import com.pathplanner.lib.auto.AutoBuilder; +import com.pathplanner.lib.auto.NamedCommands; +import com.pathplanner.lib.commands.PathPlannerAuto; + import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.math.MathUtil; +import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; @@ -19,7 +24,9 @@ import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import frc.robot.command.Balayer; import frc.robot.command.GuiderBas; import frc.robot.command.GuiderHaut; - +import frc.robot.command.Lancer; +import frc.robot.command.LancerNote; +import frc.robot.command.Lancerampli; // Subsystems import frc.robot.subsystem.Accumulateur; import frc.robot.subsystem.Balayeuse; @@ -30,7 +37,7 @@ import frc.robot.subsystem.Lanceur; public class RobotContainer { - + private final SendableChooser autoChooser; Drive drive = new Drive(); Accumulateur accumulateur = new Accumulateur(); Balayeuse balayeuse = new Balayeuse(); @@ -40,11 +47,13 @@ public class RobotContainer { Balayer balayer = new Balayer(balayeuse, accumulateur); GuiderHaut guiderHaut = new GuiderHaut(guideur); GuiderBas guiderBas = new GuiderBas(guideur); - + LancerNote lancernote = new LancerNote(lanceur, accumulateur); + Lancerampli lancerampli = new Lancerampli(lanceur); CommandJoystick joystick = new CommandJoystick(0); CommandXboxController manette = new CommandXboxController(1); public RobotContainer() { + autoChooser = AutoBuilder.buildAutoChooser(); CameraServer.startAutomaticCapture(); manette.a().onTrue(guiderBas); @@ -53,6 +62,8 @@ public class RobotContainer { drive.setDefaultCommand(new RunCommand(()->{ drive.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2)); },drive)); + NamedCommands.registerCommand("balayer",balayer); + NamedCommands.registerCommand("lancer", lancernote); } private void configureBindings() { @@ -62,6 +73,6 @@ public class RobotContainer { } public Command getAutonomousCommand() { - return new SequentialCommandGroup(null); + return null; } } diff --git a/src/main/java/frc/robot/command/Lancer.java b/src/main/java/frc/robot/command/Lancer.java index 2d62c50..20e58e1 100644 --- a/src/main/java/frc/robot/command/Lancer.java +++ b/src/main/java/frc/robot/command/Lancer.java @@ -13,7 +13,7 @@ import frc.robot.subsystem.Lanceur; public class Lancer extends Command { /** Creates a new Lanceur. */ private Lanceur lanceur; - public Lancer() { + public Lancer(Lanceur lanceur) { this.lanceur = lanceur; // Use addRequirements() here to declare subsystem dependencies. addRequirements(lanceur); diff --git a/src/main/java/frc/robot/command/Lancerampli.java b/src/main/java/frc/robot/command/Lancerampli.java index ef4ed14..81701e7 100644 --- a/src/main/java/frc/robot/command/Lancerampli.java +++ b/src/main/java/frc/robot/command/Lancerampli.java @@ -15,7 +15,7 @@ public class Lancerampli extends Command { private Lanceur lanceur; - public Lancerampli() { + public Lancerampli(Lanceur lanceur) { // Use addRequirements() here to declare subsystem dependencies. addRequirements(lanceur); this.lanceur = lanceur; From 55537b2e83266ad5ce2853de019218cfb592621c Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Thu, 1 Feb 2024 19:30:02 -0500 Subject: [PATCH 15/31] mode auto --- src/main/java/frc/robot/RobotContainer.java | 2 +- src/main/java/frc/robot/subsystem/Drive.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 79ac84d..db408d7 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -73,6 +73,6 @@ public class RobotContainer { } public Command getAutonomousCommand() { - return null; + return autoChooser.getSelected(); } } diff --git a/src/main/java/frc/robot/subsystem/Drive.java b/src/main/java/frc/robot/subsystem/Drive.java index c4ea3ad..44bb959 100644 --- a/src/main/java/frc/robot/subsystem/Drive.java +++ b/src/main/java/frc/robot/subsystem/Drive.java @@ -6,6 +6,9 @@ package frc.robot.subsystem; import java.io.File; import java.io.IOException; + + + import edu.wpi.first.math.geometry.Translation2d; import edu.wpi.first.math.kinematics.SwerveModulePosition; import edu.wpi.first.wpilibj.Filesystem; @@ -25,7 +28,6 @@ public class Drive extends SubsystemBase { } public Drive() { - try { this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive(2); } catch (IOException e) { From 16600ad317cf10d27f8143d6ea2be5b571f34ee4 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Thu, 1 Feb 2024 19:33:02 -0500 Subject: [PATCH 16/31] --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index db408d7..6f0cecc 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -72,7 +72,7 @@ public class RobotContainer { } - public Command getAutonomousCommand() { + public Command getAutonomousCommand(){ return autoChooser.getSelected(); } } From c564c9770365ea860f3c70c3aa4b846330fa3c58 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Thu, 1 Feb 2024 19:44:44 -0500 Subject: [PATCH 17/31] lancer -> lanceur pour les moteurs --- src/main/java/frc/robot/Constants.java | 20 ++++++++-------- .../java/frc/robot/subsystem/Lanceur.java | 24 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 8c918b3..21e30aa 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -43,16 +43,16 @@ public class Constants { public static int ArriereGauche = 7; // Limit switch - public static int guideurhaut = 23; - public static int guideurbas = 24; - public static int limitacc = 25; - public static int limitacc2 = 76; - public static int limithaut = 28; - public static int limitbas = 29; + public static int guideurhaut = 0; + public static int guideurbas = 1; + public static int limitacc = 2; + public static int limitacc2 = 3; + public static int limithaut = 4; + public static int limitbas = 5; //piston - public static int pistondroiteouvre= 30; - public static int pistondroiteferme= 31; - public static int pistondgaucheouvre= 32; - public static int pistondgauchferme= 32; + public static int pistondroiteouvre= 0; + public static int pistondroiteferme= 1; + public static int pistondgaucheouvre= 2; + public static int pistondgauchferme= 3; } diff --git a/src/main/java/frc/robot/subsystem/Lanceur.java b/src/main/java/frc/robot/subsystem/Lanceur.java index ddae36a..f5a58cc 100644 --- a/src/main/java/frc/robot/subsystem/Lanceur.java +++ b/src/main/java/frc/robot/subsystem/Lanceur.java @@ -16,25 +16,25 @@ public class Lanceur extends SubsystemBase { public Lanceur() {} - final CANSparkMax lancer = new CANSparkMax(Constants.lanceur, MotorType.kBrushless); - final CANSparkMax lancer2 = new CANSparkMax(Constants.lancer2, MotorType.kBrushless); - final CANSparkMax lancer3 = new CANSparkMax(Constants.lancer3, MotorType.kBrushless); - final CANSparkMax lancer4 = new CANSparkMax(Constants.lancer4, MotorType.kBrushless); + final CANSparkMax lanceur1 = new CANSparkMax(Constants.lanceur, MotorType.kBrushless); + final CANSparkMax lanceur2 = new CANSparkMax(Constants.lancer2, MotorType.kBrushless); + final CANSparkMax lanceur3 = new CANSparkMax(Constants.lancer3, MotorType.kBrushless); + final CANSparkMax lanceur4 = new CANSparkMax(Constants.lancer4, MotorType.kBrushless); public void pid(){ - lancer.getPIDController(); + lanceur1.getPIDController(); } public void lancer(double vitesse){ - lancer.set(vitesse); + lanceur1.set(vitesse); } public double vitesse(double vitesse){ - return lancer.getEncoder().getVelocity(); + return lanceur1.getEncoder().getVelocity(); } public void lanceur(){ - lancer2.follow(lancer); - lancer3.follow(lancer); - lancer4.follow(lancer); - lancer3.setInverted(true); - lancer4.setInverted(true); + lanceur2.follow(lanceur1); + lanceur3.follow(lanceur1); + lanceur4.follow(lanceur1); + lanceur3.setInverted(true); + lanceur4.setInverted(true); } @Override From 20fbdd124cd496dec0c1634b789d65bdcce1587b Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Thu, 1 Feb 2024 20:01:29 -0500 Subject: [PATCH 18/31] mode auto --- src/main/java/frc/robot/RobotContainer.java | 5 +++-- src/main/java/frc/robot/subsystem/Drive.java | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 6f0cecc..2e84c89 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -53,6 +53,8 @@ public class RobotContainer { CommandXboxController manette = new CommandXboxController(1); public RobotContainer() { + NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur)); + NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur)); autoChooser = AutoBuilder.buildAutoChooser(); CameraServer.startAutomaticCapture(); @@ -62,8 +64,7 @@ public class RobotContainer { drive.setDefaultCommand(new RunCommand(()->{ drive.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2)); },drive)); - NamedCommands.registerCommand("balayer",balayer); - NamedCommands.registerCommand("lancer", lancernote); + } private void configureBindings() { diff --git a/src/main/java/frc/robot/subsystem/Drive.java b/src/main/java/frc/robot/subsystem/Drive.java index 44bb959..7770387 100644 --- a/src/main/java/frc/robot/subsystem/Drive.java +++ b/src/main/java/frc/robot/subsystem/Drive.java @@ -7,10 +7,14 @@ package frc.robot.subsystem; import java.io.File; import java.io.IOException; - +import com.pathplanner.lib.auto.AutoBuilder; +import com.pathplanner.lib.util.HolonomicPathFollowerConfig; +import com.pathplanner.lib.util.PIDConstants; +import com.pathplanner.lib.util.ReplanningConfig; import edu.wpi.first.math.geometry.Translation2d; import edu.wpi.first.math.kinematics.SwerveModulePosition; +import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj.Filesystem; import edu.wpi.first.wpilibj2.command.SubsystemBase; import swervelib.SwerveDrive; @@ -28,6 +32,17 @@ public class Drive extends SubsystemBase { } public Drive() { + AutoBuilder.configureHolonomic(swerveDrive::getPose, swerveDrive::resetOdometry, swerveDrive::getRobotVelocity, swerveDrive::setChassisSpeeds, new HolonomicPathFollowerConfig( + new PIDConstants(5,0,0), new PIDConstants(5,0,0), 4.5, + 0.275, + new ReplanningConfig() + ), ()->{ + var alliance = DriverStation.getAlliance(); + if(alliance.isPresent()){ + return alliance.get() == DriverStation.Alliance.Red; + } + return false; + }, this); try { this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive(2); } catch (IOException e) { From c430c98e191a99171f3d0707ac8fa693fd1b429b Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Thu, 1 Feb 2024 20:20:04 -0500 Subject: [PATCH 19/31] grimpeur --- src/main/java/frc/robot/RobotContainer.java | 8 ++++++-- .../{GrimpeurHautDroit.java => GrimpeurDroit.java} | 12 ++++++++---- .../{GrimpeurHautGauche.java => GrimpeurGauche.java} | 12 ++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) rename src/main/java/frc/robot/command/{GrimpeurHautDroit.java => GrimpeurDroit.java} (77%) rename src/main/java/frc/robot/command/{GrimpeurHautGauche.java => GrimpeurGauche.java} (77%) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 2e84c89..eab4885 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -22,6 +22,8 @@ import edu.wpi.first.wpilibj2.command.button.CommandXboxController; // Commands import frc.robot.command.Balayer; +import frc.robot.command.GrimpeurDroit; +import frc.robot.command.GrimpeurGauche; import frc.robot.command.GuiderBas; import frc.robot.command.GuiderHaut; import frc.robot.command.Lancer; @@ -49,6 +51,8 @@ public class RobotContainer { GuiderBas guiderBas = new GuiderBas(guideur); LancerNote lancernote = new LancerNote(lanceur, accumulateur); Lancerampli lancerampli = new Lancerampli(lanceur); + GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, null); + GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, null); CommandJoystick joystick = new CommandJoystick(0); CommandXboxController manette = new CommandXboxController(1); @@ -68,8 +72,8 @@ public class RobotContainer { } private void configureBindings() { - - joystick.button(3).toggleOnTrue(balayer); + + joystick.button(3).toggleOnTrue(balayer); } diff --git a/src/main/java/frc/robot/command/GrimpeurHautDroit.java b/src/main/java/frc/robot/command/GrimpeurDroit.java similarity index 77% rename from src/main/java/frc/robot/command/GrimpeurHautDroit.java rename to src/main/java/frc/robot/command/GrimpeurDroit.java index 324501f..2cbbe9f 100644 --- a/src/main/java/frc/robot/command/GrimpeurHautDroit.java +++ b/src/main/java/frc/robot/command/GrimpeurDroit.java @@ -4,13 +4,17 @@ package frc.robot.command; +import java.util.function.DoubleSupplier; + import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystem.Grimpeur; -public class GrimpeurHautDroit extends Command { +public class GrimpeurDroit extends Command { + private DoubleSupplier doubleSupplier; private Grimpeur grimpeur; /** Creates a new GrimpeurHaut. */ - public GrimpeurHautDroit(Grimpeur grimpeur) { + public GrimpeurDroit(Grimpeur grimpeur, DoubleSupplier doubleSupplier) { + this.doubleSupplier = doubleSupplier; this.grimpeur = grimpeur; addRequirements(grimpeur); // Use addRequirements() here to declare subsystem dependencies. @@ -31,11 +35,11 @@ public class GrimpeurHautDroit extends Command { grimpeur.droit(0); } else if(grimpeur.getpitch()<-15){ - grimpeur.droit(-0.6); + grimpeur.droit(-doubleSupplier.getAsDouble()); } else if(grimpeur.getpitch()>15){ - grimpeur.droit(0.6); + grimpeur.droit(doubleSupplier.getAsDouble()); } else{ grimpeur.droit(0); diff --git a/src/main/java/frc/robot/command/GrimpeurHautGauche.java b/src/main/java/frc/robot/command/GrimpeurGauche.java similarity index 77% rename from src/main/java/frc/robot/command/GrimpeurHautGauche.java rename to src/main/java/frc/robot/command/GrimpeurGauche.java index 2bd6593..c062655 100644 --- a/src/main/java/frc/robot/command/GrimpeurHautGauche.java +++ b/src/main/java/frc/robot/command/GrimpeurGauche.java @@ -4,13 +4,17 @@ package frc.robot.command; +import java.util.function.DoubleSupplier; + import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystem.Grimpeur; -public class GrimpeurHautGauche extends Command { +public class GrimpeurGauche extends Command { + private DoubleSupplier doubleSupplier; private Grimpeur grimpeur; /** Creates a new GrimpeurHautGauche. */ - public GrimpeurHautGauche(Grimpeur grimpeur) { + public GrimpeurGauche(Grimpeur grimpeur,DoubleSupplier doubleSupplier) { + this.doubleSupplier = doubleSupplier; this.grimpeur = grimpeur; addRequirements(grimpeur); // Use addRequirements() here to declare subsystem dependencies. @@ -30,11 +34,11 @@ public class GrimpeurHautGauche extends Command { grimpeur.gauche(0); } else if(grimpeur.getpitch()<-15){ - grimpeur.gauche(0.6); + grimpeur.gauche(doubleSupplier.getAsDouble()); } else if(grimpeur.getpitch()>15){ - grimpeur.gauche(-0.6); + grimpeur.gauche(-doubleSupplier.getAsDouble()); } else{ grimpeur.gauche(0); From 4330ab07f46b20777baa64778ea4900df1eb0805 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Mon, 5 Feb 2024 18:08:26 -0500 Subject: [PATCH 20/31] dashboard acc --- src/main/java/frc/robot/command/Balayer.java | 2 +- src/main/java/frc/robot/subsystem/Accumulateur.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/command/Balayer.java b/src/main/java/frc/robot/command/Balayer.java index 31b57f1..61a1dc7 100644 --- a/src/main/java/frc/robot/command/Balayer.java +++ b/src/main/java/frc/robot/command/Balayer.java @@ -30,7 +30,7 @@ public class Balayer extends Command { } else{ balayeuse.balaye(0.6); - accumulateur.Accumuler(0.6); + accumulateur.Accumuler(); } } diff --git a/src/main/java/frc/robot/subsystem/Accumulateur.java b/src/main/java/frc/robot/subsystem/Accumulateur.java index fb3b646..82ade1e 100644 --- a/src/main/java/frc/robot/subsystem/Accumulateur.java +++ b/src/main/java/frc/robot/subsystem/Accumulateur.java @@ -6,6 +6,7 @@ package frc.robot.subsystem; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; +import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; @@ -17,7 +18,10 @@ import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout; public class Accumulateur extends SubsystemBase { /** Creates a new Accumulateur. */ - ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); + ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); + private GenericEntry vitesse = + dashboard.add("vitesseacc", 1) + .getEntry(); final WPI_TalonSRX Moteuracc2 = new WPI_TalonSRX(Constants.Moteuracc2); final WPI_TalonSRX Moteuracc = new WPI_TalonSRX(Constants.Moteuracc); final DigitalInput limitacc = new DigitalInput(Constants.limitacc); @@ -33,12 +37,16 @@ public class Accumulateur extends SubsystemBase { return limitacc.get(); } public Accumulateur() { + dashboard.addBoolean("limitacc", this::limitswitch); } public void Accumuler(double vitesse){ Moteuracc.set(vitesse); Moteuracc2.set(vitesse); } + public void Accumuler(){ + Accumuler(vitesse.getDouble(0.1)); + } @Override public void periodic() { From 723d9184105746c5ae980baefe27f2a8ad35b7f1 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 5 Feb 2024 18:44:03 -0500 Subject: [PATCH 21/31] --- src/main/java/frc/robot/RobotContainer.java | 5 ++--- src/main/java/frc/robot/command/GrimpeurDroit.java | 12 +++++++++--- src/main/java/frc/robot/command/GrimpeurGauche.java | 8 +++++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index eab4885..c75bdd6 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -51,11 +51,10 @@ public class RobotContainer { GuiderBas guiderBas = new GuiderBas(guideur); LancerNote lancernote = new LancerNote(lanceur, accumulateur); Lancerampli lancerampli = new Lancerampli(lanceur); - GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, null); - GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, null); CommandJoystick joystick = new CommandJoystick(0); CommandXboxController manette = new CommandXboxController(1); - + GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur,null); + GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, null); public RobotContainer() { NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur)); NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur)); diff --git a/src/main/java/frc/robot/command/GrimpeurDroit.java b/src/main/java/frc/robot/command/GrimpeurDroit.java index 2cbbe9f..0aa2c46 100644 --- a/src/main/java/frc/robot/command/GrimpeurDroit.java +++ b/src/main/java/frc/robot/command/GrimpeurDroit.java @@ -24,15 +24,16 @@ public class GrimpeurDroit extends Command { @Override public void initialize() { grimpeur.resetencodeurd(); - grimpeur.resetencodeurg(); + grimpeur.pistonferme(); } // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - - if(grimpeur.encoderd()>261 ){ + grimpeur.droit(doubleSupplier.getAsDouble()); + if(grimpeur.encoderd()>261){ grimpeur.droit(0); + } else if(grimpeur.getpitch()<-15){ grimpeur.droit(-doubleSupplier.getAsDouble()); @@ -44,6 +45,11 @@ public class GrimpeurDroit extends Command { else{ grimpeur.droit(0); } + if(grimpeur.encoderd()>0){ + grimpeur.resetencodeurd(); + grimpeur.droit(0); + + } } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/command/GrimpeurGauche.java b/src/main/java/frc/robot/command/GrimpeurGauche.java index c062655..11a5685 100644 --- a/src/main/java/frc/robot/command/GrimpeurGauche.java +++ b/src/main/java/frc/robot/command/GrimpeurGauche.java @@ -30,7 +30,8 @@ public class GrimpeurGauche extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(grimpeur.encoderg()>261 ){ + grimpeur.gauche(doubleSupplier.getAsDouble()); + if(grimpeur.encoderg()>261){ grimpeur.gauche(0); } else if(grimpeur.getpitch()<-15){ @@ -43,6 +44,11 @@ public class GrimpeurGauche extends Command { else{ grimpeur.gauche(0); } + if(grimpeur.encoderd()>0){ + grimpeur.resetencodeurg(); + grimpeur.gauche(0); + + } } // Called once the command ends or is interrupted. From 4031211d0e345b530f3ee6bde9894bf0cde8eeec Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 5 Feb 2024 19:14:59 -0500 Subject: [PATCH 22/31] --- src/main/java/frc/robot/RobotContainer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index c75bdd6..523aa6f 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -53,8 +53,8 @@ public class RobotContainer { Lancerampli lancerampli = new Lancerampli(lanceur); CommandJoystick joystick = new CommandJoystick(0); CommandXboxController manette = new CommandXboxController(1); - GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur,null); - GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, null); + GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftX); + GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getLeftY); public RobotContainer() { NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur)); NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur)); From f5e879878a37aa69eabcd511ae885ca7ec4d3d19 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Mon, 5 Feb 2024 19:15:56 -0500 Subject: [PATCH 23/31] avancement du dashboard --- src/main/java/frc/robot/RobotContainer.java | 1 + src/main/java/frc/robot/command/Balayer.java | 2 +- src/main/java/frc/robot/command/Lancer.java | 2 +- .../java/frc/robot/command/LancerNote.java | 2 +- .../java/frc/robot/command/Lancerampli.java | 2 +- .../java/frc/robot/subsystem/Lanceur.java | 23 +++++++++++++++---- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 2e84c89..12bf559 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -47,6 +47,7 @@ public class RobotContainer { Balayer balayer = new Balayer(balayeuse, accumulateur); GuiderHaut guiderHaut = new GuiderHaut(guideur); GuiderBas guiderBas = new GuiderBas(guideur); + Lancer lancer = new Lancer(lanceur); LancerNote lancernote = new LancerNote(lanceur, accumulateur); Lancerampli lancerampli = new Lancerampli(lanceur); CommandJoystick joystick = new CommandJoystick(0); diff --git a/src/main/java/frc/robot/command/Balayer.java b/src/main/java/frc/robot/command/Balayer.java index 61a1dc7..58e3531 100644 --- a/src/main/java/frc/robot/command/Balayer.java +++ b/src/main/java/frc/robot/command/Balayer.java @@ -26,7 +26,7 @@ public class Balayer extends Command { public void execute() { if(accumulateur.limitswitch()){ balayeuse.balaye(0); - accumulateur.Accumuler(0); + accumulateur.Accumuler(); } else{ balayeuse.balaye(0.6); diff --git a/src/main/java/frc/robot/command/Lancer.java b/src/main/java/frc/robot/command/Lancer.java index 20e58e1..de4314e 100644 --- a/src/main/java/frc/robot/command/Lancer.java +++ b/src/main/java/frc/robot/command/Lancer.java @@ -26,7 +26,7 @@ public class Lancer extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - lanceur.lancer(0.3); + lanceur.lancerspeaker(); } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/command/LancerNote.java b/src/main/java/frc/robot/command/LancerNote.java index 76fed0d..d653184 100644 --- a/src/main/java/frc/robot/command/LancerNote.java +++ b/src/main/java/frc/robot/command/LancerNote.java @@ -26,7 +26,7 @@ public class LancerNote extends Command { @Override public void execute() { double vitesse = 100; - lancer.lancer(vitesse); + lancer.lancerspeaker(); if(lancer.vitesse(vitesse)>vitesse){ accumulateur.Accumuler(0.6); } diff --git a/src/main/java/frc/robot/command/Lancerampli.java b/src/main/java/frc/robot/command/Lancerampli.java index 81701e7..450c87a 100644 --- a/src/main/java/frc/robot/command/Lancerampli.java +++ b/src/main/java/frc/robot/command/Lancerampli.java @@ -28,7 +28,7 @@ public class Lancerampli extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - lanceur.lancer(0.1); + lanceur.lanceramp(); } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/subsystem/Lanceur.java b/src/main/java/frc/robot/subsystem/Lanceur.java index f5a58cc..b14978d 100644 --- a/src/main/java/frc/robot/subsystem/Lanceur.java +++ b/src/main/java/frc/robot/subsystem/Lanceur.java @@ -7,15 +7,24 @@ package frc.robot.subsystem; import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkLowLevel.MotorType; - +import edu.wpi.first.networktables.GenericEntry; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; public class Lanceur extends SubsystemBase { /** Creates a new Lanceur. */ - - - public Lanceur() {} + ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); + private GenericEntry vitesse = + dashboard.add("vitesse", 1) + .getEntry(); + private GenericEntry vitesseamp = + dashboard.add("vitesseamp", 1) + .getEntry(); + public Lanceur() { + + } final CANSparkMax lanceur1 = new CANSparkMax(Constants.lanceur, MotorType.kBrushless); final CANSparkMax lanceur2 = new CANSparkMax(Constants.lancer2, MotorType.kBrushless); final CANSparkMax lanceur3 = new CANSparkMax(Constants.lancer3, MotorType.kBrushless); @@ -26,6 +35,12 @@ public class Lanceur extends SubsystemBase { public void lancer(double vitesse){ lanceur1.set(vitesse); } + public void lancerspeaker(){ + lancer(vitesse.getDouble(0.1)); + } + public void lanceramp(){ + lancer(vitesseamp.getDouble(0.5)); + } public double vitesse(double vitesse){ return lanceur1.getEncoder().getVelocity(); } From c257411505738931ee48505e1151083466f39aa0 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 5 Feb 2024 20:24:04 -0500 Subject: [PATCH 24/31] led --- src/main/java/frc/robot/RobotContainer.java | 7 ++- .../java/frc/robot/command/AllumeLED.java | 48 +++++++++++++++++++ src/main/java/frc/robot/subsystem/LED.java | 27 +++++++++++ 3 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 src/main/java/frc/robot/command/AllumeLED.java create mode 100644 src/main/java/frc/robot/subsystem/LED.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 3fb4b54..ddffae3 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -62,8 +62,9 @@ public class RobotContainer { autoChooser = AutoBuilder.buildAutoChooser(); CameraServer.startAutomaticCapture(); - manette.a().onTrue(guiderBas); - manette.b().onTrue(guiderHaut); + manette.a().whileTrue(guiderBas); + manette.b().whileTrue(guiderHaut); + joystick.button(3).toggleOnTrue(balayer); configureBindings(); drive.setDefaultCommand(new RunCommand(()->{ drive.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2)); @@ -73,8 +74,6 @@ public class RobotContainer { private void configureBindings() { - joystick.button(3).toggleOnTrue(balayer); - } public Command getAutonomousCommand(){ diff --git a/src/main/java/frc/robot/command/AllumeLED.java b/src/main/java/frc/robot/command/AllumeLED.java new file mode 100644 index 0000000..9ba8c16 --- /dev/null +++ b/src/main/java/frc/robot/command/AllumeLED.java @@ -0,0 +1,48 @@ +// 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; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystem.Accumulateur; +import frc.robot.subsystem.LED; + +public class AllumeLED extends Command { + private LED led; + private Accumulateur accumulateur; + /** Creates a new AllumeLED. */ + public AllumeLED(LED led,Accumulateur accumulateur) { + this.accumulateur = accumulateur; + this.led = led; + addRequirements(led,accumulateur); + // 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() { + if(accumulateur.limitswitch()){ + led.couleur(0, 255, 0); + } + else{ + led.couleur(255, 0, 0); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + led.couleur(255, 0, 0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/subsystem/LED.java b/src/main/java/frc/robot/subsystem/LED.java new file mode 100644 index 0000000..8bc91cc --- /dev/null +++ b/src/main/java/frc/robot/subsystem/LED.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.subsystem; + +import edu.wpi.first.wpilibj.AddressableLED; +import edu.wpi.first.wpilibj.AddressableLEDBuffer; +import edu.wpi.first.wpilibj2.command.SubsystemBase; + +public class LED extends SubsystemBase { + /** Creates a new LED. */ + public LED() {} + AddressableLED led = new AddressableLED(9); + AddressableLEDBuffer ledBuffer = new AddressableLEDBuffer(60); + public void led(){ + led.setData(ledBuffer); + led.start(); + } + public void couleur(int R, int G, int B){ + ledBuffer.setRGB(0, R, G, B); + } + @Override + public void periodic() { + // This method will be called once per scheduler run + } +} From a708aac7003f31da65b076fd3abc90a91f820e0f Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 6 Feb 2024 18:17:08 -0500 Subject: [PATCH 25/31] --- src/main/java/frc/robot/RobotContainer.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index ddffae3..44a48ea 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -19,7 +19,7 @@ import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; // Manettes import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; - +import frc.robot.command.AllumeLED; // Commands import frc.robot.command.Balayer; import frc.robot.command.GrimpeurDroit; @@ -35,6 +35,7 @@ import frc.robot.subsystem.Balayeuse; import frc.robot.subsystem.Drive; import frc.robot.subsystem.Grimpeur; import frc.robot.subsystem.Guideur; +import frc.robot.subsystem.LED; import frc.robot.subsystem.Lanceur; @@ -56,6 +57,8 @@ public class RobotContainer { CommandXboxController manette = new CommandXboxController(1); GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftX); GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getLeftY); + LED LED = new LED(); + AllumeLED allumeLED = new AllumeLED(LED, accumulateur); public RobotContainer() { NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur)); NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur)); @@ -69,7 +72,10 @@ public class RobotContainer { drive.setDefaultCommand(new RunCommand(()->{ drive.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2)); },drive)); - + grimpeur.setDefaultCommand(new RunCommand(()->{ + grimpeur.droit(manette.getLeftX());} + ,grimpeur)); + LED.setDefaultCommand(allumeLED); } private void configureBindings() { From f293f07bbdb8aaef8066aad0a1f78d61092e7db1 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 6 Feb 2024 18:31:05 -0500 Subject: [PATCH 26/31] LED --- src/main/java/frc/robot/RobotContainer.java | 2 +- src/main/java/frc/robot/command/AllumeLED.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 44a48ea..6df4895 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -58,7 +58,7 @@ public class RobotContainer { GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftX); GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getLeftY); LED LED = new LED(); - AllumeLED allumeLED = new AllumeLED(LED, accumulateur); + AllumeLED allumeLED = new AllumeLED(LED); public RobotContainer() { NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur)); NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur)); diff --git a/src/main/java/frc/robot/command/AllumeLED.java b/src/main/java/frc/robot/command/AllumeLED.java index 9ba8c16..484ecb3 100644 --- a/src/main/java/frc/robot/command/AllumeLED.java +++ b/src/main/java/frc/robot/command/AllumeLED.java @@ -15,7 +15,7 @@ public class AllumeLED extends Command { public AllumeLED(LED led,Accumulateur accumulateur) { this.accumulateur = accumulateur; this.led = led; - addRequirements(led,accumulateur); + addRequirements(led); // Use addRequirements() here to declare subsystem dependencies. } From b4ee2d228af6ef566bc4cc1a85e490c3e8e3ed1f Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 6 Feb 2024 18:32:56 -0500 Subject: [PATCH 27/31] LED --- src/main/java/frc/robot/command/AllumeLED.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/command/AllumeLED.java b/src/main/java/frc/robot/command/AllumeLED.java index 484ecb3..dd1d09e 100644 --- a/src/main/java/frc/robot/command/AllumeLED.java +++ b/src/main/java/frc/robot/command/AllumeLED.java @@ -12,7 +12,7 @@ public class AllumeLED extends Command { private LED led; private Accumulateur accumulateur; /** Creates a new AllumeLED. */ - public AllumeLED(LED led,Accumulateur accumulateur) { + public AllumeLED(LED led) { this.accumulateur = accumulateur; this.led = led; addRequirements(led); From e72a23fdde21208eb352ed7095fb7b2889b47b11 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 6 Feb 2024 18:48:33 -0500 Subject: [PATCH 28/31] Pixy --- src/main/java/frc/robot/PixyException.java | 8 ++++++++ src/main/java/frc/robot/PixyPacket.java | 9 +++++++++ src/main/java/frc/robot/subsystem/Pixy.java | 1 - 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/main/java/frc/robot/PixyException.java create mode 100644 src/main/java/frc/robot/PixyPacket.java diff --git a/src/main/java/frc/robot/PixyException.java b/src/main/java/frc/robot/PixyException.java new file mode 100644 index 0000000..c4fd3c0 --- /dev/null +++ b/src/main/java/frc/robot/PixyException.java @@ -0,0 +1,8 @@ +package frc.robot; + +public class PixyException extends Exception { + public PixyException(String message){ + super(message); + } + +} diff --git a/src/main/java/frc/robot/PixyPacket.java b/src/main/java/frc/robot/PixyPacket.java new file mode 100644 index 0000000..d52adfe --- /dev/null +++ b/src/main/java/frc/robot/PixyPacket.java @@ -0,0 +1,9 @@ +package frc.robot; + +public class PixyPacket { + public int X; + public int Y; + public int Width; + public int Height; + +} diff --git a/src/main/java/frc/robot/subsystem/Pixy.java b/src/main/java/frc/robot/subsystem/Pixy.java index f56c0d2..468a421 100644 --- a/src/main/java/frc/robot/subsystem/Pixy.java +++ b/src/main/java/frc/robot/subsystem/Pixy.java @@ -7,7 +7,6 @@ package frc.robot.subsystem; import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Pixy extends SubsystemBase { - /** Creates a new Pixy. */ public Pixy() {} From add3237dc5d8f04cd07c29332fff29a5efbfc5a0 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 6 Feb 2024 18:55:13 -0500 Subject: [PATCH 29/31] --- src/main/java/frc/robot/Pixy.java | 73 +++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/main/java/frc/robot/Pixy.java diff --git a/src/main/java/frc/robot/Pixy.java b/src/main/java/frc/robot/Pixy.java new file mode 100644 index 0000000..94c01b5 --- /dev/null +++ b/src/main/java/frc/robot/Pixy.java @@ -0,0 +1,73 @@ +package frc.robot; + + +import edu.wpi.first.wpilibj.SerialPort; +import edu.wpi.first.wpilibj.SerialPort.Port; +//Warning: if the pixy is plugged in through mini usb, this code WILL NOT WORK b/c the pixy is smart and detects where it should send data +public class Pixy { + SerialPort pixy; + Port port = Port.kMXP; + PixyPacket[] packets; + PixyException pExc; + String print; + + public Pixy() { + pixy = new SerialPort(19200, port); + pixy.setReadBufferSize(14); + packets = new PixyPacket[7]; + pExc = new PixyException(print); + } + //This method parses raw data from the pixy into readable integers + public int cvt(byte upper, byte lower) { + return (((int)upper & 0xff) << 8) | ((int)lower & 0xff); + } + public void pixyReset(){ + pixy.reset(); + } + //This method gathers data, then parses that data, and assigns the ints to global variables + public PixyPacket readPacket(int Signature) throws PixyException { + int Checksum; + int Sig; + byte[] rawData = new byte[32]; + try{ + rawData = pixy.read(32); + } catch (RuntimeException e){ + + } + if(rawData.length < 32){ + return null; + } + for (int i = 0; i <= 16; i++) { + int syncWord = cvt(rawData[i+1], rawData[i+0]); //Parse first 2 bytes + if (syncWord == 0xaa55) { //Check is first 2 bytes equal a "sync word", which indicates the start of a packet of valid data + syncWord = cvt(rawData[i+3], rawData[i+2]); //Parse the next 2 bytes + + if (syncWord != 0xaa55){ //Shifts everything in the case that one syncword is sent + i -= 2; + } + //This next block parses the rest of the data + Checksum = cvt(rawData[i+5], rawData[i+4]); + Sig = cvt(rawData[i+7], rawData[i+6]); + if(Sig <= 0 || Sig > packets.length){ + break; + } + packets[Sig - 1] = new PixyPacket(); + packets[Sig - 1].X = cvt(rawData[i+9], rawData[i+8]); + packets[Sig - 1].Y = cvt(rawData[i+11], rawData[i+10]); + packets[Sig - 1].Width = cvt(rawData[i+13], rawData[i+12]); + packets[Sig - 1].Height = cvt(rawData[i+15], rawData[i+14]); + //Checks whether the data is valid using the checksum *This if block should never be entered* + if (Checksum != Sig + packets[Sig - 1].X + packets[Sig - 1].Y + packets[Sig - 1].Width + packets[Sig - 1].Height) { + packets[Sig - 1] = null; + throw pExc; + } + break; + } + } + //Assigns our packet to a temp packet, then deletes data so that we dont return old data + + PixyPacket pkt = packets[Signature - 1]; + packets[Signature - 1] = null; + return pkt; + } +} \ No newline at end of file From b6e9c303f35f013843697b931b92cda099c620c4 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 6 Feb 2024 19:01:04 -0500 Subject: [PATCH 30/31] Pixy --- src/main/java/frc/robot/Pixy.java | 73 ------------------ src/main/java/frc/robot/RobotContainer.java | 2 + src/main/java/frc/robot/subsystem/Pixy.java | 82 ++++++++++++++++++--- 3 files changed, 72 insertions(+), 85 deletions(-) delete mode 100644 src/main/java/frc/robot/Pixy.java diff --git a/src/main/java/frc/robot/Pixy.java b/src/main/java/frc/robot/Pixy.java deleted file mode 100644 index 94c01b5..0000000 --- a/src/main/java/frc/robot/Pixy.java +++ /dev/null @@ -1,73 +0,0 @@ -package frc.robot; - - -import edu.wpi.first.wpilibj.SerialPort; -import edu.wpi.first.wpilibj.SerialPort.Port; -//Warning: if the pixy is plugged in through mini usb, this code WILL NOT WORK b/c the pixy is smart and detects where it should send data -public class Pixy { - SerialPort pixy; - Port port = Port.kMXP; - PixyPacket[] packets; - PixyException pExc; - String print; - - public Pixy() { - pixy = new SerialPort(19200, port); - pixy.setReadBufferSize(14); - packets = new PixyPacket[7]; - pExc = new PixyException(print); - } - //This method parses raw data from the pixy into readable integers - public int cvt(byte upper, byte lower) { - return (((int)upper & 0xff) << 8) | ((int)lower & 0xff); - } - public void pixyReset(){ - pixy.reset(); - } - //This method gathers data, then parses that data, and assigns the ints to global variables - public PixyPacket readPacket(int Signature) throws PixyException { - int Checksum; - int Sig; - byte[] rawData = new byte[32]; - try{ - rawData = pixy.read(32); - } catch (RuntimeException e){ - - } - if(rawData.length < 32){ - return null; - } - for (int i = 0; i <= 16; i++) { - int syncWord = cvt(rawData[i+1], rawData[i+0]); //Parse first 2 bytes - if (syncWord == 0xaa55) { //Check is first 2 bytes equal a "sync word", which indicates the start of a packet of valid data - syncWord = cvt(rawData[i+3], rawData[i+2]); //Parse the next 2 bytes - - if (syncWord != 0xaa55){ //Shifts everything in the case that one syncword is sent - i -= 2; - } - //This next block parses the rest of the data - Checksum = cvt(rawData[i+5], rawData[i+4]); - Sig = cvt(rawData[i+7], rawData[i+6]); - if(Sig <= 0 || Sig > packets.length){ - break; - } - packets[Sig - 1] = new PixyPacket(); - packets[Sig - 1].X = cvt(rawData[i+9], rawData[i+8]); - packets[Sig - 1].Y = cvt(rawData[i+11], rawData[i+10]); - packets[Sig - 1].Width = cvt(rawData[i+13], rawData[i+12]); - packets[Sig - 1].Height = cvt(rawData[i+15], rawData[i+14]); - //Checks whether the data is valid using the checksum *This if block should never be entered* - if (Checksum != Sig + packets[Sig - 1].X + packets[Sig - 1].Y + packets[Sig - 1].Width + packets[Sig - 1].Height) { - packets[Sig - 1] = null; - throw pExc; - } - break; - } - } - //Assigns our packet to a temp packet, then deletes data so that we dont return old data - - PixyPacket pkt = packets[Signature - 1]; - packets[Signature - 1] = null; - return pkt; - } -} \ No newline at end of file diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 6df4895..9368be5 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -37,6 +37,7 @@ import frc.robot.subsystem.Grimpeur; import frc.robot.subsystem.Guideur; import frc.robot.subsystem.LED; import frc.robot.subsystem.Lanceur; +import frc.robot.subsystem.Pixy; public class RobotContainer { @@ -59,6 +60,7 @@ public class RobotContainer { GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getLeftY); LED LED = new LED(); AllumeLED allumeLED = new AllumeLED(LED); + Pixy pixy = new Pixy(); public RobotContainer() { NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur)); NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur)); diff --git a/src/main/java/frc/robot/subsystem/Pixy.java b/src/main/java/frc/robot/subsystem/Pixy.java index 468a421..8cd59b9 100644 --- a/src/main/java/frc/robot/subsystem/Pixy.java +++ b/src/main/java/frc/robot/subsystem/Pixy.java @@ -1,17 +1,75 @@ -// 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.subsystem; import edu.wpi.first.wpilibj2.command.SubsystemBase; - +import frc.robot.PixyException; +import frc.robot.PixyPacket; +import edu.wpi.first.wpilibj.SerialPort; +import edu.wpi.first.wpilibj.SerialPort.Port; +//Warning: if the pixy is plugged in through mini usb, this code WILL NOT WORK b/c the pixy is smart and detects where it should send data public class Pixy extends SubsystemBase { - /** Creates a new Pixy. */ - public Pixy() {} + SerialPort pixy; + Port port = Port.kMXP; + PixyPacket[] packets; + PixyException pExc; + String print; - @Override - public void periodic() { - // This method will be called once per scheduler run - } -} + public Pixy() { + pixy = new SerialPort(19200, port); + pixy.setReadBufferSize(14); + packets = new PixyPacket[7]; + pExc = new PixyException(print); + } + //This method parses raw data from the pixy into readable integers + public int cvt(byte upper, byte lower) { + return (((int)upper & 0xff) << 8) | ((int)lower & 0xff); + } + public void pixyReset(){ + pixy.reset(); + } + //This method gathers data, then parses that data, and assigns the ints to global variables + public PixyPacket readPacket(int Signature) throws PixyException { + int Checksum; + int Sig; + byte[] rawData = new byte[32]; + try{ + rawData = pixy.read(32); + } catch (RuntimeException e){ + + } + if(rawData.length < 32){ + return null; + } + for (int i = 0; i <= 16; i++) { + int syncWord = cvt(rawData[i+1], rawData[i+0]); //Parse first 2 bytes + if (syncWord == 0xaa55) { //Check is first 2 bytes equal a "sync word", which indicates the start of a packet of valid data + syncWord = cvt(rawData[i+3], rawData[i+2]); //Parse the next 2 bytes + + if (syncWord != 0xaa55){ //Shifts everything in the case that one syncword is sent + i -= 2; + } + //This next block parses the rest of the data + Checksum = cvt(rawData[i+5], rawData[i+4]); + Sig = cvt(rawData[i+7], rawData[i+6]); + if(Sig <= 0 || Sig > packets.length){ + break; + } + packets[Sig - 1] = new PixyPacket(); + packets[Sig - 1].X = cvt(rawData[i+9], rawData[i+8]); + packets[Sig - 1].Y = cvt(rawData[i+11], rawData[i+10]); + packets[Sig - 1].Width = cvt(rawData[i+13], rawData[i+12]); + packets[Sig - 1].Height = cvt(rawData[i+15], rawData[i+14]); + //Checks whether the data is valid using the checksum *This if block should never be entered* + if (Checksum != Sig + packets[Sig - 1].X + packets[Sig - 1].Y + packets[Sig - 1].Width + packets[Sig - 1].Height) { + packets[Sig - 1] = null; + throw pExc; + } + break; + } + } + //Assigns our packet to a temp packet, then deletes data so that we dont return old data + + PixyPacket pkt = packets[Signature - 1]; + packets[Signature - 1] = null; + return pkt; + } +} \ No newline at end of file From 3b44dbb6a66e45e0f5aeb8781c8fb10c122ec792 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 6 Feb 2024 19:08:49 -0500 Subject: [PATCH 31/31] --- src/main/java/frc/robot/RobotContainer.java | 1 + .../java/frc/robot/command/RobotPixy.java | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/main/java/frc/robot/command/RobotPixy.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 9368be5..4ba1d18 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -70,6 +70,7 @@ public class RobotContainer { manette.a().whileTrue(guiderBas); manette.b().whileTrue(guiderHaut); joystick.button(3).toggleOnTrue(balayer); + configureBindings(); drive.setDefaultCommand(new RunCommand(()->{ drive.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2)); diff --git a/src/main/java/frc/robot/command/RobotPixy.java b/src/main/java/frc/robot/command/RobotPixy.java new file mode 100644 index 0000000..652c4c3 --- /dev/null +++ b/src/main/java/frc/robot/command/RobotPixy.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.command; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystem.Drive; +import frc.robot.subsystem.Pixy; + +public class RobotPixy extends Command { + private Pixy pixy; + private Drive drive; + /** Creates a new RobotPixy. */ + public RobotPixy(Pixy pixy,Drive drive) { + this.drive = drive; + this.pixy = pixy; + addRequirements(drive,pixy); + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +}