From fd8ab8663bd04e869d05cce1e9bce9476aa50f13 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 27 Jan 2025 20:14:20 -0500 Subject: [PATCH 01/37] baleeuse --- .../java/frc/robot/command/BalayeuseHaut.java | 46 +++++++++++++++++++ .../java/frc/robot/subsystems/Requin.java | 41 +++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 src/main/java/frc/robot/command/BalayeuseHaut.java create mode 100644 src/main/java/frc/robot/subsystems/Requin.java diff --git a/src/main/java/frc/robot/command/BalayeuseHaut.java b/src/main/java/frc/robot/command/BalayeuseHaut.java new file mode 100644 index 0000000..4dc75c8 --- /dev/null +++ b/src/main/java/frc/robot/command/BalayeuseHaut.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 edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class BalayeuseHaut extends Command { + private Requin requin; + /** Creates a new Balayeuse. */ + public BalayeuseHaut(Requin requin) { + this.requin = requin; + addRequirements(requin); + // 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(requin.enHaut()==true){ + requin.rotationer(0); + } + else{ + requin.rotationer(0.5); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.rotationer(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java new file mode 100644 index 0000000..f200054 --- /dev/null +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -0,0 +1,41 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.subsystems; + +import com.revrobotics.spark.SparkFlex; +import com.revrobotics.spark.SparkMax; +import com.revrobotics.spark.SparkLowLevel.MotorType; + +import edu.wpi.first.wpilibj.DigitalInput; +import edu.wpi.first.wpilibj2.command.SubsystemBase; + +public class Requin extends SubsystemBase { + /** Creates a new Requin. */ + public Requin() {} + final SparkFlex balaye = new SparkFlex(0, MotorType.kBrushless); + final SparkMax rotatione = new SparkMax(0, MotorType.kBrushless); + final DigitalInput limit3 = new DigitalInput(0); + final DigitalInput limit4 = new DigitalInput(0); + final DigitalInput limit5 = new DigitalInput(0); + public void balaye(double vitesse){ + balaye.set(vitesse); + } + public void rotationer(double vitesse){ + rotatione.set(vitesse); + } + public boolean enHaut(){ + return limit3.get(); + } + public boolean enBas(){ + return limit4.get(); + } + public boolean stop(){ + return limit5.get(); + } + @Override + public void periodic() { + // This method will be called once per scheduler run + } +} From 72da7b7d74a22f942be57d29668c3e580e17cfdc Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 28 Jan 2025 17:56:40 -0500 Subject: [PATCH 02/37] requin rotatione --- .../java/frc/robot/command/BalayeuseBas.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/main/java/frc/robot/command/BalayeuseBas.java diff --git a/src/main/java/frc/robot/command/BalayeuseBas.java b/src/main/java/frc/robot/command/BalayeuseBas.java new file mode 100644 index 0000000..110dd8c --- /dev/null +++ b/src/main/java/frc/robot/command/BalayeuseBas.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 edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class BalayeuseBas extends Command { + private Requin requin; + /** Creates a new Balayeuse. */ + public BalayeuseBas(Requin requin) { + this.requin = requin; + addRequirements(requin); + // 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(requin.enBas()==true){ + requin.rotationer(0); + } + else{ + requin.rotationer(-0.5); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.rotationer(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From e4c7a1260673ed5ca774e4218f0d84aa5ef49404 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 28 Jan 2025 18:02:53 -0500 Subject: [PATCH 03/37] balaye --- src/main/java/frc/robot/command/BalayeuseBas.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/frc/robot/command/BalayeuseBas.java b/src/main/java/frc/robot/command/BalayeuseBas.java index 110dd8c..b4016a6 100644 --- a/src/main/java/frc/robot/command/BalayeuseBas.java +++ b/src/main/java/frc/robot/command/BalayeuseBas.java @@ -30,12 +30,19 @@ public class BalayeuseBas extends Command { else{ requin.rotationer(-0.5); } + if(requin.stop()){ + requin.balaye(0); + } + else{ + requin.balaye(0.5); + } } // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { requin.rotationer(0); + requin.balaye(0); } // Returns true when the command should end. From 15be1d67ea1b9fa06099c0f0ec881050cec936e8 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 28 Jan 2025 18:05:47 -0500 Subject: [PATCH 04/37] L1 --- src/main/java/frc/robot/command/L1.java | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/main/java/frc/robot/command/L1.java diff --git a/src/main/java/frc/robot/command/L1.java b/src/main/java/frc/robot/command/L1.java new file mode 100644 index 0000000..35e8707 --- /dev/null +++ b/src/main/java/frc/robot/command/L1.java @@ -0,0 +1,41 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.command; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class L1 extends Command { + private Requin requin; + /** Creates a new L1. */ + public L1(Requin requin) { + this.requin = requin; + addRequirements(requin); + // 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() { + requin.balaye(-0.5); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.balaye(.0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From eec4eee2ff0563f29ee020a50e7e94ad404dfb3e Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 28 Jan 2025 19:34:18 -0500 Subject: [PATCH 05/37] baleeuse --- .../frc/robot/command/BalayeuseAlgue.java | 56 +++++++++++++++++++ .../frc/robot/command/BalayeuseCoral.java | 56 +++++++++++++++++++ .../java/frc/robot/command/BalayeuseHaut.java | 1 + .../{BalayeuseBas.java => L1Requin.java} | 9 ++- .../java/frc/robot/subsystems/Requin.java | 14 +++-- 5 files changed, 127 insertions(+), 9 deletions(-) create mode 100644 src/main/java/frc/robot/command/BalayeuseAlgue.java create mode 100644 src/main/java/frc/robot/command/BalayeuseCoral.java rename src/main/java/frc/robot/command/{BalayeuseBas.java => L1Requin.java} (86%) diff --git a/src/main/java/frc/robot/command/BalayeuseAlgue.java b/src/main/java/frc/robot/command/BalayeuseAlgue.java new file mode 100644 index 0000000..04e02fa --- /dev/null +++ b/src/main/java/frc/robot/command/BalayeuseAlgue.java @@ -0,0 +1,56 @@ +// 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.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class BalayeuseAlgue extends Command { + private Requin requin; + /** Creates a new Balayeuse. */ + public BalayeuseAlgue(Requin requin) { + this.requin = requin; + addRequirements(requin); + // 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(requin.encodeur()>=500 && requin.encodeur()<=510){ + requin.rotationer(0); + } + else if(requin.encodeur()>=510){ + requin.rotationer(0.5); + } + else{ + requin.rotationer(-0.5); + } + if(requin.stop()){ + requin.balaye(0); + } + else{ + requin.balaye(0.5); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.rotationer(0); + requin.balaye(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/command/BalayeuseCoral.java b/src/main/java/frc/robot/command/BalayeuseCoral.java new file mode 100644 index 0000000..6075a71 --- /dev/null +++ b/src/main/java/frc/robot/command/BalayeuseCoral.java @@ -0,0 +1,56 @@ +// 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.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class BalayeuseCoral extends Command { + private Requin requin; + /** Creates a new Balayeuse. */ + public BalayeuseCoral(Requin requin) { + this.requin = requin; + addRequirements(requin); + // 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(requin.encodeur()>=100 && requin.encodeur()<=110){ + requin.rotationer(0); + } + else if(requin.encodeur()>=110){ + requin.rotationer(0.5); + } + else{ + requin.rotationer(-0.5); + } + if(requin.stop()){ + requin.balaye(0); + } + else{ + requin.balaye(0.5); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.rotationer(0); + requin.balaye(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/command/BalayeuseHaut.java b/src/main/java/frc/robot/command/BalayeuseHaut.java index 4dc75c8..647c592 100644 --- a/src/main/java/frc/robot/command/BalayeuseHaut.java +++ b/src/main/java/frc/robot/command/BalayeuseHaut.java @@ -26,6 +26,7 @@ public class BalayeuseHaut extends Command { public void execute() { if(requin.enHaut()==true){ requin.rotationer(0); + requin.reset(); } else{ requin.rotationer(0.5); diff --git a/src/main/java/frc/robot/command/BalayeuseBas.java b/src/main/java/frc/robot/command/L1Requin.java similarity index 86% rename from src/main/java/frc/robot/command/BalayeuseBas.java rename to src/main/java/frc/robot/command/L1Requin.java index b4016a6..0dc75c5 100644 --- a/src/main/java/frc/robot/command/BalayeuseBas.java +++ b/src/main/java/frc/robot/command/L1Requin.java @@ -8,10 +8,10 @@ import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ -public class BalayeuseBas extends Command { +public class L1Requin extends Command { private Requin requin; /** Creates a new Balayeuse. */ - public BalayeuseBas(Requin requin) { + public L1Requin(Requin requin) { this.requin = requin; addRequirements(requin); // Use addRequirements() here to declare subsystem dependencies. @@ -24,9 +24,12 @@ public class BalayeuseBas extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(requin.enBas()==true){ + if(requin.encodeur()>=800 && requin.encodeur()<=810){ requin.rotationer(0); } + else if(requin.encodeur()>=810){ + requin.rotationer(0.5); + } else{ requin.rotationer(-0.5); } diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index f200054..5ebd547 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -17,23 +17,25 @@ public class Requin extends SubsystemBase { final SparkFlex balaye = new SparkFlex(0, MotorType.kBrushless); final SparkMax rotatione = new SparkMax(0, MotorType.kBrushless); final DigitalInput limit3 = new DigitalInput(0); - final DigitalInput limit4 = new DigitalInput(0); final DigitalInput limit5 = new DigitalInput(0); public void balaye(double vitesse){ balaye.set(vitesse); } public void rotationer(double vitesse){ - rotatione.set(vitesse); + rotatione.set(vitesse); } public boolean enHaut(){ - return limit3.get(); - } - public boolean enBas(){ - return limit4.get(); + return limit3.get(); } public boolean stop(){ return limit5.get(); } + public double encodeur(){ + return rotatione.getEncoder().getPosition(); + } + public void reset(){ + rotatione.getEncoder().setPosition(0); + } @Override public void periodic() { // This method will be called once per scheduler run From afe25cf046669e1045db9ea80ea6e95876eaf614 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 29 Jan 2025 19:41:28 -0500 Subject: [PATCH 06/37] pu L1 --- src/main/java/frc/robot/RobotContainer.java | 7 +++- src/main/java/frc/robot/command/L1.java | 41 --------------------- 2 files changed, 6 insertions(+), 42 deletions(-) delete mode 100644 src/main/java/frc/robot/command/L1.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index de2c9d0..61d2ac0 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -6,13 +6,18 @@ package frc.robot; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; +import edu.wpi.first.wpilibj2.command.button.CommandXboxController; public class RobotContainer { + CommandXboxController manette1 = new CommandXboxController(0); + CommandXboxController manette2 = new CommandXboxController(0); public RobotContainer() { configureBindings(); } - private void configureBindings() {} + private void configureBindings() { + + } public Command getAutonomousCommand() { return Commands.print("No autonomous command configured"); diff --git a/src/main/java/frc/robot/command/L1.java b/src/main/java/frc/robot/command/L1.java deleted file mode 100644 index 35e8707..0000000 --- a/src/main/java/frc/robot/command/L1.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package frc.robot.command; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.Requin; - -/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ -public class L1 extends Command { - private Requin requin; - /** Creates a new L1. */ - public L1(Requin requin) { - this.requin = requin; - addRequirements(requin); - // 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() { - requin.balaye(-0.5); - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - requin.balaye(.0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} From 4c49ad4e513986822a6f67562d07c1864e77c5af Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 29 Jan 2025 19:45:46 -0500 Subject: [PATCH 07/37] touche requin --- src/main/java/frc/robot/RobotContainer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 61d2ac0..56f9063 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -7,16 +7,25 @@ package frc.robot; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; +import frc.robot.command.BalayeuseAlgue; +import frc.robot.command.BalayeuseCoral; +import frc.robot.command.BalayeuseHaut; +import frc.robot.command.L1Requin; +import frc.robot.subsystems.Requin; public class RobotContainer { CommandXboxController manette1 = new CommandXboxController(0); CommandXboxController manette2 = new CommandXboxController(0); + Requin requin = new Requin(); public RobotContainer() { configureBindings(); } private void configureBindings() { - + manette2.b().whileTrue(new BalayeuseAlgue(requin)); + manette2.x().whileTrue(new BalayeuseCoral(requin)); + manette2.y().whileTrue(new L1Requin(requin)); + manette2.rightBumper().whileTrue(new BalayeuseHaut(requin)); } public Command getAutonomousCommand() { From 56704c3e6891cb4dcdb3136567e5f8000a262a7a Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 3 Feb 2025 18:53:33 -0500 Subject: [PATCH 08/37] id --- src/main/java/frc/robot/subsystems/Requin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index 5ebd547..ac317dc 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -14,10 +14,10 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Requin extends SubsystemBase { /** Creates a new Requin. */ public Requin() {} - final SparkFlex balaye = new SparkFlex(0, MotorType.kBrushless); - final SparkMax rotatione = new SparkMax(0, MotorType.kBrushless); - final DigitalInput limit3 = new DigitalInput(0); - final DigitalInput limit5 = new DigitalInput(0); + final SparkFlex balaye = new SparkFlex(9, MotorType.kBrushless); + final SparkMax rotatione = new SparkMax(10, MotorType.kBrushless); + final DigitalInput limit3 = new DigitalInput(4); + final DigitalInput limit5 = new DigitalInput(5); public void balaye(double vitesse){ balaye.set(vitesse); } From 2ac9cfe8ffa201cc64356f565c394b70b2877e93 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 3 Feb 2025 18:59:31 -0500 Subject: [PATCH 09/37] simulation --- simgui-ds.json | 109 ++++++++++++++++++++ src/main/java/frc/robot/RobotContainer.java | 2 +- 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 simgui-ds.json diff --git a/simgui-ds.json b/simgui-ds.json new file mode 100644 index 0000000..dd439bd --- /dev/null +++ b/simgui-ds.json @@ -0,0 +1,109 @@ +{ + "FMS": { + "window": { + "visible": false + } + }, + "Joysticks": { + "window": { + "visible": false + } + }, + "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 + } + ], + "robotJoysticks": [ + {}, + { + "guid": "78696e70757401000000000000000000", + "useGamepad": true + } + ] +} diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 56f9063..d4c9d78 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -15,7 +15,7 @@ import frc.robot.subsystems.Requin; public class RobotContainer { CommandXboxController manette1 = new CommandXboxController(0); - CommandXboxController manette2 = new CommandXboxController(0); + CommandXboxController manette2 = new CommandXboxController(1); Requin requin = new Requin(); public RobotContainer() { configureBindings(); From 6683613c7ff7bdc4d2b6a044304770909ac265fe Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 6 Feb 2025 17:48:27 -0500 Subject: [PATCH 10/37] command -> commands --- src/main/java/frc/robot/RobotContainer.java | 8 ++++---- .../frc/robot/{command => commands}/BalayeuseAlgue.java | 2 +- .../frc/robot/{command => commands}/BalayeuseCoral.java | 2 +- .../frc/robot/{command => commands}/BalayeuseHaut.java | 2 +- .../java/frc/robot/{command => commands}/L1Requin.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) rename src/main/java/frc/robot/{command => commands}/BalayeuseAlgue.java (98%) rename src/main/java/frc/robot/{command => commands}/BalayeuseCoral.java (98%) rename src/main/java/frc/robot/{command => commands}/BalayeuseHaut.java (97%) rename src/main/java/frc/robot/{command => commands}/L1Requin.java (98%) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index d4c9d78..a8affa1 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -7,10 +7,10 @@ package frc.robot; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; -import frc.robot.command.BalayeuseAlgue; -import frc.robot.command.BalayeuseCoral; -import frc.robot.command.BalayeuseHaut; -import frc.robot.command.L1Requin; +import frc.robot.commands.BalayeuseAlgue; +import frc.robot.commands.BalayeuseCoral; +import frc.robot.commands.BalayeuseHaut; +import frc.robot.commands.L1Requin; import frc.robot.subsystems.Requin; public class RobotContainer { diff --git a/src/main/java/frc/robot/command/BalayeuseAlgue.java b/src/main/java/frc/robot/commands/BalayeuseAlgue.java similarity index 98% rename from src/main/java/frc/robot/command/BalayeuseAlgue.java rename to src/main/java/frc/robot/commands/BalayeuseAlgue.java index 04e02fa..38b6a09 100644 --- a/src/main/java/frc/robot/command/BalayeuseAlgue.java +++ b/src/main/java/frc/robot/commands/BalayeuseAlgue.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.command; +package frc.robot.commands; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; diff --git a/src/main/java/frc/robot/command/BalayeuseCoral.java b/src/main/java/frc/robot/commands/BalayeuseCoral.java similarity index 98% rename from src/main/java/frc/robot/command/BalayeuseCoral.java rename to src/main/java/frc/robot/commands/BalayeuseCoral.java index 6075a71..879eee3 100644 --- a/src/main/java/frc/robot/command/BalayeuseCoral.java +++ b/src/main/java/frc/robot/commands/BalayeuseCoral.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.command; +package frc.robot.commands; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; diff --git a/src/main/java/frc/robot/command/BalayeuseHaut.java b/src/main/java/frc/robot/commands/BalayeuseHaut.java similarity index 97% rename from src/main/java/frc/robot/command/BalayeuseHaut.java rename to src/main/java/frc/robot/commands/BalayeuseHaut.java index 647c592..ee25627 100644 --- a/src/main/java/frc/robot/command/BalayeuseHaut.java +++ b/src/main/java/frc/robot/commands/BalayeuseHaut.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.command; +package frc.robot.commands; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; diff --git a/src/main/java/frc/robot/command/L1Requin.java b/src/main/java/frc/robot/commands/L1Requin.java similarity index 98% rename from src/main/java/frc/robot/command/L1Requin.java rename to src/main/java/frc/robot/commands/L1Requin.java index 0dc75c5..6f23948 100644 --- a/src/main/java/frc/robot/command/L1Requin.java +++ b/src/main/java/frc/robot/commands/L1Requin.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.command; +package frc.robot.commands; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; From 3458203225f58a8ee08380bdf326299fedfa6297 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 11 Feb 2025 19:51:37 -0500 Subject: [PATCH 11/37] leds baleeuse et saaaaaaaaaaam --- src/main/java/frc/robot/RobotContainer.java | 9 ++-- .../frc/robot/commands/BalayeuseAlgue.java | 21 +++++--- .../frc/robot/commands/BalayeuseCoral.java | 21 +++++--- .../java/frc/robot/commands/L1Requin.java | 24 ++++++--- .../java/frc/robot/subsystems/Bougie.java | 52 +++++++++++++++++++ 5 files changed, 99 insertions(+), 28 deletions(-) create mode 100644 src/main/java/frc/robot/subsystems/Bougie.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index a8affa1..71fb150 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -12,19 +12,20 @@ import frc.robot.commands.BalayeuseCoral; import frc.robot.commands.BalayeuseHaut; import frc.robot.commands.L1Requin; import frc.robot.subsystems.Requin; - +import frc.robot.subsystems.Bougie; public class RobotContainer { CommandXboxController manette1 = new CommandXboxController(0); CommandXboxController manette2 = new CommandXboxController(1); Requin requin = new Requin(); + Bougie bougie = new Bougie(); public RobotContainer() { configureBindings(); } private void configureBindings() { - manette2.b().whileTrue(new BalayeuseAlgue(requin)); - manette2.x().whileTrue(new BalayeuseCoral(requin)); - manette2.y().whileTrue(new L1Requin(requin)); + manette2.b().whileTrue(new BalayeuseAlgue(requin,bougie)); + manette2.x().whileTrue(new BalayeuseCoral(requin,bougie)); + manette2.y().whileTrue(new L1Requin(requin,bougie)); manette2.rightBumper().whileTrue(new BalayeuseHaut(requin)); } diff --git a/src/main/java/frc/robot/commands/BalayeuseAlgue.java b/src/main/java/frc/robot/commands/BalayeuseAlgue.java index 38b6a09..03dc31d 100644 --- a/src/main/java/frc/robot/commands/BalayeuseAlgue.java +++ b/src/main/java/frc/robot/commands/BalayeuseAlgue.java @@ -5,15 +5,18 @@ package frc.robot.commands; import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Bougie; import frc.robot.subsystems.Requin; /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ public class BalayeuseAlgue extends Command { private Requin requin; + private Bougie bougie; /** Creates a new Balayeuse. */ - public BalayeuseAlgue(Requin requin) { + public BalayeuseAlgue(Requin requin,Bougie bougie) { this.requin = requin; - addRequirements(requin); + this.bougie =bougie; + addRequirements(requin, bougie); // Use addRequirements() here to declare subsystem dependencies. } @@ -26,6 +29,13 @@ public class BalayeuseAlgue extends Command { public void execute() { if(requin.encodeur()>=500 && requin.encodeur()<=510){ requin.rotationer(0); + if(requin.stop()){ + requin.balaye(0); + bougie.Vert(); + } + else{ + requin.balaye(0.5); + } } else if(requin.encodeur()>=510){ requin.rotationer(0.5); @@ -33,12 +43,7 @@ public class BalayeuseAlgue extends Command { else{ requin.rotationer(-0.5); } - if(requin.stop()){ - requin.balaye(0); - } - else{ - requin.balaye(0.5); - } + } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/commands/BalayeuseCoral.java b/src/main/java/frc/robot/commands/BalayeuseCoral.java index 879eee3..35aa9d8 100644 --- a/src/main/java/frc/robot/commands/BalayeuseCoral.java +++ b/src/main/java/frc/robot/commands/BalayeuseCoral.java @@ -5,15 +5,18 @@ package frc.robot.commands; import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Bougie; import frc.robot.subsystems.Requin; /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ public class BalayeuseCoral extends Command { private Requin requin; + private Bougie bougie; /** Creates a new Balayeuse. */ - public BalayeuseCoral(Requin requin) { + public BalayeuseCoral(Requin requin,Bougie bougie) { this.requin = requin; - addRequirements(requin); + this.bougie = bougie; + addRequirements(requin,bougie); // Use addRequirements() here to declare subsystem dependencies. } @@ -26,6 +29,13 @@ public class BalayeuseCoral extends Command { public void execute() { if(requin.encodeur()>=100 && requin.encodeur()<=110){ requin.rotationer(0); + if(requin.stop()){ + requin.balaye(0); + bougie.Vert(); + } + else{ + requin.balaye(0.5); + } } else if(requin.encodeur()>=110){ requin.rotationer(0.5); @@ -33,12 +43,7 @@ public class BalayeuseCoral extends Command { else{ requin.rotationer(-0.5); } - if(requin.stop()){ - requin.balaye(0); - } - else{ - requin.balaye(0.5); - } + } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/commands/L1Requin.java b/src/main/java/frc/robot/commands/L1Requin.java index 6f23948..230f6f5 100644 --- a/src/main/java/frc/robot/commands/L1Requin.java +++ b/src/main/java/frc/robot/commands/L1Requin.java @@ -5,15 +5,18 @@ package frc.robot.commands; import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Bougie; import frc.robot.subsystems.Requin; /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ public class L1Requin extends Command { private Requin requin; + private Bougie bougie; /** Creates a new Balayeuse. */ - public L1Requin(Requin requin) { + public L1Requin(Requin requin,Bougie bougie) { this.requin = requin; - addRequirements(requin); + this.bougie = bougie; + addRequirements(requin,bougie); // Use addRequirements() here to declare subsystem dependencies. } @@ -26,6 +29,13 @@ public class L1Requin extends Command { public void execute() { if(requin.encodeur()>=800 && requin.encodeur()<=810){ requin.rotationer(0); + if(requin.stop()){ + requin.balaye(-0.5); + } + else{ + requin.balaye(-0.5); + bougie.Rouge(); + } } else if(requin.encodeur()>=810){ requin.rotationer(0.5); @@ -33,12 +43,10 @@ public class L1Requin extends Command { else{ requin.rotationer(-0.5); } - if(requin.stop()){ - requin.balaye(0); - } - else{ - requin.balaye(0.5); - } + + + + } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/subsystems/Bougie.java b/src/main/java/frc/robot/subsystems/Bougie.java new file mode 100644 index 0000000..98bdf49 --- /dev/null +++ b/src/main/java/frc/robot/subsystems/Bougie.java @@ -0,0 +1,52 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.subsystems; + +import com.ctre.phoenix.led.CANdle; +import com.ctre.phoenix.led.CANdleConfiguration; +import com.ctre.phoenix.led.RainbowAnimation; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; + +public class Bougie extends SubsystemBase { + CANdle candle = new CANdle(5); + CANdleConfiguration config = new CANdleConfiguration(); + RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 64); + /** Creates a new Bougie. */ + public Bougie() { + config.brightnessScalar = 0.5; + candle.configAllSettings(config); + } + public void Rouge() { + candle.setLEDs(255, 0, 0,0,8,8); + candle.setLEDs(255, 0, 0,0,24,8); + candle.setLEDs(255, 0, 0,0,40,8); + candle.setLEDs(255, 0, 0,0,56,8); + } + public void Vert() { + candle.setLEDs(0, 255, 0,0,8,8); + candle.setLEDs(0, 255, 0,0,24,8); + candle.setLEDs(0, 255, 0,0,40,8); + candle.setLEDs(0, 255, 0,0,56,8); + } + public void Bleu() { + candle.setLEDs(0, 0, 255,0,16,8); + candle.setLEDs(0, 0, 255,0,32,8); + candle.setLEDs(0, 0, 255,0,48,8); + candle.setLEDs(0, 0, 255,0,64,8); + } + public void Jaune() { + candle.setLEDs(255, 215, 0,0,16,8); + candle.setLEDs(255, 215, 0,0,32,8); + candle.setLEDs(255, 215, 0,0,48,8); + candle.setLEDs(255, 215, 0,0,64,8); + } + public void RainBow(){candle.animate(rainbowAnim);} + public void RainBowStop(){candle.animate(null);} + @Override + public void periodic() { + // This method will be called once per scheduler run + } +} From eaa14fb1b17400ff1eff8523974b9a37860c1f64 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 12 Feb 2025 16:52:10 -0500 Subject: [PATCH 12/37] mieu ecrit --- src/main/java/frc/robot/commands/BalayeuseAlgue.java | 4 ++-- src/main/java/frc/robot/commands/L1Requin.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc/robot/commands/BalayeuseAlgue.java b/src/main/java/frc/robot/commands/BalayeuseAlgue.java index 03dc31d..ebab2e7 100644 --- a/src/main/java/frc/robot/commands/BalayeuseAlgue.java +++ b/src/main/java/frc/robot/commands/BalayeuseAlgue.java @@ -33,8 +33,8 @@ public class BalayeuseAlgue extends Command { requin.balaye(0); bougie.Vert(); } - else{ - requin.balaye(0.5); + else{ + requin.balaye(0.5); } } else if(requin.encodeur()>=510){ diff --git a/src/main/java/frc/robot/commands/L1Requin.java b/src/main/java/frc/robot/commands/L1Requin.java index 230f6f5..e20b921 100644 --- a/src/main/java/frc/robot/commands/L1Requin.java +++ b/src/main/java/frc/robot/commands/L1Requin.java @@ -32,10 +32,10 @@ public class L1Requin extends Command { if(requin.stop()){ requin.balaye(-0.5); } - else{ - requin.balaye(-0.5); - bougie.Rouge(); - } + else{ + requin.balaye(-0.5); + bougie.Rouge(); + } } else if(requin.encodeur()>=810){ requin.rotationer(0.5); From dc36eea3202e40fb002d6efdcd0a60d49ff1f90a Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 19 Feb 2025 17:21:37 -0500 Subject: [PATCH 13/37] requin --- src/main/java/frc/robot/RobotContainer.java | 4 +- .../frc/robot/commands/BalayeuseAlgue.java | 39 ++++++++++--------- .../frc/robot/commands/BalayeuseCoral.java | 34 ++++++++-------- .../java/frc/robot/subsystems/Bougie.java | 2 +- .../java/frc/robot/subsystems/Grimpeur.java | 2 +- .../java/frc/robot/subsystems/Requin.java | 6 +-- 6 files changed, 44 insertions(+), 43 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 71fb150..4949401 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -23,8 +23,8 @@ public class RobotContainer { } private void configureBindings() { - manette2.b().whileTrue(new BalayeuseAlgue(requin,bougie)); - manette2.x().whileTrue(new BalayeuseCoral(requin,bougie)); + manette2.b().whileTrue(new BalayeuseAlgue(requin)); + manette2.x().whileTrue(new BalayeuseCoral(requin)); manette2.y().whileTrue(new L1Requin(requin,bougie)); manette2.rightBumper().whileTrue(new BalayeuseHaut(requin)); } diff --git a/src/main/java/frc/robot/commands/BalayeuseAlgue.java b/src/main/java/frc/robot/commands/BalayeuseAlgue.java index ebab2e7..86bfdb3 100644 --- a/src/main/java/frc/robot/commands/BalayeuseAlgue.java +++ b/src/main/java/frc/robot/commands/BalayeuseAlgue.java @@ -13,10 +13,10 @@ public class BalayeuseAlgue extends Command { private Requin requin; private Bougie bougie; /** Creates a new Balayeuse. */ - public BalayeuseAlgue(Requin requin,Bougie bougie) { + public BalayeuseAlgue(Requin requin) { this.requin = requin; this.bougie =bougie; - addRequirements(requin, bougie); + addRequirements(requin); // Use addRequirements() here to declare subsystem dependencies. } @@ -27,24 +27,25 @@ public class BalayeuseAlgue extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(requin.encodeur()>=500 && requin.encodeur()<=510){ - requin.rotationer(0); - if(requin.stop()){ - requin.balaye(0); - bougie.Vert(); - } - else{ - requin.balaye(0.5); - } - } - else if(requin.encodeur()>=510){ - requin.rotationer(0.5); - } - else{ - requin.rotationer(-0.5); - } + // if(requin.encodeur()>=500 && requin.encodeur()<=510){ + // requin.rotationer(0); + // if(requin.stop()){ + // requin.balaye(0); + // bougie.Vert(); + // } + // else{ + + requin.balaye(0.5); + // } + // } + // else if(requin.encodeur()>=510){ + // requin.rotationer(0.5); + // } + // else{ + // requin.rotationer(-0.5); + // } - } + } // Called once the command ends or is interrupted. @Override diff --git a/src/main/java/frc/robot/commands/BalayeuseCoral.java b/src/main/java/frc/robot/commands/BalayeuseCoral.java index 35aa9d8..2215b85 100644 --- a/src/main/java/frc/robot/commands/BalayeuseCoral.java +++ b/src/main/java/frc/robot/commands/BalayeuseCoral.java @@ -13,10 +13,10 @@ public class BalayeuseCoral extends Command { private Requin requin; private Bougie bougie; /** Creates a new Balayeuse. */ - public BalayeuseCoral(Requin requin,Bougie bougie) { + public BalayeuseCoral(Requin requin) { this.requin = requin; this.bougie = bougie; - addRequirements(requin,bougie); + addRequirements(requin); // Use addRequirements() here to declare subsystem dependencies. } @@ -27,24 +27,24 @@ public class BalayeuseCoral extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(requin.encodeur()>=100 && requin.encodeur()<=110){ - requin.rotationer(0); - if(requin.stop()){ - requin.balaye(0); - bougie.Vert(); - } - else{ + // if(requin.encodeur()>=100 && requin.encodeur()<=110){ + // requin.rotationer(0); + // if(requin.stop()){ requin.balaye(0.5); + // bougie.Vert(); } - } - else if(requin.encodeur()>=110){ - requin.rotationer(0.5); - } - else{ - requin.rotationer(-0.5); - } + // else{ + // requin.balaye(0.5); + // } + // } + // else if(requin.encodeur()>=110){ + // requin.rotationer(0.5); + // } + // else{ + // requin.rotationer(-0.5); + // } - } + // } // Called once the command ends or is interrupted. @Override diff --git a/src/main/java/frc/robot/subsystems/Bougie.java b/src/main/java/frc/robot/subsystems/Bougie.java index 98bdf49..92d25da 100644 --- a/src/main/java/frc/robot/subsystems/Bougie.java +++ b/src/main/java/frc/robot/subsystems/Bougie.java @@ -11,7 +11,7 @@ import com.ctre.phoenix.led.RainbowAnimation; import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Bougie extends SubsystemBase { - CANdle candle = new CANdle(5); + CANdle candle = new CANdle(50); CANdleConfiguration config = new CANdleConfiguration(); RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 64); /** Creates a new Bougie. */ diff --git a/src/main/java/frc/robot/subsystems/Grimpeur.java b/src/main/java/frc/robot/subsystems/Grimpeur.java index 7e55e0b..09f6528 100644 --- a/src/main/java/frc/robot/subsystems/Grimpeur.java +++ b/src/main/java/frc/robot/subsystems/Grimpeur.java @@ -11,7 +11,7 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Grimpeur extends SubsystemBase { /** Creates a new Grimpeur. */ public Grimpeur() {} - final Spark grimpeur = new Spark(0); + final Spark grimpeur = new Spark(16); final DigitalInput limit1 = new DigitalInput(0); public void grimpe(double vitesse){ grimpeur.set(vitesse); diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index ac317dc..418554e 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -14,8 +14,8 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Requin extends SubsystemBase { /** Creates a new Requin. */ public Requin() {} - final SparkFlex balaye = new SparkFlex(9, MotorType.kBrushless); - final SparkMax rotatione = new SparkMax(10, MotorType.kBrushless); + final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless); + final SparkMax rotatione = new SparkMax(14, MotorType.kBrushless); final DigitalInput limit3 = new DigitalInput(4); final DigitalInput limit5 = new DigitalInput(5); public void balaye(double vitesse){ @@ -26,7 +26,7 @@ public class Requin extends SubsystemBase { } public boolean enHaut(){ return limit3.get(); - } + } public boolean stop(){ return limit5.get(); } From 29227dd2f6d6a772d536e8e9cc008d26dba8bd3c Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 20 Feb 2025 20:10:58 -0500 Subject: [PATCH 14/37] code mieux --- .../frc/robot/commands/BalayeuseAlgue.java | 30 +++++++------- .../frc/robot/commands/BalayeuseCoral.java | 38 ++++++++++-------- .../java/frc/robot/commands/ExpireAlgue.java | 40 +++++++++++++++++++ .../java/frc/robot/commands/L1Requin.java | 5 ++- .../java/frc/robot/subsystems/Requin.java | 5 ++- 5 files changed, 84 insertions(+), 34 deletions(-) create mode 100644 src/main/java/frc/robot/commands/ExpireAlgue.java diff --git a/src/main/java/frc/robot/commands/BalayeuseAlgue.java b/src/main/java/frc/robot/commands/BalayeuseAlgue.java index 86bfdb3..b13cb8a 100644 --- a/src/main/java/frc/robot/commands/BalayeuseAlgue.java +++ b/src/main/java/frc/robot/commands/BalayeuseAlgue.java @@ -27,23 +27,23 @@ public class BalayeuseAlgue extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - // if(requin.encodeur()>=500 && requin.encodeur()<=510){ - // requin.rotationer(0); - // if(requin.stop()){ - // requin.balaye(0); - // bougie.Vert(); - // } - // else{ + if(requin.encodeur()>=500 && requin.encodeur()<=510){ + requin.rotationer(0); + if(requin.stop()){ + requin.balaye(0); + bougie.Vert(); + } + else{ requin.balaye(0.5); - // } - // } - // else if(requin.encodeur()>=510){ - // requin.rotationer(0.5); - // } - // else{ - // requin.rotationer(-0.5); - // } + } + } + else if(requin.encodeur()>=510){ + requin.rotationer(0.5); + } + else{ + requin.rotationer(-0.5); + } } diff --git a/src/main/java/frc/robot/commands/BalayeuseCoral.java b/src/main/java/frc/robot/commands/BalayeuseCoral.java index 2215b85..34624e2 100644 --- a/src/main/java/frc/robot/commands/BalayeuseCoral.java +++ b/src/main/java/frc/robot/commands/BalayeuseCoral.java @@ -27,24 +27,30 @@ public class BalayeuseCoral extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - // if(requin.encodeur()>=100 && requin.encodeur()<=110){ - // requin.rotationer(0); - // if(requin.stop()){ - requin.balaye(0.5); - // bougie.Vert(); + if(requin.encodeur()>=100 && requin.encodeur()<=110){ + requin.rotationer(0); + if(requin.amp()>8){ + requin.balaye(0); + bougie.Vert(); + if(requin.enHaut()){ + requin.rotationer(0); + } + else{ + requin.rotationer(0.5); + } } - // else{ - // requin.balaye(0.5); - // } - // } - // else if(requin.encodeur()>=110){ - // requin.rotationer(0.5); - // } - // else{ - // requin.rotationer(-0.5); - // } + else{ + requin.balaye(0.5); + } + } + else if(requin.encodeur()>=110){ + requin.rotationer(0.5); + } + else{ + requin.rotationer(-0.5); + } - // } + } // Called once the command ends or is interrupted. @Override diff --git a/src/main/java/frc/robot/commands/ExpireAlgue.java b/src/main/java/frc/robot/commands/ExpireAlgue.java new file mode 100644 index 0000000..3eae23a --- /dev/null +++ b/src/main/java/frc/robot/commands/ExpireAlgue.java @@ -0,0 +1,40 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.commands; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class ExpireAlgue extends Command { + private Requin requin; + /** Creates a new ExpireAlgue. */ + public ExpireAlgue(Requin requin) { + this.requin = requin; + // 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() { + requin.balaye(0.5); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.balaye(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/commands/L1Requin.java b/src/main/java/frc/robot/commands/L1Requin.java index e20b921..3b871ce 100644 --- a/src/main/java/frc/robot/commands/L1Requin.java +++ b/src/main/java/frc/robot/commands/L1Requin.java @@ -27,13 +27,14 @@ public class L1Requin extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { + if(requin.encodeur()>=800 && requin.encodeur()<=810){ requin.rotationer(0); - if(requin.stop()){ + if(requin.amp()>8){ requin.balaye(-0.5); } else{ - requin.balaye(-0.5); + requin.balaye(0); bougie.Rouge(); } } diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index 418554e..c428f18 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -15,7 +15,7 @@ public class Requin extends SubsystemBase { /** Creates a new Requin. */ public Requin() {} final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless); - final SparkMax rotatione = new SparkMax(14, MotorType.kBrushless); + final SparkMax rotatione = new SparkMax(17, MotorType.kBrushless); final DigitalInput limit3 = new DigitalInput(4); final DigitalInput limit5 = new DigitalInput(5); public void balaye(double vitesse){ @@ -36,6 +36,9 @@ public class Requin extends SubsystemBase { public void reset(){ rotatione.getEncoder().setPosition(0); } + public double amp(){ + return balaye.getOutputCurrent(); + } @Override public void periodic() { // This method will be called once per scheduler run From 7fd7c666f151c6242ef4282538015cbd66170ba3 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 20 Feb 2025 20:17:45 -0500 Subject: [PATCH 15/37] code mieux --- src/main/java/frc/robot/commands/ExpireAlgue.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/frc/robot/commands/ExpireAlgue.java b/src/main/java/frc/robot/commands/ExpireAlgue.java index 3eae23a..fea308e 100644 --- a/src/main/java/frc/robot/commands/ExpireAlgue.java +++ b/src/main/java/frc/robot/commands/ExpireAlgue.java @@ -13,6 +13,7 @@ public class ExpireAlgue extends Command { /** Creates a new ExpireAlgue. */ public ExpireAlgue(Requin requin) { this.requin = requin; + addRequirements(requin); // Use addRequirements() here to declare subsystem dependencies. } From a09fbcefceab143dd1891e09bb217fde128e40de Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 20 Feb 2025 20:17:56 -0500 Subject: [PATCH 16/37] code mieux --- src/main/java/frc/robot/commands/BalayeuseAlgue.java | 2 +- src/main/java/frc/robot/commands/BalayeuseCoral.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/BalayeuseAlgue.java b/src/main/java/frc/robot/commands/BalayeuseAlgue.java index b13cb8a..73af5d1 100644 --- a/src/main/java/frc/robot/commands/BalayeuseAlgue.java +++ b/src/main/java/frc/robot/commands/BalayeuseAlgue.java @@ -16,7 +16,7 @@ public class BalayeuseAlgue extends Command { public BalayeuseAlgue(Requin requin) { this.requin = requin; this.bougie =bougie; - addRequirements(requin); + addRequirements(requin,bougie); // Use addRequirements() here to declare subsystem dependencies. } diff --git a/src/main/java/frc/robot/commands/BalayeuseCoral.java b/src/main/java/frc/robot/commands/BalayeuseCoral.java index 34624e2..428c895 100644 --- a/src/main/java/frc/robot/commands/BalayeuseCoral.java +++ b/src/main/java/frc/robot/commands/BalayeuseCoral.java @@ -16,7 +16,7 @@ public class BalayeuseCoral extends Command { public BalayeuseCoral(Requin requin) { this.requin = requin; this.bougie = bougie; - addRequirements(requin); + addRequirements(requin,bougie); // Use addRequirements() here to declare subsystem dependencies. } From 0524ec6355fd96ea868629dec3015444ad3281b4 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Sat, 22 Feb 2025 10:22:13 -0500 Subject: [PATCH 17/37] oli code mal --- src/main/java/frc/robot/subsystems/Bougie.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/Bougie.java b/src/main/java/frc/robot/subsystems/Bougie.java index 92d25da..b4ac253 100644 --- a/src/main/java/frc/robot/subsystems/Bougie.java +++ b/src/main/java/frc/robot/subsystems/Bougie.java @@ -43,7 +43,8 @@ public class Bougie extends SubsystemBase { candle.setLEDs(255, 215, 0,0,48,8); candle.setLEDs(255, 215, 0,0,64,8); } - public void RainBow(){candle.animate(rainbowAnim);} + public void RainBow(){ + candle.animate(rainbowAnim);} public void RainBowStop(){candle.animate(null);} @Override public void periodic() { From f9d09106a470720747550f3064589db8a1ca47fc Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Sat, 22 Feb 2025 15:21:04 -0500 Subject: [PATCH 18/37] dashboard --- src/main/java/frc/robot/RobotContainer.java | 4 +-- .../frc/robot/commands/BalayeuseAlgue.java | 13 +++++----- .../frc/robot/commands/BalayeuseCoral.java | 4 +-- .../java/frc/robot/subsystems/Bougie.java | 2 +- .../java/frc/robot/subsystems/Grimpeur.java | 26 ------------------- .../java/frc/robot/subsystems/Requin.java | 13 +++++++--- 6 files changed, 21 insertions(+), 41 deletions(-) delete mode 100644 src/main/java/frc/robot/subsystems/Grimpeur.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 4949401..3b0141c 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -23,8 +23,8 @@ public class RobotContainer { } private void configureBindings() { - manette2.b().whileTrue(new BalayeuseAlgue(requin)); - manette2.x().whileTrue(new BalayeuseCoral(requin)); + manette2.b().whileTrue(new BalayeuseAlgue(requin, bougie)); + manette2.x().whileTrue(new BalayeuseCoral(requin, bougie)); manette2.y().whileTrue(new L1Requin(requin,bougie)); manette2.rightBumper().whileTrue(new BalayeuseHaut(requin)); } diff --git a/src/main/java/frc/robot/commands/BalayeuseAlgue.java b/src/main/java/frc/robot/commands/BalayeuseAlgue.java index 73af5d1..e97fec5 100644 --- a/src/main/java/frc/robot/commands/BalayeuseAlgue.java +++ b/src/main/java/frc/robot/commands/BalayeuseAlgue.java @@ -13,7 +13,7 @@ public class BalayeuseAlgue extends Command { private Requin requin; private Bougie bougie; /** Creates a new Balayeuse. */ - public BalayeuseAlgue(Requin requin) { + public BalayeuseAlgue(Requin requin, Bougie bougie) { this.requin = requin; this.bougie =bougie; addRequirements(requin,bougie); @@ -27,16 +27,17 @@ public class BalayeuseAlgue extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(requin.encodeur()>=500 && requin.encodeur()<=510){ + if(requin.encodeur()>=500 && requin.encodeur()<=510) + { requin.rotationer(0); - if(requin.stop()){ + if(requin.amp()> 60){ requin.balaye(0); bougie.Vert(); } - else{ - + else + { requin.balaye(0.5); - } + } } else if(requin.encodeur()>=510){ requin.rotationer(0.5); diff --git a/src/main/java/frc/robot/commands/BalayeuseCoral.java b/src/main/java/frc/robot/commands/BalayeuseCoral.java index 428c895..2f53b19 100644 --- a/src/main/java/frc/robot/commands/BalayeuseCoral.java +++ b/src/main/java/frc/robot/commands/BalayeuseCoral.java @@ -13,7 +13,7 @@ public class BalayeuseCoral extends Command { private Requin requin; private Bougie bougie; /** Creates a new Balayeuse. */ - public BalayeuseCoral(Requin requin) { + public BalayeuseCoral(Requin requin, Bougie bougie) { this.requin = requin; this.bougie = bougie; addRequirements(requin,bougie); @@ -29,7 +29,7 @@ public class BalayeuseCoral extends Command { public void execute() { if(requin.encodeur()>=100 && requin.encodeur()<=110){ requin.rotationer(0); - if(requin.amp()>8){ + if(requin.amp()>60){ requin.balaye(0); bougie.Vert(); if(requin.enHaut()){ diff --git a/src/main/java/frc/robot/subsystems/Bougie.java b/src/main/java/frc/robot/subsystems/Bougie.java index b4ac253..53aaa5e 100644 --- a/src/main/java/frc/robot/subsystems/Bougie.java +++ b/src/main/java/frc/robot/subsystems/Bougie.java @@ -11,7 +11,7 @@ import com.ctre.phoenix.led.RainbowAnimation; import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Bougie extends SubsystemBase { - CANdle candle = new CANdle(50); + CANdle candle = new CANdle(23); CANdleConfiguration config = new CANdleConfiguration(); RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 64); /** Creates a new Bougie. */ diff --git a/src/main/java/frc/robot/subsystems/Grimpeur.java b/src/main/java/frc/robot/subsystems/Grimpeur.java deleted file mode 100644 index 09f6528..0000000 --- a/src/main/java/frc/robot/subsystems/Grimpeur.java +++ /dev/null @@ -1,26 +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.subsystems; - -import edu.wpi.first.wpilibj.DigitalInput; -import edu.wpi.first.wpilibj.motorcontrol.Spark; -import edu.wpi.first.wpilibj2.command.SubsystemBase; - -public class Grimpeur extends SubsystemBase { - /** Creates a new Grimpeur. */ - public Grimpeur() {} - final Spark grimpeur = new Spark(16); - final DigitalInput limit1 = new DigitalInput(0); - public void grimpe(double vitesse){ - grimpeur.set(vitesse); - } - final void stop(){ - limit1.get(); - } - @Override - public void periodic() { - // This method will be called once per scheduler run - } -} diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index c428f18..27337a4 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -8,7 +8,11 @@ import com.revrobotics.spark.SparkFlex; import com.revrobotics.spark.SparkMax; import com.revrobotics.spark.SparkLowLevel.MotorType; +import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj.DigitalInput; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardComponent; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Requin extends SubsystemBase { @@ -17,7 +21,11 @@ public class Requin extends SubsystemBase { final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless); final SparkMax rotatione = new SparkMax(17, MotorType.kBrushless); final DigitalInput limit3 = new DigitalInput(4); - final DigitalInput limit5 = new DigitalInput(5); + + GenericEntry teb = Shuffleboard.getTab("teb") + .add("amp",encodeur()) + .getEntry(); + public void balaye(double vitesse){ balaye.set(vitesse); } @@ -27,9 +35,6 @@ public class Requin extends SubsystemBase { public boolean enHaut(){ return limit3.get(); } - public boolean stop(){ - return limit5.get(); - } public double encodeur(){ return rotatione.getEncoder().getPosition(); } From b6d2ffd931e8835027e94e5dd17662538abbc8f6 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Sat, 22 Feb 2025 15:28:59 -0500 Subject: [PATCH 19/37] bas --- src/main/java/frc/robot/RobotContainer.java | 2 + .../java/frc/robot/commands/BalayeuseBas.java | 40 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/main/java/frc/robot/commands/BalayeuseBas.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 3b0141c..36e2ee1 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -8,6 +8,7 @@ import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import frc.robot.commands.BalayeuseAlgue; +import frc.robot.commands.BalayeuseBas; import frc.robot.commands.BalayeuseCoral; import frc.robot.commands.BalayeuseHaut; import frc.robot.commands.L1Requin; @@ -26,6 +27,7 @@ public class RobotContainer { manette2.b().whileTrue(new BalayeuseAlgue(requin, bougie)); manette2.x().whileTrue(new BalayeuseCoral(requin, bougie)); manette2.y().whileTrue(new L1Requin(requin,bougie)); + manette2.a().whileTrue(new BalayeuseBas(requin)); manette2.rightBumper().whileTrue(new BalayeuseHaut(requin)); } diff --git a/src/main/java/frc/robot/commands/BalayeuseBas.java b/src/main/java/frc/robot/commands/BalayeuseBas.java new file mode 100644 index 0000000..6aefaeb --- /dev/null +++ b/src/main/java/frc/robot/commands/BalayeuseBas.java @@ -0,0 +1,40 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.commands; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class BalayeuseBas extends Command { + private Requin requin; + /** Creates a new Balayeuse. */ + public BalayeuseBas(Requin requin) { + this.requin = requin; + addRequirements(requin); + // 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() { + requin.rotationer(-0.5); + } + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.rotationer(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From d538b368a74eee4dfeae95e9d0163fec55c0ebba Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 24 Feb 2025 18:19:06 -0500 Subject: [PATCH 20/37] encodeur baleeuse --- src/main/java/frc/robot/subsystems/Requin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index 27337a4..1afcd6f 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -23,7 +23,7 @@ public class Requin extends SubsystemBase { final DigitalInput limit3 = new DigitalInput(4); GenericEntry teb = Shuffleboard.getTab("teb") - .add("amp",encodeur()) + .add("encodeurrequationne",encodeur()) .getEntry(); public void balaye(double vitesse){ From 88aa6db0757c84261a4491f71142333bf79b6345 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 25 Feb 2025 17:57:57 -0500 Subject: [PATCH 21/37] limit id --- src/main/java/frc/robot/subsystems/Requin.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index 1afcd6f..ffe5a38 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -12,15 +12,18 @@ import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardComponent; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class Requin extends SubsystemBase { +public class Requin extends SubsystemBase { }; /** Creates a new Requin. */ - public Requin() {} + public Requin() { + + } final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless); final SparkMax rotatione = new SparkMax(17, MotorType.kBrushless); - final DigitalInput limit3 = new DigitalInput(4); + final DigitalInput limit3 = new DigitalInput(1); GenericEntry teb = Shuffleboard.getTab("teb") .add("encodeurrequationne",encodeur()) From 17f3f697b95ed9ba6ed2a8cc894efc56b4b61c5d Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 25 Feb 2025 18:03:04 -0500 Subject: [PATCH 22/37] dashboard requin --- src/main/java/frc/robot/subsystems/Requin.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index ffe5a38..0f343f2 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -16,18 +16,17 @@ import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; -public class Requin extends SubsystemBase { }; +public class Requin extends SubsystemBase { /** Creates a new Requin. */ + ShuffleboardTab teb = Shuffleboard.getTab("teb"); public Requin() { - + // teb.addBoolean("limit requin", limit3); } final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless); final SparkMax rotatione = new SparkMax(17, MotorType.kBrushless); final DigitalInput limit3 = new DigitalInput(1); - GenericEntry teb = Shuffleboard.getTab("teb") - .add("encodeurrequationne",encodeur()) - .getEntry(); + public void balaye(double vitesse){ balaye.set(vitesse); From 1157bdf76a80ed2477a4e956815977129e0e93ba Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 25 Feb 2025 18:05:00 -0500 Subject: [PATCH 23/37] limit requin --- src/main/java/frc/robot/subsystems/Requin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index 0f343f2..4252146 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -20,7 +20,7 @@ public class Requin extends SubsystemBase { /** Creates a new Requin. */ ShuffleboardTab teb = Shuffleboard.getTab("teb"); public Requin() { - // teb.addBoolean("limit requin", limit3); + teb.addBoolean("limit requin", this::enHaut); } final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless); final SparkMax rotatione = new SparkMax(17, MotorType.kBrushless); From cdd304f9e9a381b0c6f66b352cd5117147da046f Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 25 Feb 2025 18:08:14 -0500 Subject: [PATCH 24/37] dashboard requin + nettoyage code --- src/main/java/frc/robot/RobotContainer.java | 11 ++++++----- src/main/java/frc/robot/subsystems/Requin.java | 7 +------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 36e2ee1..02b4ec4 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -15,19 +15,20 @@ import frc.robot.commands.L1Requin; import frc.robot.subsystems.Requin; import frc.robot.subsystems.Bougie; public class RobotContainer { - CommandXboxController manette1 = new CommandXboxController(0); - CommandXboxController manette2 = new CommandXboxController(1); - Requin requin = new Requin(); - Bougie bougie = new Bougie(); +CommandXboxController manette1 = new CommandXboxController(0); +CommandXboxController manette2 = new CommandXboxController(1); +Requin requin = new Requin(); +Bougie bougie = new Bougie(); + public RobotContainer() { configureBindings(); } private void configureBindings() { + manette2.a().whileTrue(new BalayeuseBas(requin)); manette2.b().whileTrue(new BalayeuseAlgue(requin, bougie)); manette2.x().whileTrue(new BalayeuseCoral(requin, bougie)); manette2.y().whileTrue(new L1Requin(requin,bougie)); - manette2.a().whileTrue(new BalayeuseBas(requin)); manette2.rightBumper().whileTrue(new BalayeuseHaut(requin)); } diff --git a/src/main/java/frc/robot/subsystems/Requin.java b/src/main/java/frc/robot/subsystems/Requin.java index 4252146..db0e3c4 100644 --- a/src/main/java/frc/robot/subsystems/Requin.java +++ b/src/main/java/frc/robot/subsystems/Requin.java @@ -7,13 +7,9 @@ package frc.robot.subsystems; import com.revrobotics.spark.SparkFlex; import com.revrobotics.spark.SparkMax; import com.revrobotics.spark.SparkLowLevel.MotorType; - -import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; -import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardComponent; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Requin extends SubsystemBase { @@ -22,11 +18,10 @@ public class Requin extends SubsystemBase { public Requin() { teb.addBoolean("limit requin", this::enHaut); } + final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless); final SparkMax rotatione = new SparkMax(17, MotorType.kBrushless); final DigitalInput limit3 = new DigitalInput(1); - - public void balaye(double vitesse){ balaye.set(vitesse); From 36c9f0048b9f6302003aca96aaccc9b77814d639 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 25 Feb 2025 20:13:26 -0500 Subject: [PATCH 25/37] manuel --- src/main/java/frc/robot/RobotContainer.java | 1 + .../frc/robot/commands/requin_manuel.java | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/main/java/frc/robot/commands/requin_manuel.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 02b4ec4..bab63e9 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -22,6 +22,7 @@ Bougie bougie = new Bougie(); public RobotContainer() { configureBindings(); + requin. } private void configureBindings() { diff --git a/src/main/java/frc/robot/commands/requin_manuel.java b/src/main/java/frc/robot/commands/requin_manuel.java new file mode 100644 index 0000000..7f51847 --- /dev/null +++ b/src/main/java/frc/robot/commands/requin_manuel.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.commands; + +import java.util.function.DoubleSupplier; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class requin_manuel extends Command { + /** Creates a new requin_manuel. */ + private Requin requin; + private DoubleSupplier x; + public requin_manuel(Requin requin) { + // Use addRequirements() here to declare subsystem dependencies. + this.requin = requin; + addRequirements(requin); + } + + // 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() { + requin.rotationer(x.getAsDouble()); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.rotationer(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From 3b372104e4bf7f8ada0a9b8fead4c0b66a9ca14f Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 25 Feb 2025 20:26:23 -0500 Subject: [PATCH 26/37] requin manuel + aspire --- src/main/java/frc/robot/RobotContainer.java | 14 +++++-- src/main/java/frc/robot/commands/aspire.java | 41 ++++++++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 src/main/java/frc/robot/commands/aspire.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index bab63e9..4ecaa11 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -4,29 +4,37 @@ package frc.robot; +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.button.CommandXboxController; import frc.robot.commands.BalayeuseAlgue; import frc.robot.commands.BalayeuseBas; import frc.robot.commands.BalayeuseCoral; import frc.robot.commands.BalayeuseHaut; import frc.robot.commands.L1Requin; +import frc.robot.commands.aspire; +import frc.robot.commands.requin_manuel; import frc.robot.subsystems.Requin; import frc.robot.subsystems.Bougie; +import frc.robot.commands.aspire; public class RobotContainer { CommandXboxController manette1 = new CommandXboxController(0); CommandXboxController manette2 = new CommandXboxController(1); Requin requin = new Requin(); Bougie bougie = new Bougie(); - +aspire aspire = new aspire(requin); +requin_manuel requin_manuel = new requin_manuel(requin); public RobotContainer() { configureBindings(); - requin. + requin.setDefaultCommand(new RunCommand(()->{ + requin.rotationer(MathUtil.applyDeadband(manette2.getRightY(), 0.2)); + }, requin)); } private void configureBindings() { - manette2.a().whileTrue(new BalayeuseBas(requin)); + manette2.a().whileTrue(new aspire(requin)); manette2.b().whileTrue(new BalayeuseAlgue(requin, bougie)); manette2.x().whileTrue(new BalayeuseCoral(requin, bougie)); manette2.y().whileTrue(new L1Requin(requin,bougie)); diff --git a/src/main/java/frc/robot/commands/aspire.java b/src/main/java/frc/robot/commands/aspire.java new file mode 100644 index 0000000..c7f7a42 --- /dev/null +++ b/src/main/java/frc/robot/commands/aspire.java @@ -0,0 +1,41 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.commands; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class aspire extends Command { + /** Creates a new aspire. */ + private Requin requin; + public aspire(Requin requin) { + // Use addRequirements() here to declare subsystem dependencies. + this.requin = requin; + addRequirements(requin); + } + + // 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() { + requin.balaye(0.5); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.balaye(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From df31291697cb646d9e4177010e2006fa96d2b362 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 26 Feb 2025 17:05:46 -0500 Subject: [PATCH 27/37] limit avec requin manuel --- src/main/java/frc/robot/commands/requin_manuel.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/commands/requin_manuel.java b/src/main/java/frc/robot/commands/requin_manuel.java index 7f51847..30d8d7b 100644 --- a/src/main/java/frc/robot/commands/requin_manuel.java +++ b/src/main/java/frc/robot/commands/requin_manuel.java @@ -27,7 +27,12 @@ public class requin_manuel extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - requin.rotationer(x.getAsDouble()); + if(requin.enHaut()){ + requin.rotationer(0); + } + else{ + requin.rotationer(x.getAsDouble()); + } } // Called once the command ends or is interrupted. From abb6d113d08120bee5a5c6b4ba23c0ff1c6c6a70 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 26 Feb 2025 18:39:59 -0500 Subject: [PATCH 28/37] ajout exspire --- src/main/java/frc/robot/RobotContainer.java | 2 + .../frc/robot/commands/BalayeuseHaut.java | 2 +- src/main/java/frc/robot/commands/aspire.java | 2 +- src/main/java/frc/robot/commands/exspire.java | 41 +++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/main/java/frc/robot/commands/exspire.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 4ecaa11..62a8a21 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -15,6 +15,7 @@ import frc.robot.commands.BalayeuseCoral; import frc.robot.commands.BalayeuseHaut; import frc.robot.commands.L1Requin; import frc.robot.commands.aspire; +import frc.robot.commands.exspire; import frc.robot.commands.requin_manuel; import frc.robot.subsystems.Requin; import frc.robot.subsystems.Bougie; @@ -35,6 +36,7 @@ requin_manuel requin_manuel = new requin_manuel(requin); private void configureBindings() { manette2.a().whileTrue(new aspire(requin)); + manette2.rightTrigger().whileTrue(new exspire(requin)); manette2.b().whileTrue(new BalayeuseAlgue(requin, bougie)); manette2.x().whileTrue(new BalayeuseCoral(requin, bougie)); manette2.y().whileTrue(new L1Requin(requin,bougie)); diff --git a/src/main/java/frc/robot/commands/BalayeuseHaut.java b/src/main/java/frc/robot/commands/BalayeuseHaut.java index ee25627..5bf884f 100644 --- a/src/main/java/frc/robot/commands/BalayeuseHaut.java +++ b/src/main/java/frc/robot/commands/BalayeuseHaut.java @@ -29,7 +29,7 @@ public class BalayeuseHaut extends Command { requin.reset(); } else{ - requin.rotationer(0.5); + requin.rotationer(-0.5); } } diff --git a/src/main/java/frc/robot/commands/aspire.java b/src/main/java/frc/robot/commands/aspire.java index c7f7a42..96ce671 100644 --- a/src/main/java/frc/robot/commands/aspire.java +++ b/src/main/java/frc/robot/commands/aspire.java @@ -24,7 +24,7 @@ public class aspire extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - requin.balaye(0.5); + requin.balaye(0.3); } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/commands/exspire.java b/src/main/java/frc/robot/commands/exspire.java new file mode 100644 index 0000000..5229cc9 --- /dev/null +++ b/src/main/java/frc/robot/commands/exspire.java @@ -0,0 +1,41 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.commands; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.subsystems.Requin; + +/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ +public class exspire extends Command { + /** Creates a new aspire. */ + private Requin requin; + public exspire(Requin requin) { + // Use addRequirements() here to declare subsystem dependencies. + this.requin = requin; + addRequirements(requin); + } + + // 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() { + requin.balaye(-0.3); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + requin.balaye(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From b7eecbaea95e26aaca16c340d9622ff0a1407dae Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 27 Feb 2025 18:33:08 -0500 Subject: [PATCH 29/37] Menage pour mieu se trouver --- src/main/java/frc/robot/RobotContainer.java | 12 ++--- src/main/java/frc/robot/commands/Depart.java | 2 +- .../{ => Elevateur}/ElevateurManuel.java | 2 +- .../robot/commands/{ => Elevateur}/L2.java | 5 +- .../robot/commands/{ => Elevateur}/L3.java | 2 +- .../robot/commands/{ => Elevateur}/L4.java | 2 +- .../commands/{ => Pince}/DepartPince.java | 2 +- .../commands/{ => Pince}/PinceManuel.java | 2 +- .../java/frc/robot/commands/PinceManuel2.java | 47 ------------------- .../commands/{ => grimpeur}/GrimperHaut.java | 2 +- .../commands/{ => grimpeur}/GrimpeurBas.java | 2 +- .../{ => grimpeur}/GrimpeurManuel.java | 2 +- .../{ => grimpeur}/ResetGrimpeur.java | 2 +- 13 files changed, 16 insertions(+), 68 deletions(-) rename src/main/java/frc/robot/commands/{ => Elevateur}/ElevateurManuel.java (97%) rename src/main/java/frc/robot/commands/{ => Elevateur}/L2.java (97%) rename src/main/java/frc/robot/commands/{ => Elevateur}/L3.java (98%) rename src/main/java/frc/robot/commands/{ => Elevateur}/L4.java (98%) rename src/main/java/frc/robot/commands/{ => Pince}/DepartPince.java (97%) rename src/main/java/frc/robot/commands/{ => Pince}/PinceManuel.java (97%) delete mode 100644 src/main/java/frc/robot/commands/PinceManuel2.java rename src/main/java/frc/robot/commands/{ => grimpeur}/GrimperHaut.java (97%) rename src/main/java/frc/robot/commands/{ => grimpeur}/GrimpeurBas.java (98%) rename src/main/java/frc/robot/commands/{ => grimpeur}/GrimpeurManuel.java (97%) rename src/main/java/frc/robot/commands/{ => grimpeur}/ResetGrimpeur.java (97%) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index abee378..69953ad 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -27,21 +27,20 @@ import frc.robot.TunerConstants.TunerConstants; import frc.robot.commands.AprilTag3; import frc.robot.commands.AprilTag3G; import frc.robot.commands.Depart; -import frc.robot.commands.ElevateurManuel; import frc.robot.commands.Forme3; -import frc.robot.commands.L2; -import frc.robot.commands.L3; -import frc.robot.commands.L4; -import frc.robot.commands.PinceManuel; -import frc.robot.commands.PinceManuel2; import frc.robot.commands.RainBow; import frc.robot.commands.StationPince; import frc.robot.commands.reset; +import frc.robot.commands.Elevateur.ElevateurManuel; +import frc.robot.commands.Elevateur.L2; +import frc.robot.commands.Elevateur.L3; +import frc.robot.commands.Elevateur.L4; import frc.robot.commands.Pince.AlgueExpire; import frc.robot.commands.Pince.Algue_inspire; import frc.robot.commands.Pince.CorailAspir; import frc.robot.commands.Pince.CoralAlgueInspire; import frc.robot.commands.Pince.CoralExpire; +import frc.robot.commands.Pince.PinceManuel; import frc.robot.subsystems.Bougie; import frc.robot.subsystems.CommandSwerveDrivetrain; import frc.robot.subsystems.Elevateur; @@ -74,7 +73,6 @@ public class RobotContainer { Pince pince = new Pince(); ElevateurManuel elevateurManuel = new ElevateurManuel(elevateur, manette2::getLeftY); PinceManuel pinceManuel = new PinceManuel(pince,manette2::getRightY); - PinceManuel2 pinceManuel2 = new PinceManuel2(pince); Bougie bougie = new Bougie(); Limelight3G limelight3g = new Limelight3G(); Limelight3 limelight3 = new Limelight3(); diff --git a/src/main/java/frc/robot/commands/Depart.java b/src/main/java/frc/robot/commands/Depart.java index f5322dd..f624039 100644 --- a/src/main/java/frc/robot/commands/Depart.java +++ b/src/main/java/frc/robot/commands/Depart.java @@ -47,6 +47,6 @@ public class Depart extends Command { // Returns true when the command should end. @Override public boolean isFinished() { - return elevateur.limit2()==true; + return elevateur.limit2() == true; } } diff --git a/src/main/java/frc/robot/commands/ElevateurManuel.java b/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java similarity index 97% rename from src/main/java/frc/robot/commands/ElevateurManuel.java rename to src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java index f86268a..682fdc6 100644 --- a/src/main/java/frc/robot/commands/ElevateurManuel.java +++ b/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.Elevateur; import java.util.function.DoubleSupplier; diff --git a/src/main/java/frc/robot/commands/L2.java b/src/main/java/frc/robot/commands/Elevateur/L2.java similarity index 97% rename from src/main/java/frc/robot/commands/L2.java rename to src/main/java/frc/robot/commands/Elevateur/L2.java index fb6286f..936771c 100644 --- a/src/main/java/frc/robot/commands/L2.java +++ b/src/main/java/frc/robot/commands/Elevateur/L2.java @@ -2,10 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; - -import java.util.function.DoubleSupplier; - +package frc.robot.commands.Elevateur; import edu.wpi.first.networktables.DoubleSubscriber; import edu.wpi.first.networktables.NetworkTable; import edu.wpi.first.networktables.NetworkTableInstance; diff --git a/src/main/java/frc/robot/commands/L3.java b/src/main/java/frc/robot/commands/Elevateur/L3.java similarity index 98% rename from src/main/java/frc/robot/commands/L3.java rename to src/main/java/frc/robot/commands/Elevateur/L3.java index 43635ac..b653c77 100644 --- a/src/main/java/frc/robot/commands/L3.java +++ b/src/main/java/frc/robot/commands/Elevateur/L3.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.Elevateur; import edu.wpi.first.networktables.DoubleSubscriber; import edu.wpi.first.networktables.NetworkTable; diff --git a/src/main/java/frc/robot/commands/L4.java b/src/main/java/frc/robot/commands/Elevateur/L4.java similarity index 98% rename from src/main/java/frc/robot/commands/L4.java rename to src/main/java/frc/robot/commands/Elevateur/L4.java index a2a46d0..58697c5 100644 --- a/src/main/java/frc/robot/commands/L4.java +++ b/src/main/java/frc/robot/commands/Elevateur/L4.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.Elevateur; import edu.wpi.first.networktables.DoubleSubscriber; import edu.wpi.first.networktables.NetworkTable; diff --git a/src/main/java/frc/robot/commands/DepartPince.java b/src/main/java/frc/robot/commands/Pince/DepartPince.java similarity index 97% rename from src/main/java/frc/robot/commands/DepartPince.java rename to src/main/java/frc/robot/commands/Pince/DepartPince.java index 12a69dd..bdfc343 100644 --- a/src/main/java/frc/robot/commands/DepartPince.java +++ b/src/main/java/frc/robot/commands/Pince/DepartPince.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.Pince; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Pince; diff --git a/src/main/java/frc/robot/commands/PinceManuel.java b/src/main/java/frc/robot/commands/Pince/PinceManuel.java similarity index 97% rename from src/main/java/frc/robot/commands/PinceManuel.java rename to src/main/java/frc/robot/commands/Pince/PinceManuel.java index 5b8b2c0..1382d39 100644 --- a/src/main/java/frc/robot/commands/PinceManuel.java +++ b/src/main/java/frc/robot/commands/Pince/PinceManuel.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.Pince; import java.util.function.DoubleSupplier; import edu.wpi.first.wpilibj2.command.Command; diff --git a/src/main/java/frc/robot/commands/PinceManuel2.java b/src/main/java/frc/robot/commands/PinceManuel2.java deleted file mode 100644 index bf8d1e4..0000000 --- a/src/main/java/frc/robot/commands/PinceManuel2.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package frc.robot.commands; -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.Pince; - -/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ -public class PinceManuel2 extends Command { - private Pince pince; - //private DoubleSupplier doubleSupplier; - /** Creates a new PinceManuel. */ - public PinceManuel2(Pince pince - - //,DoubleSupplier doubleSupplier - ) { - this.pince = pince; - // this.doubleSupplier = doubleSupplier; - addRequirements(pince); - // 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() { - - pince.pivote(-0.2); - - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - pince.pivote(0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/commands/GrimperHaut.java b/src/main/java/frc/robot/commands/grimpeur/GrimperHaut.java similarity index 97% rename from src/main/java/frc/robot/commands/GrimperHaut.java rename to src/main/java/frc/robot/commands/grimpeur/GrimperHaut.java index ad0ebf0..ce3f65a 100644 --- a/src/main/java/frc/robot/commands/GrimperHaut.java +++ b/src/main/java/frc/robot/commands/grimpeur/GrimperHaut.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.grimpeur; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Bougie; diff --git a/src/main/java/frc/robot/commands/GrimpeurBas.java b/src/main/java/frc/robot/commands/grimpeur/GrimpeurBas.java similarity index 98% rename from src/main/java/frc/robot/commands/GrimpeurBas.java rename to src/main/java/frc/robot/commands/grimpeur/GrimpeurBas.java index 7837e24..4dfc3b0 100644 --- a/src/main/java/frc/robot/commands/GrimpeurBas.java +++ b/src/main/java/frc/robot/commands/grimpeur/GrimpeurBas.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.grimpeur; import edu.wpi.first.networktables.DoubleSubscriber; import edu.wpi.first.networktables.NetworkTable; diff --git a/src/main/java/frc/robot/commands/GrimpeurManuel.java b/src/main/java/frc/robot/commands/grimpeur/GrimpeurManuel.java similarity index 97% rename from src/main/java/frc/robot/commands/GrimpeurManuel.java rename to src/main/java/frc/robot/commands/grimpeur/GrimpeurManuel.java index 31a404b..60fdace 100644 --- a/src/main/java/frc/robot/commands/GrimpeurManuel.java +++ b/src/main/java/frc/robot/commands/grimpeur/GrimpeurManuel.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.grimpeur; import java.util.function.DoubleSupplier; diff --git a/src/main/java/frc/robot/commands/ResetGrimpeur.java b/src/main/java/frc/robot/commands/grimpeur/ResetGrimpeur.java similarity index 97% rename from src/main/java/frc/robot/commands/ResetGrimpeur.java rename to src/main/java/frc/robot/commands/grimpeur/ResetGrimpeur.java index b4e6978..5bf0bea 100644 --- a/src/main/java/frc/robot/commands/ResetGrimpeur.java +++ b/src/main/java/frc/robot/commands/grimpeur/ResetGrimpeur.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.grimpeur; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Grimpeur; From 82970eb6bde3f95942de9d308de668098d633590 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 27 Feb 2025 18:39:15 -0500 Subject: [PATCH 30/37] dossier requin --- .../java/frc/robot/commands/{ => requin}/BalayeuseAlgue.java | 2 +- src/main/java/frc/robot/commands/{ => requin}/BalayeuseBas.java | 2 +- .../java/frc/robot/commands/{ => requin}/BalayeuseCoral.java | 2 +- .../java/frc/robot/commands/{ => requin}/BalayeuseHaut.java | 2 +- src/main/java/frc/robot/commands/{ => requin}/ExpireAlgue.java | 2 +- src/main/java/frc/robot/commands/{ => requin}/L1Requin.java | 2 +- src/main/java/frc/robot/commands/{ => requin}/aspire.java | 2 +- src/main/java/frc/robot/commands/{ => requin}/exspire.java | 2 +- .../java/frc/robot/commands/{ => requin}/requin_manuel.java | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) rename src/main/java/frc/robot/commands/{ => requin}/BalayeuseAlgue.java (97%) rename src/main/java/frc/robot/commands/{ => requin}/BalayeuseBas.java (97%) rename src/main/java/frc/robot/commands/{ => requin}/BalayeuseCoral.java (98%) rename src/main/java/frc/robot/commands/{ => requin}/BalayeuseHaut.java (97%) rename src/main/java/frc/robot/commands/{ => requin}/ExpireAlgue.java (97%) rename src/main/java/frc/robot/commands/{ => requin}/L1Requin.java (97%) rename src/main/java/frc/robot/commands/{ => requin}/aspire.java (97%) rename src/main/java/frc/robot/commands/{ => requin}/exspire.java (97%) rename src/main/java/frc/robot/commands/{ => requin}/requin_manuel.java (97%) diff --git a/src/main/java/frc/robot/commands/BalayeuseAlgue.java b/src/main/java/frc/robot/commands/requin/BalayeuseAlgue.java similarity index 97% rename from src/main/java/frc/robot/commands/BalayeuseAlgue.java rename to src/main/java/frc/robot/commands/requin/BalayeuseAlgue.java index e97fec5..212583b 100644 --- a/src/main/java/frc/robot/commands/BalayeuseAlgue.java +++ b/src/main/java/frc/robot/commands/requin/BalayeuseAlgue.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.requin; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Bougie; diff --git a/src/main/java/frc/robot/commands/BalayeuseBas.java b/src/main/java/frc/robot/commands/requin/BalayeuseBas.java similarity index 97% rename from src/main/java/frc/robot/commands/BalayeuseBas.java rename to src/main/java/frc/robot/commands/requin/BalayeuseBas.java index 6aefaeb..67d0687 100644 --- a/src/main/java/frc/robot/commands/BalayeuseBas.java +++ b/src/main/java/frc/robot/commands/requin/BalayeuseBas.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.requin; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; diff --git a/src/main/java/frc/robot/commands/BalayeuseCoral.java b/src/main/java/frc/robot/commands/requin/BalayeuseCoral.java similarity index 98% rename from src/main/java/frc/robot/commands/BalayeuseCoral.java rename to src/main/java/frc/robot/commands/requin/BalayeuseCoral.java index 2f53b19..5b12ada 100644 --- a/src/main/java/frc/robot/commands/BalayeuseCoral.java +++ b/src/main/java/frc/robot/commands/requin/BalayeuseCoral.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.requin; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Bougie; diff --git a/src/main/java/frc/robot/commands/BalayeuseHaut.java b/src/main/java/frc/robot/commands/requin/BalayeuseHaut.java similarity index 97% rename from src/main/java/frc/robot/commands/BalayeuseHaut.java rename to src/main/java/frc/robot/commands/requin/BalayeuseHaut.java index 5bf884f..eea2d7d 100644 --- a/src/main/java/frc/robot/commands/BalayeuseHaut.java +++ b/src/main/java/frc/robot/commands/requin/BalayeuseHaut.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.requin; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; diff --git a/src/main/java/frc/robot/commands/ExpireAlgue.java b/src/main/java/frc/robot/commands/requin/ExpireAlgue.java similarity index 97% rename from src/main/java/frc/robot/commands/ExpireAlgue.java rename to src/main/java/frc/robot/commands/requin/ExpireAlgue.java index fea308e..679c6ce 100644 --- a/src/main/java/frc/robot/commands/ExpireAlgue.java +++ b/src/main/java/frc/robot/commands/requin/ExpireAlgue.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.requin; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; diff --git a/src/main/java/frc/robot/commands/L1Requin.java b/src/main/java/frc/robot/commands/requin/L1Requin.java similarity index 97% rename from src/main/java/frc/robot/commands/L1Requin.java rename to src/main/java/frc/robot/commands/requin/L1Requin.java index 3b871ce..1a7d127 100644 --- a/src/main/java/frc/robot/commands/L1Requin.java +++ b/src/main/java/frc/robot/commands/requin/L1Requin.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.requin; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Bougie; diff --git a/src/main/java/frc/robot/commands/aspire.java b/src/main/java/frc/robot/commands/requin/aspire.java similarity index 97% rename from src/main/java/frc/robot/commands/aspire.java rename to src/main/java/frc/robot/commands/requin/aspire.java index 96ce671..5105d83 100644 --- a/src/main/java/frc/robot/commands/aspire.java +++ b/src/main/java/frc/robot/commands/requin/aspire.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.requin; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; diff --git a/src/main/java/frc/robot/commands/exspire.java b/src/main/java/frc/robot/commands/requin/exspire.java similarity index 97% rename from src/main/java/frc/robot/commands/exspire.java rename to src/main/java/frc/robot/commands/requin/exspire.java index 5229cc9..9c57fe0 100644 --- a/src/main/java/frc/robot/commands/exspire.java +++ b/src/main/java/frc/robot/commands/requin/exspire.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.requin; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Requin; diff --git a/src/main/java/frc/robot/commands/requin_manuel.java b/src/main/java/frc/robot/commands/requin/requin_manuel.java similarity index 97% rename from src/main/java/frc/robot/commands/requin_manuel.java rename to src/main/java/frc/robot/commands/requin/requin_manuel.java index 30d8d7b..9a3fa3d 100644 --- a/src/main/java/frc/robot/commands/requin_manuel.java +++ b/src/main/java/frc/robot/commands/requin/requin_manuel.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.requin; import java.util.function.DoubleSupplier; From 95f4f74a47c66be0e21e78e8c5c964e12ee6de17 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 27 Feb 2025 18:42:03 -0500 Subject: [PATCH 31/37] modification depart --- src/main/java/frc/robot/RobotContainer.java | 2 +- .../java/frc/robot/commands/{ => Elevateur}/Depart.java | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) rename src/main/java/frc/robot/commands/{ => Elevateur}/Depart.java (91%) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 69953ad..353bf56 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -26,11 +26,11 @@ import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import frc.robot.TunerConstants.TunerConstants; import frc.robot.commands.AprilTag3; import frc.robot.commands.AprilTag3G; -import frc.robot.commands.Depart; import frc.robot.commands.Forme3; import frc.robot.commands.RainBow; import frc.robot.commands.StationPince; import frc.robot.commands.reset; +import frc.robot.commands.Elevateur.Depart; import frc.robot.commands.Elevateur.ElevateurManuel; import frc.robot.commands.Elevateur.L2; import frc.robot.commands.Elevateur.L3; diff --git a/src/main/java/frc/robot/commands/Depart.java b/src/main/java/frc/robot/commands/Elevateur/Depart.java similarity index 91% rename from src/main/java/frc/robot/commands/Depart.java rename to src/main/java/frc/robot/commands/Elevateur/Depart.java index f624039..56f684b 100644 --- a/src/main/java/frc/robot/commands/Depart.java +++ b/src/main/java/frc/robot/commands/Elevateur/Depart.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -package frc.robot.commands; +package frc.robot.commands.Elevateur; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.Elevateur; @@ -11,12 +11,10 @@ import frc.robot.subsystems.Pince; /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ public class Depart extends Command { private Elevateur elevateur; - private Pince pince; /** Creates a new L2. */ public Depart(Elevateur elevateur, Pince pince) { - this.pince = pince; this.elevateur = elevateur; - addRequirements(elevateur,pince); + addRequirements(elevateur); // Use addRequirements() here to declare subsystem dependencies. } @@ -41,7 +39,6 @@ public class Depart extends Command { @Override public void end(boolean interrupted) { elevateur.vitesse(0); - pince.pivote(0); } // Returns true when the command should end. From b0e09988a30a6f693825aebe466b95322330e03b Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 27 Feb 2025 18:47:46 -0500 Subject: [PATCH 32/37] modification elevateur manuel pour limit switch --- src/main/java/frc/robot/RobotContainer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 353bf56..266d36c 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -103,7 +103,12 @@ public class RobotContainer { // Elevateur manuel drivetrain.registerTelemetry(logger::telemeterize); elevateur.setDefaultCommand(new RunCommand(()->{ - elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY(), 0.1)); + if(elevateur.limit2()){ + elevateur.vitesse(0); + } + else{ + elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftX(), 0.1)); + } }, elevateur)); //Pince manuel From 4bba37215f817305ce38759f14bd03c2d4811462 Mon Sep 17 00:00:00 2001 From: EdwardFaucher Date: Thu, 27 Feb 2025 19:03:26 -0500 Subject: [PATCH 33/37] joysticks mieux^3 --- src/main/java/frc/robot/RobotContainer.java | 12 ++++++------ src/main/java/frc/robot/commands/reset.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 07aa04f..a1f1808 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -100,20 +100,20 @@ public class RobotContainer { drivetrain.setDefaultCommand( // Drivetrain will execute this command periodically drivetrain.applyRequest(() -> - drive.withVelocityX(MathUtil.applyDeadband(-manette1.getLeftY()*manette1.getLeftY()*MaxSpeed, 0.1)) // Drive forward with negative Y (forward) - .withVelocityY(MathUtil.applyDeadband(-manette1.getLeftX()*manette1.getLeftX()*MaxSpeed, 0.10000)) // Drive left with negative X (left) - .withRotationalRate(MathUtil.applyDeadband(-manette1.getRightX()*manette1.getRightX()*MaxAngularRate, 0.1)) // Drive counterclockwise with negative X (left) + drive.withVelocityX(MathUtil.applyDeadband(-manette1.getLeftX()*manette1.getLeftX()*manette1.getLeftX()*MaxSpeed, 0.05)) // Drive forward with negative Y (forward) + .withVelocityY(MathUtil.applyDeadband(manette1.getLeftY()*manette1.getLeftY()*manette1.getLeftY()*MaxSpeed, 0.05)) // Drive left with negative X (left) + .withRotationalRate(MathUtil.applyDeadband(-manette1.getRightX()*manette1.getRightX()*manette1.getRightX()*MaxAngularRate, 0.05)) // Drive counterclockwise with negative X (left) ) ); // Elevateur manuel drivetrain.registerTelemetry(logger::telemeterize); elevateur.setDefaultCommand(new RunCommand(()->{ - elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY()*manette2.getLeftY(), 0.1)); + elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY()*manette2.getLeftY()*manette2.getLeftY(), 0.05)); }, elevateur)); //Pince manuel pince.setDefaultCommand(new RunCommand(()->{ - pince.pivote(MathUtil.applyDeadband(manette2.getRightY()*manette2.getRightY(), 0.1)); + pince.pivote(MathUtil.applyDeadband(manette2.getRightY()*manette2.getRightY()*manette2.getRightY(), 0.05)); }, pince)); @@ -130,7 +130,7 @@ public class RobotContainer { //manette2 manette2.leftTrigger().whileTrue(new AlgueExpire(pince, bougie)); manette2.a().whileTrue(new CorailAspir(pince)); - manette2.start().whileTrue(new reset(elevateur)); + manette2.start().whileTrue(new reset(elevateur,pince)); manette2.b().whileTrue(new Algue_inspire(pince)); manette2.leftBumper().whileTrue(new AprilTag3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY)); manette2.rightBumper().whileTrue(new Forme3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY)); diff --git a/src/main/java/frc/robot/commands/reset.java b/src/main/java/frc/robot/commands/reset.java index d6ba79b..9a61223 100644 --- a/src/main/java/frc/robot/commands/reset.java +++ b/src/main/java/frc/robot/commands/reset.java @@ -15,7 +15,7 @@ public class reset extends Command { /** Creates a new reset. */ private Elevateur elevateur; private Pince pince; - public reset(Elevateur elevateur) { + public reset(Elevateur elevateur, Pince pince) { // Use addRequirements() here to declare subsystem dependencies. this.elevateur = elevateur; this.pince = pince; From 9cb0940f095ba37e9c1933346f569f25616983c2 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 27 Feb 2025 19:03:36 -0500 Subject: [PATCH 34/37] touche --- src/main/java/frc/robot/RobotContainer.java | 89 +++++++++++---------- 1 file changed, 47 insertions(+), 42 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 266d36c..bc70887 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -41,6 +41,9 @@ import frc.robot.commands.Pince.CorailAspir; import frc.robot.commands.Pince.CoralAlgueInspire; import frc.robot.commands.Pince.CoralExpire; import frc.robot.commands.Pince.PinceManuel; +import frc.robot.commands.requin.BalayeuseBas; +import frc.robot.commands.requin.BalayeuseHaut; +import frc.robot.commands.requin.exspire; import frc.robot.subsystems.Bougie; import frc.robot.subsystems.CommandSwerveDrivetrain; import frc.robot.subsystems.Elevateur; @@ -48,6 +51,7 @@ import frc.robot.subsystems.Grimpeur; import frc.robot.subsystems.Limelight3; import frc.robot.subsystems.Limelight3G; import frc.robot.subsystems.Pince; +import frc.robot.subsystems.Requin; public class RobotContainer { private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed @@ -78,6 +82,7 @@ public class RobotContainer { Limelight3 limelight3 = new Limelight3(); Pose2d pose = new Pose2d(); Grimpeur Grimpeur = new Grimpeur(); + Requin requin = new Requin(); public RobotContainer() { autoChooser = AutoBuilder.buildAutoChooser("New Auto"); @@ -91,17 +96,47 @@ public class RobotContainer { NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince,bougie)); } private void configureBindings() { - - drivetrain.setDefaultCommand( - // Drivetrain will execute this command periodically - drivetrain.applyRequest(() -> - drive.withVelocityX(MathUtil.applyDeadband(Math.pow(-manette1.getLeftX(), 2)*MaxSpeed, 0.1)) // Drive forward with negative Y (forward) - .withVelocityY(MathUtil.applyDeadband(Math.pow(-manette1.getLeftY(), 2)*MaxSpeed, 0.10000)) // Drive left with negative X (left) - .withRotationalRate(MathUtil.applyDeadband(Math.pow(-manette1.getRightX(), 2)*manette1.getRightX()*MaxAngularRate, 0.1)) // Drive counterclockwise with negative X (left) + drivetrain.registerTelemetry(logger::telemeterize); + drivetrain.setDefaultCommand( + // Drivetrain will execute this command periodically + drivetrain.applyRequest(() -> + drive.withVelocityX(MathUtil.applyDeadband(Math.pow(-manette1.getLeftX(), 2)*MaxSpeed, 0.1)) // Drive forward with negative Y (forward) + .withVelocityY(MathUtil.applyDeadband(Math.pow(-manette1.getLeftY(), 2)*MaxSpeed, 0.10000)) // Drive left with negative X (left) + .withRotationalRate(MathUtil.applyDeadband(Math.pow(-manette1.getRightX(), 2)*manette1.getRightX()*MaxAngularRate, 0.1)) // Drive counterclockwise with negative X (left) ) ); - // Elevateur manuel - drivetrain.registerTelemetry(logger::telemeterize); + + + /* Manette 1 */ + // reset the field-centric heading on start press + manette1.start().onTrue(drivetrain.runOnce(() -> drivetrain.seedFieldCentric())); + + //pince + manette1.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie)); + manette1.rightBumper().whileTrue(new StationPince(pince, elevateur)); + manette1.leftTrigger().whileTrue(new CoralExpire(pince, bougie)); + + //elevateur + manette1.a().whileTrue(new Depart(elevateur, pince)); + manette1.b().whileTrue(new L2(elevateur,pince)); + manette1.x().whileTrue(new L3(elevateur, pince)); + manette1.y().whileTrue(new L4(elevateur, pince)); + + /* Manette 2 */ + //pince + manette2.a().whileTrue(new CorailAspir(pince)); + manette2.b().whileTrue(new Algue_inspire(pince)); + manette2.y().whileTrue(new BalayeuseHaut(requin)); + manette2.x().whileTrue(new BalayeuseBas(requin)); + manette2.rightTrigger().whileTrue(new exspire(requin)); + manette2.leftTrigger().whileTrue(new AlgueExpire(pince, bougie)); + + //Pince manuel + pince.setDefaultCommand(new RunCommand(()->{ + pince.pivote(MathUtil.applyDeadband(manette2.getRightY(), 0.1)); + }, pince)); + + //Elevateur manuel elevateur.setDefaultCommand(new RunCommand(()->{ if(elevateur.limit2()){ elevateur.vitesse(0); @@ -111,43 +146,13 @@ public class RobotContainer { } }, elevateur)); - //Pince manuel - pince.setDefaultCommand(new RunCommand(()->{ - pince.pivote(MathUtil.applyDeadband(manette2.getRightY(), 0.1)); - }, pince)); - - - // manette1 - - // reset the field-centric heading on start press - manette1.start().onTrue(drivetrain.runOnce(() -> drivetrain.seedFieldCentric())); - - //elevateur - manette1.a().whileTrue(new Depart(elevateur, pince)); - manette1.b().whileTrue(new L2(elevateur,pince)); - manette1.x().whileTrue(new L3(elevateur, pince)); - manette1.y().whileTrue(new L4(elevateur, pince)); - - //pince - manette1.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie)); - manette1.rightBumper().whileTrue(new StationPince(pince, elevateur)); - manette1.leftTrigger().whileTrue(new CoralExpire(pince, bougie)); - - //manette2 - - //pince - manette2.a().whileTrue(new CorailAspir(pince)); - manette2.start().whileTrue(new reset(elevateur, pince)); - manette2.b().whileTrue(new Algue_inspire(pince)); - manette2.start().whileTrue(new reset(elevateur,pince)); - manette2.leftTrigger().whileTrue(new AlgueExpire(pince, bougie)); - //limelight manette2.leftBumper().whileTrue(new AprilTag3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY)); manette2.rightBumper().whileTrue(new Forme3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY)); + + //Reset encodeur + manette2.start().whileTrue(new reset(elevateur, pince)); } - - // manette2.leftTrigger().whileTrue(new AprilTag3G(limelight3g,drivetrain,manette1::getLeftX,manette1::getLeftY)); public Command getAutonomousCommand() { return new SequentialCommandGroup(Commands.runOnce(()->{ From 280270245e99f77066357afcaf9b9b66ecb00c2a Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 27 Feb 2025 19:22:36 -0500 Subject: [PATCH 35/37] =?UTF-8?q?Limit=20swich=20elevateur=20+=20limit=20s?= =?UTF-8?q?witch=20pince=20(test=C3=A9=20en=20simulation-Fonctionne)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/frc/robot/RobotContainer.java | 2 +- .../commands/Elevateur/ElevateurManuel.java | 5 ++- .../frc/robot/commands/Pince/Algue1Test.java | 41 ------------------- .../frc/robot/commands/Pince/Algue2Test.java | 41 ------------------- .../java/frc/robot/subsystems/Elevateur.java | 14 +++++-- src/main/java/frc/robot/subsystems/Pince.java | 27 ++++++------ 6 files changed, 31 insertions(+), 99 deletions(-) delete mode 100644 src/main/java/frc/robot/commands/Pince/Algue1Test.java delete mode 100644 src/main/java/frc/robot/commands/Pince/Algue2Test.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 903b89d..3b58775 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -133,7 +133,7 @@ public class RobotContainer { //Pince manuel pince.setDefaultCommand(new RunCommand(()->{ - pince.pivote(MathUtil.applyDeadband(manette2.getRightY(), 0.1)); + pince.pivote(MathUtil.applyDeadband(manette2.getRightY()*manette2.getRightY()*manette2.getRightY(), 0.05)); }, pince)); //Elevateur manuel diff --git a/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java b/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java index 682fdc6..772df78 100644 --- a/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java +++ b/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java @@ -28,7 +28,10 @@ public class ElevateurManuel extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if (elevateur.limit2()) + if (elevateur.limit2()){ + + + } elevateur.vitesse(doubleSupplier.getAsDouble()/3.5); } diff --git a/src/main/java/frc/robot/commands/Pince/Algue1Test.java b/src/main/java/frc/robot/commands/Pince/Algue1Test.java deleted file mode 100644 index ab5e886..0000000 --- a/src/main/java/frc/robot/commands/Pince/Algue1Test.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package frc.robot.commands.Pince; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.Pince; - -/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ -public class Algue1Test extends Command { - private Pince pince; - /** Creates a new AlgueTest. */ - public Algue1Test(Pince pince) { - this.pince = pince; - addRequirements(pince); - // 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() { - pince.algue1Test(0.2); - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - pince.algue1Test(0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/commands/Pince/Algue2Test.java b/src/main/java/frc/robot/commands/Pince/Algue2Test.java deleted file mode 100644 index 386e4f1..0000000 --- a/src/main/java/frc/robot/commands/Pince/Algue2Test.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package frc.robot.commands.Pince; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.Pince; - -/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ -public class Algue2Test extends Command { - private Pince pince; - /** Creates a new AlgueTest. */ - public Algue2Test(Pince pince) { - this.pince = pince; - addRequirements(pince); - // 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() { - pince.algue2Test(0.2); - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - pince.algue2Test(0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/subsystems/Elevateur.java b/src/main/java/frc/robot/subsystems/Elevateur.java index 7ef7851..b329555 100644 --- a/src/main/java/frc/robot/subsystems/Elevateur.java +++ b/src/main/java/frc/robot/subsystems/Elevateur.java @@ -3,8 +3,6 @@ // the WPILib BSD license file in the root directory of this project. package frc.robot.subsystems; - -import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; @@ -25,7 +23,17 @@ public class Elevateur extends SubsystemBase { return monte.getEncoder().getPosition(); } public void vitesse(double vitesse){ - monte.set(vitesse); + if (limit2()) { + if (vitesse > 0) { + monte.set(0); + } + else{ + monte.set(vitesse); + } + } + else{ + monte.set(vitesse); + } } public boolean limit2(){ return limit2.get(); diff --git a/src/main/java/frc/robot/subsystems/Pince.java b/src/main/java/frc/robot/subsystems/Pince.java index f07f601..957b45b 100644 --- a/src/main/java/frc/robot/subsystems/Pince.java +++ b/src/main/java/frc/robot/subsystems/Pince.java @@ -6,8 +6,6 @@ package frc.robot.subsystems; import com.revrobotics.spark.SparkLowLevel.MotorType; import com.revrobotics.spark.SparkMax; - -import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; @@ -27,11 +25,21 @@ public class Pince extends SubsystemBase { final DigitalInput limit6 = new DigitalInput(9); - public void aspirecoral(double vitesse){ - coral.set(vitesse); - } +public void aspirecoral(double vitesse){ + coral.set(vitesse); +} public void pivote(double vitesse){ - pivoti.set(vitesse); + if (position()) { + if (vitesse > 0) { + pivoti.set(0); + } + else{ + pivoti.set(vitesse); + } + } + else{ + pivoti.set(vitesse); + } } public void aspirealgue(double vitesse){ algue2.set(-vitesse); @@ -52,12 +60,7 @@ public double emperagecoral(){ public double emperagealgue(){ return algue1.getOutputCurrent(); } -public void algue1Test(double vitesse){ - algue1.set(vitesse); -} -public void algue2Test(double vitesse){ - algue2.set(vitesse); -} + @Override public void periodic() { // This method will be called once per scheduler run From 19bbde5cf6a876277f6f16d9ab4ce5e175a91aee Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 27 Feb 2025 19:24:31 -0500 Subject: [PATCH 36/37] Si besoin de Sysid. Code retirer lors de ce commit --- .../subsystems/CommandSwerveDrivetrain.java | 89 ------------------- 1 file changed, 89 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/CommandSwerveDrivetrain.java b/src/main/java/frc/robot/subsystems/CommandSwerveDrivetrain.java index 311b4ca..335ef61 100644 --- a/src/main/java/frc/robot/subsystems/CommandSwerveDrivetrain.java +++ b/src/main/java/frc/robot/subsystems/CommandSwerveDrivetrain.java @@ -22,7 +22,6 @@ import edu.wpi.first.wpilibj.Notifier; import edu.wpi.first.wpilibj.RobotController; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Subsystem; -import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine; import frc.robot.TunerConstants.TunerConstants.TunerSwerveDrivetrain; /** @@ -44,71 +43,8 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su private final SwerveRequest.ApplyRobotSpeeds m_pathApplyRobotSpeeds = new SwerveRequest.ApplyRobotSpeeds(); - /* Swerve requests to apply during SysId characterization */ - private final SwerveRequest.SysIdSwerveTranslation m_translationCharacterization = new SwerveRequest.SysIdSwerveTranslation(); - private final SwerveRequest.SysIdSwerveSteerGains m_steerCharacterization = new SwerveRequest.SysIdSwerveSteerGains(); - private final SwerveRequest.SysIdSwerveRotation m_rotationCharacterization = new SwerveRequest.SysIdSwerveRotation(); - /* SysId routine for characterizing translation. This is used to find PID gains for the drive motors. */ - private final SysIdRoutine m_sysIdRoutineTranslation = new SysIdRoutine( - new SysIdRoutine.Config( - null, // Use default ramp rate (1 V/s) - Volts.of(4), // Reduce dynamic step voltage to 4 V to prevent brownout - null, // Use default timeout (10 s) - // Log state with SignalLogger class - state -> SignalLogger.writeString("SysIdTranslation_State", state.toString()) - ), - new SysIdRoutine.Mechanism( - output -> setControl(m_translationCharacterization.withVolts(output)), - null, - this - ) - ); - - /* SysId routine for characterizing steer. This is used to find PID gains for the steer motors. */ - private final SysIdRoutine m_sysIdRoutineSteer = new SysIdRoutine( - new SysIdRoutine.Config( - null, // Use default ramp rate (1 V/s) - Volts.of(7), // Use dynamic voltage of 7 V - null, // Use default timeout (10 s) - // Log state with SignalLogger class - state -> SignalLogger.writeString("SysIdSteer_State", state.toString()) - ), - new SysIdRoutine.Mechanism( - volts -> setControl(m_steerCharacterization.withVolts(volts)), - null, - this - ) - ); - - /* - * SysId routine for characterizing rotation. - * This is used to find PID gains for the FieldCentricFacingAngle HeadingController. - * See the documentation of SwerveRequest.SysIdSwerveRotation for info on importing the log to SysId. - */ - private final SysIdRoutine m_sysIdRoutineRotation = new SysIdRoutine( - new SysIdRoutine.Config( - /* This is in radians per secondĀ², but SysId only supports "volts per second" */ - Volts.of(Math.PI / 6).per(Second), - /* This is in radians per second, but SysId only supports "volts" */ - Volts.of(Math.PI), - null, // Use default timeout (10 s) - // Log state with SignalLogger class - state -> SignalLogger.writeString("SysIdRotation_State", state.toString()) - ), - new SysIdRoutine.Mechanism( - output -> { - /* output is actually radians per second, but SysId only supports "volts" */ - setControl(m_rotationCharacterization.withRotationalRate(output.in(Volts))); - /* also log the requested output for SysId */ - SignalLogger.writeDouble("Rotational_Rate", output.in(Volts)); - }, - null, - this - ) - ); - private void configureAutoBuilder() { try { var config = RobotConfig.fromGUISettings(); @@ -140,9 +76,6 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su return 0; }); } - - /* The SysId routine to test */ - private SysIdRoutine m_sysIdRoutineToApply = m_sysIdRoutineSteer; /** * Constructs a CTRE SwerveDrivetrain using the specified constants. @@ -234,28 +167,6 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su public Command applyRequest(Supplier requestSupplier) { return run(() -> this.setControl(requestSupplier.get())); } - - /** - * Runs the SysId Quasistatic test in the given direction for the routine - * specified by {@link #m_sysIdRoutineToApply}. - * - * @param direction Direction of the SysId Quasistatic test - * @return Command to run - */ - public Command sysIdQuasistatic(SysIdRoutine.Direction direction) { - return m_sysIdRoutineToApply.quasistatic(direction); - } - - /** - * Runs the SysId Dynamic test in the given direction for the routine - * specified by {@link #m_sysIdRoutineToApply}. - * - * @param direction Direction of the SysId Dynamic test - * @return Command to run - */ - public Command sysIdDynamic(SysIdRoutine.Direction direction) { - return m_sysIdRoutineToApply.dynamic(direction); - } @Override public void periodic() { From 85fa0e0c626176981cf8f300bdbf8df3fa0266be Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Thu, 27 Feb 2025 19:26:33 -0500 Subject: [PATCH 37/37] erreur de sam --- src/main/java/frc/robot/commands/Elevateur/L3.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/Elevateur/L3.java b/src/main/java/frc/robot/commands/Elevateur/L3.java index b653c77..7b77690 100644 --- a/src/main/java/frc/robot/commands/Elevateur/L3.java +++ b/src/main/java/frc/robot/commands/Elevateur/L3.java @@ -39,8 +39,8 @@ public class L3 extends Command { public void execute() { double encodeurHaute = encodeur1.get(); double encodeurBase = encodeur2.get(); - double encodeurbase = encodeur3.get(); - double encodeurhaute = encodeur4.get(); + double encodeurbasp = encodeur3.get(); + double encodeurhautp = encodeur4.get(); if(elevateur.position()<=-encodeurHaute && elevateur.position()>=encodeurBase){ elevateur.vitesse(0); }