From c6146e2a3b5dc75c4e368934fbc0e4010d45ad04 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Wed, 15 Mar 2023 18:18:59 -0400 Subject: [PATCH 01/32] xvcb --- src/main/java/frc/robot/RobotContainer.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index de3edd1..f5a5bc2 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -7,6 +7,8 @@ import java.util.Map; import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.networktables.GenericEntry; +import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts; +import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout; import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; @@ -70,11 +72,12 @@ String enhaut = "en bas"; String aumilieux = "au milieux"; String enbas = "en bas"; String nulpart = "nul part"; -ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto"); -GenericEntry autobalance = layoutauto.add("choix balance",true).getEntry(); -GenericEntry autosortir = layoutauto.add("choix sorit",false).getEntry(); +ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto",BuiltInLayouts.kList) +.withSize(2,2).withProperties(Map.of("Label position","LEFT")); +GenericEntry autobalance = layoutauto.add("choix balance",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); +GenericEntry autosortir = layoutauto.add("choix sorit",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); public RobotContainer() { - chooser.setDefaultOption(enhaut, enhaut); + chooser.addOption(enhaut, enhaut); chooser.addOption(enbas, enbas); chooser.addOption(aumilieux, aumilieux); chooser.addOption(nulpart, nulpart); From a34723f4cb3a2e08ad6b331a40ac15eb11450bbf Mon Sep 17 00:00:00 2001 From: EdwardFaucher Date: Sat, 18 Mar 2023 14:19:52 -0400 Subject: [PATCH 02/32] hv v --- src/main/java/frc/robot/commands/GratteMonte.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/frc/robot/commands/GratteMonte.java b/src/main/java/frc/robot/commands/GratteMonte.java index 553e5e0..0fd83fa 100644 --- a/src/main/java/frc/robot/commands/GratteMonte.java +++ b/src/main/java/frc/robot/commands/GratteMonte.java @@ -5,7 +5,6 @@ package frc.robot.commands; -import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.Gratte; From d1e82b747465239a22021c6be5d0a2d5048c04d8 Mon Sep 17 00:00:00 2001 From: Olivier Demers Date: Mon, 20 Mar 2023 19:53:25 +0000 Subject: [PATCH 03/32] fixed mode manuel du bras --- src/main/java/frc/robot/commands/bras/BrasManuel.java | 2 +- src/main/java/frc/robot/commands/bras/PivotManuel.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/bras/BrasManuel.java b/src/main/java/frc/robot/commands/bras/BrasManuel.java index b930d31..844c681 100644 --- a/src/main/java/frc/robot/commands/bras/BrasManuel.java +++ b/src/main/java/frc/robot/commands/bras/BrasManuel.java @@ -29,7 +29,7 @@ public class BrasManuel extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(doubleSupplier.getAsDouble()>0.2 && doubleSupplier.getAsDouble()<-0.2){ + if(doubleSupplier.getAsDouble()>0.2 || doubleSupplier.getAsDouble()<-0.2){ brasTelescopique.AvanceRecule(doubleSupplier.getAsDouble()); } diff --git a/src/main/java/frc/robot/commands/bras/PivotManuel.java b/src/main/java/frc/robot/commands/bras/PivotManuel.java index 375ce9c..32979d0 100644 --- a/src/main/java/frc/robot/commands/bras/PivotManuel.java +++ b/src/main/java/frc/robot/commands/bras/PivotManuel.java @@ -27,7 +27,7 @@ public class PivotManuel extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(doubleSupplier.getAsDouble()>0.2 && doubleSupplier.getAsDouble()<-0.2){ + if(doubleSupplier.getAsDouble()>0.2 || doubleSupplier.getAsDouble()<-0.2){ pivot.monteDescendre(doubleSupplier.getAsDouble());} } From 06bd854326998eb1f5a064b47310cc1acab8d158 Mon Sep 17 00:00:00 2001 From: Olivier Demers Date: Mon, 20 Mar 2023 19:55:52 +0000 Subject: [PATCH 04/32] removed useless lines --- src/main/java/frc/robot/RobotContainer.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 2bbc6ca..62f41f5 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -139,8 +139,6 @@ public RobotContainer() { } public Command getAutonomousCommand() { - chooser.getSelected(); - autobalance.getBoolean(true); return Commands.waitSeconds(14).deadlineWith( new SequentialCommandGroup( Commands.select(Map.ofEntries( Map.entry(enhaut,pivoteBrasHaut), From 1da5d821c35f8ef50b93f3c56ada9364a1925ba3 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 20 Mar 2023 18:00:49 -0400 Subject: [PATCH 05/32] g --- src/main/java/frc/robot/RobotContainer.java | 36 +++++++++------------ 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index f151825..a68925a 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -65,9 +65,9 @@ ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto",Buil .withSize(2, 2).withProperties(Map.of("Label position","LEFT")); GenericEntry autobalance = layoutauto.add("choix balance",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); GenericEntry autosortir = layoutauto.add("choix sortir",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); -GenericEntry reculerdistances = layoutauto.addPersistent("reculerdistancesortir",-66).getEntry(); -GenericEntry reculerdistanceb = layoutauto.addPersistent("reculerdistancebalance", -31).getEntry(); -GenericEntry avancerdistance = layoutauto.addPersistent("avancer",-35).getEntry(); +GenericEntry reculerdistances = layoutauto.addPersistent("reculerdistancesortir",0).getEntry(); +GenericEntry reculerdistanceb = layoutauto.addPersistent("reculerdistancebalance", 0).getEntry(); +GenericEntry avancerdistance = layoutauto.addPersistent("avancer",0).getEntry(); // subsystems BasePilotable basePilotable = new BasePilotable(); Gratte gratte = new Gratte(); @@ -93,9 +93,9 @@ Reculer reculerb = new Reculer(basePilotable, ()->reculerdistanceb.getDouble(0)) Avancer avancer = new Avancer(basePilotable, ()->avancerdistance.getDouble(0)); PivotChercheBas pivotChercheBas = new PivotChercheBas(brasTelescopique, pivot); PivotChercheHaut pivotChercheHaut = new PivotChercheHaut(brasTelescopique, pivot); -Cube cube = new Cube(limelight, basePilotable, ()-> manette1.getLeftY()); -Apriltag aprilTag = new Apriltag(limelight, basePilotable,()-> manette1.getLeftY()); -Tape tape = new Tape(limelight, basePilotable, ()-> manette1.getLeftY()); +Cube cube = new Cube(limelight, basePilotable, null); +Apriltag aprilTag = new Apriltag(limelight, basePilotable, null); +Tape tape = new Tape(limelight, basePilotable, null); PivotManuel pivotManuel = new PivotManuel(pivot,manette2::getLeftX); BrasManuel brasManuel = new BrasManuel(brasTelescopique,manette2::getLeftY); @@ -126,10 +126,9 @@ public RobotContainer() { private void configureBindings() { // manette 1 manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); - manette1.x().onTrue(brakeOuvre); - manette1.b().onTrue(brakeFerme); - manette1.leftBumper().whileTrue(aprilTag); - manette1.rightBumper().whileTrue(tape); + manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable)); + manette1.leftBumper().toggleOnTrue(aprilTag); + manette1.rightBumper().toggleOnTrue(tape); manette1.povUp().whileTrue(pivoteBrasHaut); manette1.povDown().whileTrue(pivoteBrasBas); manette1.povRight().whileTrue(pivoteBrasMilieux); @@ -137,18 +136,19 @@ public RobotContainer() { //manette 2 manette2.povDown().onTrue(pivotChercheBas); manette2.povUp().onTrue(pivotChercheHaut); - manette2.rightBumper().whileTrue(cube); - manette2.leftBumper().whileTrue(cone); + manette2.rightBumper().toggleOnTrue(cube); + manette2.leftBumper().toggleOnTrue(cone); manette2.y().whileTrue(gyro); manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro)); manette2.a().whileTrue(gratteMonte); manette2.b().whileTrue(gratteBaisser); - manette2.back().onTrue(new InstantCommand(basePilotable::Reset)); } public Command getAutonomousCommand() { - return Commands.waitSeconds(14).deadlineWith( new SequentialCommandGroup( + chooser.getSelected(); + autobalance.getBoolean(true); + return new SequentialCommandGroup( Commands.select(Map.ofEntries( Map.entry(enhaut,pivoteBrasHaut), Map.entry(aumilieux,pivoteBrasMilieux), @@ -156,14 +156,10 @@ public RobotContainer() { Map.entry(nulpart,pivotBrasRentre) ), chooser::getSelected), ouvrePince.unless(()->chooser.getSelected().equals(nulpart)), - Commands.waitSeconds(1), - fermePince.unless(()->chooser.getSelected().equals(nulpart)), - new PivotBrasRentre(brasTelescopique , pivot).unless(()->chooser.getSelected().equals(nulpart)), - Commands.waitSeconds(1), Commands.either(reculers, reculerb,()-> autosortir.getBoolean(true)), - avancer.unless(()->!autosortir.getBoolean(true)|| autobalance.getBoolean(false)), + avancer.unless(()->!autosortir.getBoolean(true)|| !autobalance.getBoolean(false)), Commands.either(gyro, Commands.none(),()-> autobalance.getBoolean(true)) - )).andThen(new InstantCommand(basePilotable::BrakeOuvre,basePilotable)); + ).deadlineWith(Commands.waitSeconds(14.6)).andThen(brakeOuvre); } From 0e72ebe04916d9aafe8775192973afb91c4ef754 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 20 Mar 2023 18:04:30 -0400 Subject: [PATCH 06/32] nb --- src/main/java/frc/robot/RobotContainer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 62f41f5..e9b16b9 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -146,13 +146,13 @@ public RobotContainer() { Map.entry(enbas,pivoteBrasBas), Map.entry(nulpart,pivotBrasRentre) ), chooser::getSelected), - ouvrePince.unless(()->chooser.getSelected().equals(nulpart)), + new OuvrePince(pince).unless(()->chooser.getSelected().equals(nulpart)), Commands.waitSeconds(1), - fermePince.unless(()->chooser.getSelected().equals(nulpart)), + new FermePince(pince).unless(()->chooser.getSelected().equals(nulpart)), new PivotBrasRentre(brasTelescopique , pivot).unless(()->chooser.getSelected().equals(nulpart)), Commands.waitSeconds(1), Commands.either(reculers, reculerb,()-> autosortir.getBoolean(true)), - avancer.unless(()->!autosortir.getBoolean(true)|| autobalance.getBoolean(false)), + new Avancer(basePilotable,()-> avancerdistance.getDouble(0)).unless(()->!autosortir.getBoolean(true)|| autobalance.getBoolean(false)), Commands.either(gyro, Commands.none(),()-> autobalance.getBoolean(true)) )).andThen(new InstantCommand(basePilotable::BrakeOuvre,basePilotable)); From 8ba1721503668b4263b4148385b2e47a7779498e Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 20 Mar 2023 18:06:52 -0400 Subject: [PATCH 07/32] s --- src/main/java/frc/robot/RobotContainer.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 2d92961..92f0f89 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -99,16 +99,6 @@ Tape tape = new Tape(limelight, basePilotable, null); PivotManuel pivotManuel = new PivotManuel(pivot,manette2::getLeftX); BrasManuel brasManuel = new BrasManuel(brasTelescopique,manette2::getLeftY); - -SendableChooser chooser = new SendableChooser<>(); -String enhaut = "en bas"; -String aumilieux = "au milieux"; -String enbas = "en bas"; -String nulpart = "nul part"; -ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto",BuiltInLayouts.kList) -.withSize(2,2).withProperties(Map.of("Label position","LEFT")); -GenericEntry autobalance = layoutauto.add("choix balance",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); -GenericEntry autosortir = layoutauto.add("choix sorit",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); public RobotContainer() { chooser.addOption(enhaut, enhaut); chooser.addOption(enbas, enbas); From ee40b0a976256b9ec8c0465bcbca9b047acba88a Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 20 Mar 2023 18:08:00 -0400 Subject: [PATCH 08/32] k --- src/main/java/frc/robot/RobotContainer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 92f0f89..bbe956d 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -56,6 +56,7 @@ public class RobotContainer { CommandXboxController manette1 = new CommandXboxController(0); CommandXboxController manette2 = new CommandXboxController(1); +// dashboard SendableChooser chooser = new SendableChooser<>(); String enhaut = "en haut"; String aumilieux = "au milieux"; @@ -68,6 +69,7 @@ GenericEntry autosortir = layoutauto.add("choix sortir",false).withWidget(BuiltI GenericEntry reculerdistances = layoutauto.addPersistent("reculerdistancesortir",0).getEntry(); GenericEntry reculerdistanceb = layoutauto.addPersistent("reculerdistancebalance", 0).getEntry(); GenericEntry avancerdistance = layoutauto.addPersistent("avancer",0).getEntry(); + // subsystems BasePilotable basePilotable = new BasePilotable(); Gratte gratte = new Gratte(); @@ -75,6 +77,7 @@ BrasTelescopique brasTelescopique = new BrasTelescopique(); Pince pince = new Pince(); Pivot pivot = new Pivot(); Limelight limelight = new Limelight(); + //commands BrakeFerme brakeFerme = new BrakeFerme(basePilotable); BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable); @@ -134,7 +137,7 @@ public RobotContainer() { manette2.b().whileTrue(gratteBaisser); } - + //mode auto public Command getAutonomousCommand() { chooser.getSelected(); autobalance.getBoolean(true); From 795ff3e2dfc4a8953392323a15263555061cb821 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 20 Mar 2023 18:09:12 -0400 Subject: [PATCH 09/32] fxnb --- src/main/java/frc/robot/RobotContainer.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index a68925a..0a935f3 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -55,12 +55,6 @@ public class RobotContainer { CommandXboxController manette1 = new CommandXboxController(0); CommandXboxController manette2 = new CommandXboxController(1); - -SendableChooser chooser = new SendableChooser<>(); -String enhaut = "en haut"; -String aumilieux = "au milieux"; -String enbas = "en bas"; -String nulpart = "nul part"; ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto",BuiltInLayouts.kList) .withSize(2, 2).withProperties(Map.of("Label position","LEFT")); GenericEntry autobalance = layoutauto.add("choix balance",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); @@ -105,10 +99,6 @@ String enhaut = "en bas"; String aumilieux = "au milieux"; String enbas = "en bas"; String nulpart = "nul part"; -ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto",BuiltInLayouts.kList) -.withSize(2,2).withProperties(Map.of("Label position","LEFT")); -GenericEntry autobalance = layoutauto.add("choix balance",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); -GenericEntry autosortir = layoutauto.add("choix sorit",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); public RobotContainer() { chooser.addOption(enhaut, enhaut); chooser.addOption(enbas, enbas); From 515421f320edac04877635fcf2c49aed4e504537 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 20 Mar 2023 18:10:53 -0400 Subject: [PATCH 10/32] d --- src/main/java/frc/robot/RobotContainer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 5fc7f7d..88925c0 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -4,7 +4,6 @@ package frc.robot; import java.util.Map; -import java.util.function.DoubleSupplier; import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.networktables.GenericEntry; From a13fdba677a1a02b322e8b297cab2bb866c7747c Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 20 Mar 2023 18:10:45 -0400 Subject: [PATCH 11/32] kk --- src/main/java/frc/robot/RobotContainer.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 0a0f662..4ba220d 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -54,7 +54,6 @@ public class RobotContainer { CommandXboxController manette1 = new CommandXboxController(0); CommandXboxController manette2 = new CommandXboxController(1); -<<<<<<< HEAD // dashboard SendableChooser chooser = new SendableChooser<>(); @@ -62,8 +61,6 @@ String enhaut = "en haut"; String aumilieux = "au milieux"; String enbas = "en bas"; String nulpart = "nul part"; -======= ->>>>>>> 18e7c292ce3d2882eb58ef622b7e497d43d99fea ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto",BuiltInLayouts.kList) .withSize(2, 2).withProperties(Map.of("Label position","LEFT")); GenericEntry autobalance = layoutauto.add("choix balance",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); @@ -105,11 +102,6 @@ PivotManuel pivotManuel = new PivotManuel(pivot,manette2::getLeftX); BrasManuel brasManuel = new BrasManuel(brasTelescopique,manette2::getLeftY); -SendableChooser chooser = new SendableChooser<>(); -String enhaut = "en bas"; -String aumilieux = "au milieux"; -String enbas = "en bas"; -String nulpart = "nul part"; public RobotContainer() { chooser.addOption(enhaut, enhaut); chooser.addOption(enbas, enbas); From 99fe2c7f93be3ee45ba22e235edae27223d1fcd7 Mon Sep 17 00:00:00 2001 From: Olivier Demers Date: Mon, 20 Mar 2023 22:28:06 +0000 Subject: [PATCH 12/32] bras --- src/main/java/frc/robot/RobotContainer.java | 171 +++++++++--------- ...{PivotChercheHaut.java => Bougerbras.java} | 45 ++--- ...{PivotBrasRentre.java => Bougerpivot.java} | 49 ++--- .../commands/bras/DescendrePivotBras.java | 25 +++ .../robot/commands/bras/MonterPivotBras.java | 28 +++ .../robot/commands/bras/PivotChercheBas.java | 67 ------- .../subsystems/bras/BrasTelescopique.java | 2 +- .../java/frc/robot/subsystems/bras/Pivot.java | 1 + 8 files changed, 177 insertions(+), 211 deletions(-) rename src/main/java/frc/robot/commands/bras/{PivotChercheHaut.java => Bougerbras.java} (58%) rename src/main/java/frc/robot/commands/bras/{PivotBrasRentre.java => Bougerpivot.java} (53%) create mode 100644 src/main/java/frc/robot/commands/bras/DescendrePivotBras.java create mode 100644 src/main/java/frc/robot/commands/bras/MonterPivotBras.java delete mode 100644 src/main/java/frc/robot/commands/bras/PivotChercheBas.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 4ba220d..4efd8e3 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -3,6 +3,7 @@ // the WPILib BSD license file in the root directory of this project. package frc.robot; + import java.util.Map; import edu.wpi.first.cameraserver.CameraServer; @@ -39,75 +40,63 @@ import frc.robot.commands.Gyro; import frc.robot.commands.Reculer; import frc.robot.commands.Tape; import frc.robot.commands.bras.BrasManuel; +import frc.robot.commands.bras.DescendrePivotBras; import frc.robot.commands.bras.FermePince; +import frc.robot.commands.bras.MonterPivotBras; import frc.robot.commands.bras.OuvrePince; -import frc.robot.commands.bras.PivotBrasRentre; -import frc.robot.commands.bras.PivotChercheBas; -import frc.robot.commands.bras.PivotChercheHaut; import frc.robot.commands.bras.PivotManuel; -import frc.robot.commands.bras.PivoteBrasBas; -import frc.robot.commands.bras.PivoteBrasHaut; -import frc.robot.commands.bras.PivoteBrasMilieux; - public class RobotContainer { - -CommandXboxController manette1 = new CommandXboxController(0); -CommandXboxController manette2 = new CommandXboxController(1); -// dashboard -SendableChooser chooser = new SendableChooser<>(); -String enhaut = "en haut"; -String aumilieux = "au milieux"; -String enbas = "en bas"; -String nulpart = "nul part"; -ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto",BuiltInLayouts.kList) -.withSize(2, 2).withProperties(Map.of("Label position","LEFT")); -GenericEntry autobalance = layoutauto.add("choix balance",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); -GenericEntry autosortir = layoutauto.add("choix sortir",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); -GenericEntry reculerdistances = layoutauto.addPersistent("reculerdistancesortir",0).getEntry(); -GenericEntry reculerdistanceb = layoutauto.addPersistent("reculerdistancebalance", 0).getEntry(); -GenericEntry avancerdistance = layoutauto.addPersistent("avancer",0).getEntry(); + CommandXboxController manette1 = new CommandXboxController(0); + CommandXboxController manette2 = new CommandXboxController(1); -// subsystems -BasePilotable basePilotable = new BasePilotable(); -Gratte gratte = new Gratte(); -BrasTelescopique brasTelescopique = new BrasTelescopique(); -Pince pince = new Pince(); -Pivot pivot = new Pivot(); -Limelight limelight = new Limelight(); + // dashboard + SendableChooser chooser = new SendableChooser<>(); + String enhaut = "en haut"; + String aumilieux = "au milieux"; + String enbas = "en bas"; + String nulpart = "nul part"; + ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto", BuiltInLayouts.kList) + .withSize(2, 2).withProperties(Map.of("Label position", "LEFT")); + GenericEntry autobalance = layoutauto.add("choix balance", true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); + GenericEntry autosortir = layoutauto.add("choix sortir", false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); + GenericEntry reculerdistances = layoutauto.addPersistent("reculerdistancesortir", 0).getEntry(); + GenericEntry reculerdistanceb = layoutauto.addPersistent("reculerdistancebalance", 0).getEntry(); + GenericEntry avancerdistance = layoutauto.addPersistent("avancer", 0).getEntry(); -//commands -BrakeFerme brakeFerme = new BrakeFerme(basePilotable); -BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable); -GratteBaisser gratteBaisser = new GratteBaisser(gratte); -GratteMonte gratteMonte = new GratteMonte(gratte); -Gyro gyro = new Gyro(basePilotable); -FermePince fermePince = new FermePince(pince); -OuvrePince ouvrePince = new OuvrePince(pince); -PivotBrasRentre pivotBrasRentre = new PivotBrasRentre(brasTelescopique, pivot); -PivoteBrasBas pivoteBrasBas = new PivoteBrasBas(brasTelescopique, pivot); -PivoteBrasMilieux pivoteBrasMilieux = new PivoteBrasMilieux(brasTelescopique, pivot); -PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot); -Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY()); -Reculer reculers = new Reculer(basePilotable, ()->reculerdistances.getDouble(0)); -Reculer reculerb = new Reculer(basePilotable, ()->reculerdistanceb.getDouble(0)); -Avancer avancer = new Avancer(basePilotable, ()->avancerdistance.getDouble(0)); -PivotChercheBas pivotChercheBas = new PivotChercheBas(brasTelescopique, pivot); -PivotChercheHaut pivotChercheHaut = new PivotChercheHaut(brasTelescopique, pivot); -Cube cube = new Cube(limelight, basePilotable, null); -Apriltag aprilTag = new Apriltag(limelight, basePilotable, null); -Tape tape = new Tape(limelight, basePilotable, null); -PivotManuel pivotManuel = new PivotManuel(pivot,manette2::getLeftX); -BrasManuel brasManuel = new BrasManuel(brasTelescopique,manette2::getLeftY); + // subsystems + BasePilotable basePilotable = new BasePilotable(); + Gratte gratte = new Gratte(); + BrasTelescopique brasTelescopique = new BrasTelescopique(); + Pince pince = new Pince(); + Pivot pivot = new Pivot(); + Limelight limelight = new Limelight(); + // commands + BrakeFerme brakeFerme = new BrakeFerme(basePilotable); + BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable); + GratteBaisser gratteBaisser = new GratteBaisser(gratte); + GratteMonte gratteMonte = new GratteMonte(gratte); + Gyro gyro = new Gyro(basePilotable); + FermePince fermePince = new FermePince(pince); + OuvrePince ouvrePince = new OuvrePince(pince); + Cone cone = new Cone(limelight, basePilotable, () -> -manette1.getLeftY()); + Reculer reculers = new Reculer(basePilotable, () -> reculerdistances.getDouble(0)); + Reculer reculerb = new Reculer(basePilotable, () -> reculerdistanceb.getDouble(0)); + Avancer avancer = new Avancer(basePilotable, () -> avancerdistance.getDouble(0)); + Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY()); + Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY()); + Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY()); + PivotManuel pivotManuel = new PivotManuel(pivot, manette2::getLeftX); + BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette2::getLeftY); -public RobotContainer() { + public RobotContainer() { chooser.addOption(enhaut, enhaut); chooser.addOption(enbas, enbas); chooser.addOption(aumilieux, aumilieux); chooser.addOption(nulpart, nulpart); - layoutauto.add("choix hauteur",chooser); + layoutauto.add("choix hauteur", chooser); configureBindings(); CameraServer.startAutomaticCapture(); basePilotable.setDefaultCommand(new RunCommand(() -> { @@ -116,48 +105,58 @@ public RobotContainer() { brasTelescopique.setDefaultCommand(brasManuel); pivot.setDefaultCommand(pivotManuel); } + private void configureBindings() { // manette 1 - manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); - manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable)); - manette1.leftBumper().toggleOnTrue(aprilTag); - manette1.rightBumper().toggleOnTrue(tape); - manette1.povUp().whileTrue(pivoteBrasHaut); - manette1.povDown().whileTrue(pivoteBrasBas); - manette1.povRight().whileTrue(pivoteBrasMilieux); - manette1.povLeft().whileTrue(pivotBrasRentre); - //manette 2 - manette2.povDown().onTrue(pivotChercheBas); - manette2.povUp().onTrue(pivotChercheHaut); - manette2.rightBumper().toggleOnTrue(cube); - manette2.leftBumper().toggleOnTrue(cone); + manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer, pince)); + manette1.x().onTrue(brakeOuvre); + manette1.b().onTrue(brakeFerme); + manette1.leftBumper().whileTrue(aprilTag); + manette1.rightBumper().whileTrue(tape); + manette1.povUp().whileTrue(creerCommandBras(51, -40)); + manette1.povDown().whileTrue(creerCommandBras(9, -14)); + manette1.povRight().whileTrue(creerCommandBras(44, -17)); + manette1.povLeft().whileTrue(creerCommandBras(0, 0)); + // manette 2 + manette2.povDown().onTrue(creerCommandBras(9, -18)); + manette2.povUp().onTrue(creerCommandBras(44, 0)); + manette2.rightBumper().whileTrue(cube); + manette2.leftBumper().whileTrue(cone); manette2.y().whileTrue(gyro); manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro)); manette2.a().whileTrue(gratteMonte); manette2.b().whileTrue(gratteBaisser); } - //mode auto + + private Command creerCommandBras(double distancePivot, double distanceBras) { + return Commands.either( + new MonterPivotBras(brasTelescopique, pivot, distanceBras, distancePivot), + new DescendrePivotBras(brasTelescopique, pivot, distanceBras, distancePivot), + () -> pivot.distance() < distancePivot); + } + public Command getAutonomousCommand() { chooser.getSelected(); autobalance.getBoolean(true); - return new SequentialCommandGroup( - Commands.select(Map.ofEntries( - Map.entry(enhaut,pivoteBrasHaut), - Map.entry(aumilieux,pivoteBrasMilieux), - Map.entry(enbas,pivoteBrasBas), - Map.entry(nulpart,pivotBrasRentre) - ), chooser::getSelected), - new OuvrePince(pince).unless(()->chooser.getSelected().equals(nulpart)), - Commands.waitSeconds(1), - new FermePince(pince).unless(()->chooser.getSelected().equals(nulpart)), - new PivotBrasRentre(brasTelescopique , pivot).unless(()->chooser.getSelected().equals(nulpart)), - Commands.waitSeconds(1), - Commands.either(reculers, reculerb,()-> autosortir.getBoolean(true)), - new Avancer(basePilotable,()-> avancerdistance.getDouble(0)).unless(()->!autosortir.getBoolean(true)|| autobalance.getBoolean(false)), - Commands.either(gyro, Commands.none(),()-> autobalance.getBoolean(true)) - ).deadlineWith(Commands.waitSeconds(14.6)).andThen(brakeOuvre); - + return Commands.deadline( + Commands.waitSeconds(14.6), + new SequentialCommandGroup( + Commands.select(Map.ofEntries( + Map.entry(enhaut, creerCommandBras(51, -40)), + Map.entry(aumilieux, creerCommandBras(9, -14)), + Map.entry(enbas, creerCommandBras(44, -17)), + Map.entry(nulpart, creerCommandBras(0, 0))), chooser::getSelected), + new OuvrePince(pince).unless(() -> chooser.getSelected().equals(nulpart)), + Commands.waitSeconds(1), + fermePince.unless(() -> chooser.getSelected().equals(nulpart)), + creerCommandBras(0, 0).unless(() -> chooser.getSelected().equals(nulpart)), + Commands.waitSeconds(1), + Commands.either(reculers, reculerb, () -> autosortir.getBoolean(true)), + new Avancer(basePilotable, () -> avancerdistance.getDouble(0)) + .unless(() -> !autosortir.getBoolean(true) || !autobalance.getBoolean(false)), + Commands.either(gyro, Commands.none(), () -> autobalance.getBoolean(true)))) + .andThen(brakeOuvre); } } diff --git a/src/main/java/frc/robot/commands/bras/PivotChercheHaut.java b/src/main/java/frc/robot/commands/bras/Bougerbras.java similarity index 58% rename from src/main/java/frc/robot/commands/bras/PivotChercheHaut.java rename to src/main/java/frc/robot/commands/bras/Bougerbras.java index 19bfcac..6390c94 100644 --- a/src/main/java/frc/robot/commands/bras/PivotChercheHaut.java +++ b/src/main/java/frc/robot/commands/bras/Bougerbras.java @@ -6,45 +6,36 @@ package frc.robot.commands.bras; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.bras.BrasTelescopique; -import frc.robot.subsystems.bras.Pivot; -public class PivotChercheHaut extends CommandBase { - private BrasTelescopique brasTelescopique; - private Pivot pivot; - /** Creates a new PivotChercheHaut. */ - public PivotChercheHaut(BrasTelescopique brasTelescopique, Pivot pivot) { +public class Bougerbras extends CommandBase { + /** Creates a new bougerbras. */ + double distance; + BrasTelescopique brasTelescopique; + public Bougerbras(BrasTelescopique brasTelescopique,double distance) { this.brasTelescopique = brasTelescopique; - this.pivot = pivot; - // Use addRequirements() here to declare subsystem dependencies. + this.distance = distance; addRequirements(brasTelescopique); - addRequirements(pivot); + // Use addRequirements() here to declare subsystem dependencies. } // Called when the command is initially scheduled. @Override public void initialize() { - brasTelescopique.fermer(); + } // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(brasTelescopique.photocell()){ - brasTelescopique.ouvrir(); - brasTelescopique.Reset(); - brasTelescopique.AvanceRecule(0); - } - else{ + if(brasTelescopique.distance()>distance+0.5 ) { + brasTelescopique.AvanceRecule(-0.3); + + } + else if(brasTelescopique.distance()44.5) { - pivot.monteDescendre(-0.5); - } - else{ - pivot.monteDescendre(0); + else { + brasTelescopique.AvanceRecule(0); } } @@ -52,13 +43,13 @@ public class PivotChercheHaut extends CommandBase { @Override public void end(boolean interrupted) { brasTelescopique.AvanceRecule(0); - pivot.monteDescendre(0); - brasTelescopique.ouvrir(); } // Returns true when the command should end. @Override public boolean isFinished() { - return false; + return brasTelescopique.distance()>distance-0.5 && brasTelescopique.distance()distance+0.5 ) { pivot.monteDescendre(-0.5); } + else if(pivot.distance()distance-0.5 && pivot.distance()pivot.distance()>8),new Bougerbras(brasTelescopique, distanceBras)), + new Bougerpivot(pivot, distancePivot) + + ); + } +} diff --git a/src/main/java/frc/robot/commands/bras/PivotChercheBas.java b/src/main/java/frc/robot/commands/bras/PivotChercheBas.java deleted file mode 100644 index d52b893..0000000 --- a/src/main/java/frc/robot/commands/bras/PivotChercheBas.java +++ /dev/null @@ -1,67 +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.bras; - -import edu.wpi.first.wpilibj2.command.CommandBase; -import frc.robot.subsystems.bras.BrasTelescopique; -import frc.robot.subsystems.bras.Pivot; - -public class PivotChercheBas extends CommandBase { - private BrasTelescopique brasTelescopique; - private Pivot pivot; - /** Creates a new PivotChercheBas. */ - public PivotChercheBas(BrasTelescopique brasTelescopique, Pivot pivot) { - this.brasTelescopique = brasTelescopique; - this.pivot = pivot; - // Use addRequirements() here to declare subsystem dependencies. - addRequirements(brasTelescopique); - addRequirements(pivot); - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - brasTelescopique.fermer(); - } - - // Called every time the scheduler runs while the command is scheduled. - @Override - public void execute() { - if(brasTelescopique.distance()>-17.5){ - brasTelescopique.AvanceRecule(-0.2); - brasTelescopique.fermer(); - } - else if(brasTelescopique.distance()<-19.5) { - brasTelescopique.AvanceRecule(0.2); - } - else { - brasTelescopique.AvanceRecule(0); - brasTelescopique.ouvrir(); - } - if (pivot.distance()<8.5){ - pivot.monteDescendre(0.3); - } - else if(pivot.distance()>10.5) { - pivot.monteDescendre(-0.3); - } - else{ - pivot.monteDescendre(0); - } - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - brasTelescopique.AvanceRecule(0); - pivot.monteDescendre(0); - brasTelescopique.fermer(); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} \ No newline at end of file diff --git a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java index 12b82b9..dc2d69b 100644 --- a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java +++ b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java @@ -51,6 +51,6 @@ public class BrasTelescopique extends SubsystemBase { } @Override public void periodic() { - + if(photocell())Reset(); } } \ No newline at end of file diff --git a/src/main/java/frc/robot/subsystems/bras/Pivot.java b/src/main/java/frc/robot/subsystems/bras/Pivot.java index 6fc13b9..744020a 100644 --- a/src/main/java/frc/robot/subsystems/bras/Pivot.java +++ b/src/main/java/frc/robot/subsystems/bras/Pivot.java @@ -42,6 +42,7 @@ public class Pivot extends SubsystemBase { } @Override public void periodic() { + if(limitpivot())Reset(); } From 10bdfe9ba33d56031a77c0c66c2826af6190fa7d Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 20 Mar 2023 18:41:04 -0400 Subject: [PATCH 13/32] ui --- src/main/java/frc/robot/RobotContainer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 4ba220d..dbdc515 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -118,6 +118,7 @@ public RobotContainer() { } private void configureBindings() { // manette 1 + //y lumiere limelight, manuel 2e joystik, manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable)); manette1.leftBumper().toggleOnTrue(aprilTag); From c121ff5ec0db05d3c842b5f9ae30086e889d4e01 Mon Sep 17 00:00:00 2001 From: EdwardFaucher Date: Mon, 20 Mar 2023 18:47:03 -0400 Subject: [PATCH 14/32] dgbv n --- src/main/java/frc/robot/RobotContainer.java | 4 ++-- src/main/java/frc/robot/commands/bras/BrasManuel.java | 6 ++++-- src/main/java/frc/robot/commands/bras/PivotManuel.java | 8 ++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 4efd8e3..6d85b4b 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -88,8 +88,8 @@ public class RobotContainer { Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY()); Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY()); Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY()); - PivotManuel pivotManuel = new PivotManuel(pivot, manette2::getLeftX); - BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette2::getLeftY); + PivotManuel pivotManuel = new PivotManuel(pivot, manette2::getRightY); + BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette2::getLeftX); public RobotContainer() { chooser.addOption(enhaut, enhaut); diff --git a/src/main/java/frc/robot/commands/bras/BrasManuel.java b/src/main/java/frc/robot/commands/bras/BrasManuel.java index 844c681..25343bd 100644 --- a/src/main/java/frc/robot/commands/bras/BrasManuel.java +++ b/src/main/java/frc/robot/commands/bras/BrasManuel.java @@ -30,9 +30,11 @@ public class BrasManuel extends CommandBase { @Override public void execute() { if(doubleSupplier.getAsDouble()>0.2 || doubleSupplier.getAsDouble()<-0.2){ - brasTelescopique.AvanceRecule(doubleSupplier.getAsDouble()); + brasTelescopique.AvanceRecule(doubleSupplier.getAsDouble()*0.5); } - + else{ + brasTelescopique.AvanceRecule(0); + } } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/commands/bras/PivotManuel.java b/src/main/java/frc/robot/commands/bras/PivotManuel.java index 32979d0..a802781 100644 --- a/src/main/java/frc/robot/commands/bras/PivotManuel.java +++ b/src/main/java/frc/robot/commands/bras/PivotManuel.java @@ -28,9 +28,13 @@ public class PivotManuel extends CommandBase { @Override public void execute() { if(doubleSupplier.getAsDouble()>0.2 || doubleSupplier.getAsDouble()<-0.2){ - pivot.monteDescendre(doubleSupplier.getAsDouble());} + pivot.monteDescendre(-doubleSupplier.getAsDouble()*0.5) + ;} + else{ + pivot.monteDescendre(0); + } } - + // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) {} From 56d5b89a19d4a1bb3d4beb14043d9e1f95880d22 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 20 Mar 2023 18:47:53 -0400 Subject: [PATCH 15/32] io --- src/main/java/frc/robot/RobotContainer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index d50e4e5..77a4d65 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -113,10 +113,10 @@ public class RobotContainer { manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable)); manette1.leftBumper().toggleOnTrue(aprilTag); manette1.rightBumper().toggleOnTrue(tape); - manette1.povUp().whileTrue(pivoteBrasHaut); - manette1.povDown().whileTrue(pivoteBrasBas); - manette1.povRight().whileTrue(pivoteBrasMilieux); - manette1.povLeft().whileTrue(pivotBrasRentre); + manette1.povUp().whileTrue(creerCommandBras(51, -40)); + manette1.povDown().whileTrue(creerCommandBras(0, 0)); + manette1.povRight().whileTrue(creerCommandBras(0, 0)); + manette1.povLeft().whileTrue(creerCommandBras(0, 0)); //manette 2 manette2.povDown().onTrue(pivotChercheBas); manette2.povUp().onTrue(pivotChercheHaut); From 627b365cdad192e7d26085dc97ae0a75fb05eb76 Mon Sep 17 00:00:00 2001 From: EdwardFaucher Date: Mon, 20 Mar 2023 18:49:15 -0400 Subject: [PATCH 16/32] gxb --- src/main/java/frc/robot/RobotContainer.java | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index d50e4e5..908d820 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -88,8 +88,8 @@ public class RobotContainer { Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY()); Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY()); Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY()); - PivotManuel pivotManuel = new PivotManuel(pivot, manette2::getRightY); - BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette2::getLeftX); + PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getLeftY); + BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getLeftX); public RobotContainer() { chooser.addOption(enhaut, enhaut); @@ -108,20 +108,20 @@ public class RobotContainer { private void configureBindings() { // manette 1 - //y lumiere limelight, manuel 2e joystik, - manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); - manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable)); - manette1.leftBumper().toggleOnTrue(aprilTag); - manette1.rightBumper().toggleOnTrue(tape); - manette1.povUp().whileTrue(pivoteBrasHaut); - manette1.povDown().whileTrue(pivoteBrasBas); - manette1.povRight().whileTrue(pivoteBrasMilieux); - manette1.povLeft().whileTrue(pivotBrasRentre); - //manette 2 - manette2.povDown().onTrue(pivotChercheBas); - manette2.povUp().onTrue(pivotChercheHaut); - manette2.rightBumper().toggleOnTrue(cube); - manette2.leftBumper().toggleOnTrue(cone); + manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer, pince)); + manette1.x().onTrue(brakeOuvre); + manette1.b().onTrue(brakeFerme); + manette1.leftBumper().whileTrue(aprilTag); + manette1.rightBumper().whileTrue(tape); + manette1.povUp().whileTrue(creerCommandBras(51, -40)); + manette1.povDown().whileTrue(creerCommandBras(9, -14)); + manette1.povRight().whileTrue(creerCommandBras(44, -17)); + manette1.povLeft().whileTrue(creerCommandBras(0, 0)); + // manette 2 + manette2.povDown().onTrue(creerCommandBras(9, -18)); + manette2.povUp().onTrue(creerCommandBras(44, 0)); + manette2.rightBumper().whileTrue(cube); + manette2.leftBumper().whileTrue(cone); manette2.y().whileTrue(gyro); manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro)); manette2.a().whileTrue(gratteMonte); From 60fee7a220526ec9cf50c9690ac5993a24a35e09 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 20 Mar 2023 18:55:50 -0400 Subject: [PATCH 17/32] drfkjdfxfkjjdf(message constructif) --- .../frc/robot/commands/ActiverLimeLight.java | 38 +++++++++++++++++++ .../java/frc/robot/subsystems/Limelight.java | 3 ++ 2 files changed, 41 insertions(+) create mode 100644 src/main/java/frc/robot/commands/ActiverLimeLight.java diff --git a/src/main/java/frc/robot/commands/ActiverLimeLight.java b/src/main/java/frc/robot/commands/ActiverLimeLight.java new file mode 100644 index 0000000..79e7fe9 --- /dev/null +++ b/src/main/java/frc/robot/commands/ActiverLimeLight.java @@ -0,0 +1,38 @@ +// 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.CommandBase; +import frc.robot.subsystems.Limelight; + +public class ActiverLimeLight extends CommandBase { + private Limelight limelight; + /** Creates a new ActiverLimeLight. */ + public ActiverLimeLight(Limelight limelight) { + this.limelight = limelight; + // Use addRequirements() here to declare subsystem dependencies. + addRequirements(limelight); + } + + // 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() { + limelight.joueurhumain(); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/subsystems/Limelight.java b/src/main/java/frc/robot/subsystems/Limelight.java index f6ff621..4663c1b 100644 --- a/src/main/java/frc/robot/subsystems/Limelight.java +++ b/src/main/java/frc/robot/subsystems/Limelight.java @@ -56,6 +56,9 @@ public class Limelight extends SubsystemBase { limelight.setLED(VisionLEDMode.kOff); limelight.setDriverMode(true); } + public void joueurhumain(){ + limelight.setLED(VisionLEDMode.kOff); + } @Override public void periodic() { } From dd3211b6ea83a2db8162f1d8d9cba4dc17a18b7c Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 20 Mar 2023 19:00:25 -0400 Subject: [PATCH 18/32] j --- src/main/java/frc/robot/RobotContainer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index eef19da..04667cc 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -45,7 +45,7 @@ import frc.robot.commands.bras.FermePince; import frc.robot.commands.bras.MonterPivotBras; import frc.robot.commands.bras.OuvrePince; import frc.robot.commands.bras.PivotManuel; - +import frc.robot.commands.ActiverLimeLight; public class RobotContainer { CommandXboxController manette1 = new CommandXboxController(0); @@ -90,6 +90,7 @@ public class RobotContainer { Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY()); PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getLeftY); BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getLeftX); + ActiverLimeLight activerLimeLight = new ActiverLimeLight(limelight); public RobotContainer() { chooser.addOption(enhaut, enhaut); @@ -118,6 +119,7 @@ public class RobotContainer { manette1.povDown().whileTrue(creerCommandBras(9, -14)); manette1.povRight().whileTrue(creerCommandBras(44, -17)); manette1.povLeft().whileTrue(creerCommandBras(0, 0)); + manette1.y().whileTrue(activerLimeLight); //manette 2 manette2.povDown().whileTrue(creerCommandBras(9, -18)); manette2.povUp().whileTrue(creerCommandBras(44, 0)); From 1da49837db76e3ae31f03d0e1593aec704cc02df Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 20 Mar 2023 19:15:34 -0400 Subject: [PATCH 19/32] d --- src/main/java/frc/robot/RobotContainer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 04667cc..729301c 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -109,7 +109,6 @@ public class RobotContainer { private void configureBindings() { // manette 1 - //y lumiere limelight, manuel 2e joystik, manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); manette1.x().onTrue(brakeOuvre); manette1.b().onTrue(brakeFerme); @@ -152,12 +151,11 @@ public class RobotContainer { Map.entry(nulpart, creerCommandBras(0, 0))), chooser::getSelected), new OuvrePince(pince).unless(() -> chooser.getSelected().equals(nulpart)), Commands.waitSeconds(1), - fermePince.unless(() -> chooser.getSelected().equals(nulpart)), + new FermePince(pince).unless(() -> chooser.getSelected().equals(nulpart)), creerCommandBras(0, 0).unless(() -> chooser.getSelected().equals(nulpart)), Commands.waitSeconds(1), Commands.either(reculers, reculerb, () -> autosortir.getBoolean(true)), - new Avancer(basePilotable, () -> avancerdistance.getDouble(0)) - .unless(() -> !autosortir.getBoolean(true) || !autobalance.getBoolean(false)), + new Avancer(basePilotable, () -> avancerdistance.getDouble(0)).unless(() -> !autosortir.getBoolean(true) || !autobalance.getBoolean(false)), Commands.either(gyro, Commands.none(), () -> autobalance.getBoolean(true)))) .andThen(brakeOuvre); From 25a11282e5c06b90a6fa56de914ace7e1939df1b Mon Sep 17 00:00:00 2001 From: EdwardFaucher Date: Mon, 20 Mar 2023 19:17:21 -0400 Subject: [PATCH 20/32] sdfg --- src/main/java/frc/robot/RobotContainer.java | 8 ++++---- src/main/java/frc/robot/commands/bras/PivoteBrasHaut.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 908d820..151c2cf 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -88,8 +88,8 @@ public class RobotContainer { Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY()); Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY()); Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY()); - PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getLeftY); - BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getLeftX); + PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getRightY); + BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getRightX); public RobotContainer() { chooser.addOption(enhaut, enhaut); @@ -118,8 +118,8 @@ public class RobotContainer { manette1.povRight().whileTrue(creerCommandBras(44, -17)); manette1.povLeft().whileTrue(creerCommandBras(0, 0)); // manette 2 - manette2.povDown().onTrue(creerCommandBras(9, -18)); - manette2.povUp().onTrue(creerCommandBras(44, 0)); + manette2.povDown().whileTrue(creerCommandBras(9, -18)); + manette2.povUp().whileTrue(creerCommandBras(44, 0)); manette2.rightBumper().whileTrue(cube); manette2.leftBumper().whileTrue(cone); manette2.y().whileTrue(gyro); diff --git a/src/main/java/frc/robot/commands/bras/PivoteBrasHaut.java b/src/main/java/frc/robot/commands/bras/PivoteBrasHaut.java index c670121..831991a 100644 --- a/src/main/java/frc/robot/commands/bras/PivoteBrasHaut.java +++ b/src/main/java/frc/robot/commands/bras/PivoteBrasHaut.java @@ -29,21 +29,21 @@ public class PivoteBrasHaut extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(brasTelescopique.distance()>-39.5){ + if(brasTelescopique.distance()>-36.5){ brasTelescopique.AvanceRecule(-0.15); brasTelescopique.fermer(); } - else if(brasTelescopique.distance()<-41.5) { + else if(brasTelescopique.distance()<-37.5) { brasTelescopique.AvanceRecule(-0.15); } else { brasTelescopique.AvanceRecule(0); brasTelescopique.ouvrir(); } - if (pivot.distance()<50.5){ + if (pivot.distance()<52.5){ pivot.monteDescendre(0.5); } - else if(pivot.distance()>52.5) { + else if(pivot.distance()>53.5) { pivot.monteDescendre(-0.5); } else{ From 991703ce734a61eac2b693e17ae9bedd544a83c7 Mon Sep 17 00:00:00 2001 From: EdwardFaucher Date: Mon, 20 Mar 2023 19:24:26 -0400 Subject: [PATCH 21/32] fghnb --- src/main/java/frc/robot/RobotContainer.java | 9 --------- src/main/java/frc/robot/commands/bras/PivoteBrasBas.java | 8 ++++---- .../java/frc/robot/commands/bras/PivoteBrasMilieux.java | 4 ++-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 11a419e..6ba36d8 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -88,14 +88,9 @@ public class RobotContainer { Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY()); Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY()); Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY()); -<<<<<<< HEAD PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getRightY); BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getRightX); -======= - PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getLeftY); - BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getLeftX); ActiverLimeLight activerLimeLight = new ActiverLimeLight(limelight); ->>>>>>> 1da49837db76e3ae31f03d0e1593aec704cc02df public RobotContainer() { chooser.addOption(enhaut, enhaut); @@ -123,12 +118,8 @@ public class RobotContainer { manette1.povDown().whileTrue(creerCommandBras(9, -14)); manette1.povRight().whileTrue(creerCommandBras(44, -17)); manette1.povLeft().whileTrue(creerCommandBras(0, 0)); -<<<<<<< HEAD - // manette 2 -======= manette1.y().whileTrue(activerLimeLight); //manette 2 ->>>>>>> 1da49837db76e3ae31f03d0e1593aec704cc02df manette2.povDown().whileTrue(creerCommandBras(9, -18)); manette2.povUp().whileTrue(creerCommandBras(44, 0)); manette2.rightBumper().whileTrue(cube); diff --git a/src/main/java/frc/robot/commands/bras/PivoteBrasBas.java b/src/main/java/frc/robot/commands/bras/PivoteBrasBas.java index a6015d7..8f029b3 100644 --- a/src/main/java/frc/robot/commands/bras/PivoteBrasBas.java +++ b/src/main/java/frc/robot/commands/bras/PivoteBrasBas.java @@ -31,21 +31,21 @@ public class PivoteBrasBas extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(brasTelescopique.distance()>-13.5){ + if(brasTelescopique.distance()>-8.5){ brasTelescopique.AvanceRecule(-0.2); brasTelescopique.fermer(); } - else if(brasTelescopique.distance()<-15.5) { + else if(brasTelescopique.distance()<-9.5) { brasTelescopique.AvanceRecule(0.2); } else { brasTelescopique.AvanceRecule(0); brasTelescopique.ouvrir(); } - if (pivot.distance()<8.5){ + if (pivot.distance()<12.5){ pivot.monteDescendre(0.4); } - else if(pivot.distance()>10.5) { + else if(pivot.distance()>13.5) { pivot.monteDescendre(-0.4); } else{ diff --git a/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java b/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java index 764050b..4494a33 100644 --- a/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java +++ b/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java @@ -29,11 +29,11 @@ public class PivoteBrasMilieux extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(brasTelescopique.distance()>-16.5){ + if(brasTelescopique.distance()>-12.5){ brasTelescopique.AvanceRecule(-0.15); brasTelescopique.fermer(); } - else if(brasTelescopique.distance()<-17.5) { + else if(brasTelescopique.distance()<-13.5) { brasTelescopique.AvanceRecule(0.15); } else { From 74a26d445462a27537933e724c6a7b0ad41506a4 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 21 Mar 2023 18:06:31 -0400 Subject: [PATCH 22/32] gvnbm --- src/main/java/frc/robot/RobotContainer.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 11a419e..1d6d016 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -88,14 +88,9 @@ public class RobotContainer { Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY()); Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY()); Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY()); -<<<<<<< HEAD PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getRightY); BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getRightX); -======= - PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getLeftY); - BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getLeftX); ActiverLimeLight activerLimeLight = new ActiverLimeLight(limelight); ->>>>>>> 1da49837db76e3ae31f03d0e1593aec704cc02df public RobotContainer() { chooser.addOption(enhaut, enhaut); @@ -123,12 +118,8 @@ public class RobotContainer { manette1.povDown().whileTrue(creerCommandBras(9, -14)); manette1.povRight().whileTrue(creerCommandBras(44, -17)); manette1.povLeft().whileTrue(creerCommandBras(0, 0)); -<<<<<<< HEAD - // manette 2 -======= manette1.y().whileTrue(activerLimeLight); //manette 2 ->>>>>>> 1da49837db76e3ae31f03d0e1593aec704cc02df manette2.povDown().whileTrue(creerCommandBras(9, -18)); manette2.povUp().whileTrue(creerCommandBras(44, 0)); manette2.rightBumper().whileTrue(cube); @@ -151,7 +142,7 @@ public class RobotContainer { chooser.getSelected(); autobalance.getBoolean(true); return Commands.deadline( - Commands.waitSeconds(14.6), + Commands.waitSeconds(14), new SequentialCommandGroup( Commands.select(Map.ofEntries( Map.entry(enhaut, creerCommandBras(51, -40)), From 5916701726c46fe5b86942ec6dd382151dff8505 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 21 Mar 2023 18:17:45 -0400 Subject: [PATCH 23/32] h --- src/main/java/frc/robot/RobotContainer.java | 4 ++-- src/main/java/frc/robot/commands/Gyro.java | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 1d6d016..633b898 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -156,8 +156,8 @@ public class RobotContainer { Commands.waitSeconds(1), Commands.either(reculers, reculerb, () -> autosortir.getBoolean(true)), new Avancer(basePilotable, () -> avancerdistance.getDouble(0)).unless(() -> !autosortir.getBoolean(true) || !autobalance.getBoolean(false)), - Commands.either(gyro, Commands.none(), () -> autobalance.getBoolean(true)))) - .andThen(brakeOuvre); + Commands.either(new Gyro(basePilotable), Commands.none(), () -> autobalance.getBoolean(true)))) + .andThen(new BrakeOuvre(basePilotable)); } } diff --git a/src/main/java/frc/robot/commands/Gyro.java b/src/main/java/frc/robot/commands/Gyro.java index 0917326..e6b1598 100644 --- a/src/main/java/frc/robot/commands/Gyro.java +++ b/src/main/java/frc/robot/commands/Gyro.java @@ -4,8 +4,6 @@ package frc.robot.commands; -import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; -import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.BasePilotable; From d3e305c11ae5ec2975a4d573c77d163ee947f3d9 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 21 Mar 2023 18:23:18 -0400 Subject: [PATCH 24/32] dth --- src/main/java/frc/robot/commands/Avancer.java | 7 +++---- src/main/java/frc/robot/commands/Reculer.java | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/frc/robot/commands/Avancer.java b/src/main/java/frc/robot/commands/Avancer.java index 0b94017..68c0200 100644 --- a/src/main/java/frc/robot/commands/Avancer.java +++ b/src/main/java/frc/robot/commands/Avancer.java @@ -7,9 +7,6 @@ package frc.robot.commands; import java.util.function.DoubleSupplier; -import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; -import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.BasePilotable; @@ -38,7 +35,9 @@ public class Avancer extends CommandBase { // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + basePilotable.drive(0,0); + } // Returns true when the command should end. @Override diff --git a/src/main/java/frc/robot/commands/Reculer.java b/src/main/java/frc/robot/commands/Reculer.java index ecc904f..903b216 100644 --- a/src/main/java/frc/robot/commands/Reculer.java +++ b/src/main/java/frc/robot/commands/Reculer.java @@ -35,7 +35,9 @@ public class Reculer extends CommandBase { // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + basePilotable.drive(0,0); + } // Returns true when the command should end. @Override From aa420b56af41558d8c0043369bddd916e6a22930 Mon Sep 17 00:00:00 2001 From: Olivier Demers Date: Tue, 21 Mar 2023 23:17:59 +0000 Subject: [PATCH 25/32] Grattedebug --- src/main/java/frc/robot/Constants.java | 4 ++-- src/main/java/frc/robot/RobotContainer.java | 6 +++--- .../frc/robot/commands/ActiverLimeLight.java | 4 +++- .../frc/robot/commands/GratteBaisser.java | 14 ++++++------- .../java/frc/robot/commands/GratteMonte.java | 13 ++++++------ .../commands/bras/DescendrePivotBras.java | 2 ++ .../robot/commands/bras/MonterPivotBras.java | 10 +++++---- .../commands/bras/PivoteBrasMilieux.java | 4 ++-- .../java/frc/robot/subsystems/Gratte.java | 21 +++---------------- .../java/frc/robot/subsystems/Limelight.java | 5 ++++- 10 files changed, 38 insertions(+), 45 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 13b0abe..692915c 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -11,8 +11,8 @@ public class Constants { //moteur - public static int GratteD = 7; - public static int GratteG = 8; + public static int GratteD = 8; + public static int GratteG = 7; // pneumatique diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 633b898..1acf40d 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -114,9 +114,9 @@ public class RobotContainer { manette1.b().onTrue(brakeFerme); manette1.leftBumper().whileTrue(aprilTag); manette1.rightBumper().whileTrue(tape); - manette1.povUp().whileTrue(creerCommandBras(51, -40)); - manette1.povDown().whileTrue(creerCommandBras(9, -14)); - manette1.povRight().whileTrue(creerCommandBras(44, -17)); + manette1.povUp().whileTrue(creerCommandBras(51, -37)); + manette1.povDown().whileTrue(creerCommandBras(9, -12)); + manette1.povRight().whileTrue(creerCommandBras(45, -13)); manette1.povLeft().whileTrue(creerCommandBras(0, 0)); manette1.y().whileTrue(activerLimeLight); //manette 2 diff --git a/src/main/java/frc/robot/commands/ActiverLimeLight.java b/src/main/java/frc/robot/commands/ActiverLimeLight.java index 79e7fe9..3458798 100644 --- a/src/main/java/frc/robot/commands/ActiverLimeLight.java +++ b/src/main/java/frc/robot/commands/ActiverLimeLight.java @@ -28,7 +28,9 @@ public class ActiverLimeLight extends CommandBase { // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + limelight.joueurhumain1(); + } // Returns true when the command should end. @Override diff --git a/src/main/java/frc/robot/commands/GratteBaisser.java b/src/main/java/frc/robot/commands/GratteBaisser.java index 9d1292f..5649059 100644 --- a/src/main/java/frc/robot/commands/GratteBaisser.java +++ b/src/main/java/frc/robot/commands/GratteBaisser.java @@ -20,23 +20,23 @@ public class GratteBaisser extends CommandBase { // Called when the command is initially scheduled. @Override public void initialize() { - gratte.setenHaut(false); + } // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { if(gratte.basd()){ - gratte.baiserd(0); + gratte.bougerd(0); } else{ - gratte.baiserd(0.5); + gratte.bougerd(0.3); } if(gratte.basg()){ - gratte.baiserg(0); + gratte.bougerg(0); } else{ - gratte.baiserg(0.5); + gratte.bougerg(0.3); } @@ -45,8 +45,8 @@ public class GratteBaisser extends CommandBase { // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { - gratte.baiserd(0); - gratte.baiserg(0); + gratte.bougerd(0); + gratte.bougerg(0); } // Returns true when the command should end. diff --git a/src/main/java/frc/robot/commands/GratteMonte.java b/src/main/java/frc/robot/commands/GratteMonte.java index 0fd83fa..5dce6f8 100644 --- a/src/main/java/frc/robot/commands/GratteMonte.java +++ b/src/main/java/frc/robot/commands/GratteMonte.java @@ -20,31 +20,30 @@ public class GratteMonte extends CommandBase { // Called when the command is initially scheduled. @Override public void initialize() { - gratte.setenHaut(true); } // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { if(gratte.hautd()){ - gratte.Leverd(0); + gratte.bougerd(0); } else{ - gratte.Leverd(0.5); + gratte.bougerd(-0.3); } if(gratte.hautg()) { - gratte.Leverg(0); + gratte.bougerg(0); } else{ - gratte.Leverg(0.5); + gratte.bougerg(-0.3); } } // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { - gratte.Leverd(0); - gratte.Leverg(0); + gratte.bougerd(0); + gratte.bougerg(0); } // Returns true when the command should end. diff --git a/src/main/java/frc/robot/commands/bras/DescendrePivotBras.java b/src/main/java/frc/robot/commands/bras/DescendrePivotBras.java index 83cecb7..8b4a615 100644 --- a/src/main/java/frc/robot/commands/bras/DescendrePivotBras.java +++ b/src/main/java/frc/robot/commands/bras/DescendrePivotBras.java @@ -18,8 +18,10 @@ public class DescendrePivotBras extends SequentialCommandGroup { // Add your commands in the addCommands() call, e.g. // addCommands(new FooCommand(), new BarCommand()); addCommands( + new Bougerbras(brasTelescopique, distanceBras), new Bougerpivot(pivot, distancePivot) + ); } } diff --git a/src/main/java/frc/robot/commands/bras/MonterPivotBras.java b/src/main/java/frc/robot/commands/bras/MonterPivotBras.java index a7d8153..b0e6441 100644 --- a/src/main/java/frc/robot/commands/bras/MonterPivotBras.java +++ b/src/main/java/frc/robot/commands/bras/MonterPivotBras.java @@ -4,7 +4,7 @@ package frc.robot.commands.bras; -import edu.wpi.first.wpilibj2.command.Commands; + import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import frc.robot.subsystems.bras.BrasTelescopique; @@ -13,15 +13,17 @@ import frc.robot.subsystems.bras.Pivot; // NOTE: Consider using this command inline, rather than writing a subclass. For more // information, see: // https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html -public class MonterPivotBras extends ParallelCommandGroup { +public class MonterPivotBras extends SequentialCommandGroup { /** Creates a new Sequancepivotbras. */ public MonterPivotBras(BrasTelescopique brasTelescopique, Pivot pivot, double distanceBras, double distancePivot) { // Add your commands in the addCommands() call, e.g. // addCommands(new FooCommand(), new BarCommand()); addCommands( - new SequentialCommandGroup(Commands.waitUntil(()->pivot.distance()>8),new Bougerbras(brasTelescopique, distanceBras)), - new Bougerpivot(pivot, distancePivot) + new Bougerpivot(pivot, 10).unless(()->pivot.distance()>10), + new ParallelCommandGroup(new Bougerpivot(pivot, distancePivot)), + new ParallelCommandGroup(new Bougerbras(brasTelescopique, distanceBras)) + ); } diff --git a/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java b/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java index 4494a33..8d10a66 100644 --- a/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java +++ b/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java @@ -29,11 +29,11 @@ public class PivoteBrasMilieux extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if(brasTelescopique.distance()>-12.5){ + if(brasTelescopique.distance()>-11){ brasTelescopique.AvanceRecule(-0.15); brasTelescopique.fermer(); } - else if(brasTelescopique.distance()<-13.5) { + else if(brasTelescopique.distance()<-13) { brasTelescopique.AvanceRecule(0.15); } else { diff --git a/src/main/java/frc/robot/subsystems/Gratte.java b/src/main/java/frc/robot/subsystems/Gratte.java index d5920cf..b78edad 100644 --- a/src/main/java/frc/robot/subsystems/Gratte.java +++ b/src/main/java/frc/robot/subsystems/Gratte.java @@ -24,15 +24,6 @@ ShuffleboardLayout limitswitchgratte = Shuffleboard.getTab("teb") private DigitalInput limithg = new DigitalInput(Constants.limithg); private DigitalInput limitbd = new DigitalInput(Constants.limitbd); private DigitalInput limitbg = new DigitalInput(Constants.limitbg); - public boolean baiser; - boolean enHaut = true; - public void setenHaut(boolean enHaut){ - this.enHaut = enHaut; - } - public boolean getenHaut(){ - return enHaut; - - } public boolean hautd(){ return limithd.get(); @@ -55,17 +46,11 @@ ShuffleboardLayout limitswitchgratte = Shuffleboard.getTab("teb") limitswitchgratte.addBoolean ("limithd", this::hautd); limitswitchgratte.addBoolean ("limitbg", this::basg); } - public void Leverd(double vitesse){ - Gratted.set(-vitesse); + public void bougerd(double vitesse){ + Gratted.set(vitesse); } - public void Leverg(double vitesse){ - Gratteg.set(-vitesse); - } - public void baiserd(double vitesse){ - Gratted.set(vitesse); - } - public void baiserg(double vitesse){ + public void bougerg(double vitesse){ Gratteg.set(vitesse); } diff --git a/src/main/java/frc/robot/subsystems/Limelight.java b/src/main/java/frc/robot/subsystems/Limelight.java index 4663c1b..0417352 100644 --- a/src/main/java/frc/robot/subsystems/Limelight.java +++ b/src/main/java/frc/robot/subsystems/Limelight.java @@ -47,7 +47,7 @@ public class Limelight extends SubsystemBase { public double getYaw() { var result = limelight.getLatestResult(); if(result.hasTargets()){ - return -result.getBestTarget().getYaw()/60; + return -result.getBestTarget().getYaw()/30; } return 0; @@ -57,6 +57,9 @@ public class Limelight extends SubsystemBase { limelight.setDriverMode(true); } public void joueurhumain(){ + limelight.setLED(VisionLEDMode.kOn); + } + public void joueurhumain1(){ limelight.setLED(VisionLEDMode.kOff); } @Override From e13375bc901fd5b4814a1003932487301f95d688 Mon Sep 17 00:00:00 2001 From: Olivier Demers Date: Tue, 21 Mar 2023 23:21:50 +0000 Subject: [PATCH 26/32] Bras telesco v3 --- src/main/java/frc/robot/RobotContainer.java | 10 +++++----- src/main/java/frc/robot/commands/Gyro.java | 4 ++-- 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 1acf40d..4d521cb 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -115,12 +115,12 @@ public class RobotContainer { manette1.leftBumper().whileTrue(aprilTag); manette1.rightBumper().whileTrue(tape); manette1.povUp().whileTrue(creerCommandBras(51, -37)); - manette1.povDown().whileTrue(creerCommandBras(9, -12)); + manette1.povDown().whileTrue(creerCommandBras(12, -9)); manette1.povRight().whileTrue(creerCommandBras(45, -13)); manette1.povLeft().whileTrue(creerCommandBras(0, 0)); manette1.y().whileTrue(activerLimeLight); //manette 2 - manette2.povDown().whileTrue(creerCommandBras(9, -18)); + manette2.povDown().whileTrue(creerCommandBras(5, -12)); manette2.povUp().whileTrue(creerCommandBras(44, 0)); manette2.rightBumper().whileTrue(cube); manette2.leftBumper().whileTrue(cone); @@ -128,7 +128,6 @@ public class RobotContainer { manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro)); manette2.a().whileTrue(gratteMonte); manette2.b().whileTrue(gratteBaisser); - } private Command creerCommandBras(double distancePivot, double distanceBras) { @@ -142,12 +141,13 @@ public class RobotContainer { chooser.getSelected(); autobalance.getBoolean(true); return Commands.deadline( + Commands.waitSeconds(14), Commands.waitSeconds(14), new SequentialCommandGroup( Commands.select(Map.ofEntries( Map.entry(enhaut, creerCommandBras(51, -40)), - Map.entry(aumilieux, creerCommandBras(9, -14)), - Map.entry(enbas, creerCommandBras(44, -17)), + Map.entry(aumilieux, creerCommandBras(45, -13)), + Map.entry(enbas, creerCommandBras(12, -9)), Map.entry(nulpart, creerCommandBras(0, 0))), chooser::getSelected), new OuvrePince(pince).unless(() -> chooser.getSelected().equals(nulpart)), Commands.waitSeconds(1), diff --git a/src/main/java/frc/robot/commands/Gyro.java b/src/main/java/frc/robot/commands/Gyro.java index e6b1598..5d6b948 100644 --- a/src/main/java/frc/robot/commands/Gyro.java +++ b/src/main/java/frc/robot/commands/Gyro.java @@ -25,11 +25,11 @@ public class Gyro extends CommandBase { public void execute() { if(basePilotable.getpitch()>6) { - basePilotable.drive(0.3*basePilotable.getpitch()/12, 0); + basePilotable.drive(0.4*basePilotable.getpitch()/12, 0); } else if(basePilotable.getpitch()<-6) { - basePilotable.drive(0.3*basePilotable.getpitch()/12, 0); + basePilotable.drive(0.4*basePilotable.getpitch()/12, 0); } else { From a1373e70bd25bf1852dc6be6168f499505dd3e3e Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 21 Mar 2023 19:23:32 -0400 Subject: [PATCH 27/32] dyt --- src/main/java/frc/robot/RobotContainer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 4d521cb..6382b79 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -141,7 +141,6 @@ public class RobotContainer { chooser.getSelected(); autobalance.getBoolean(true); return Commands.deadline( - Commands.waitSeconds(14), Commands.waitSeconds(14), new SequentialCommandGroup( Commands.select(Map.ofEntries( From 4447a2bb9fc067ef9e0fc5d5c59b3d655b50020b Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 21 Mar 2023 19:24:34 -0400 Subject: [PATCH 28/32] ghyjdwfcx --- src/main/java/frc/robot/RobotContainer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 6382b79..10c2a43 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -138,8 +138,7 @@ public class RobotContainer { } public Command getAutonomousCommand() { - chooser.getSelected(); - autobalance.getBoolean(true); + return Commands.deadline( Commands.waitSeconds(14), new SequentialCommandGroup( From 65e89a338bd601006ab71c410ab062e5eecae7e5 Mon Sep 17 00:00:00 2001 From: EdwardFaucher Date: Tue, 21 Mar 2023 19:49:40 -0400 Subject: [PATCH 29/32] hdgfhd --- src/main/java/frc/robot/RobotContainer.java | 7 ++++--- src/main/java/frc/robot/commands/Avancer.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 10c2a43..24fa703 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -61,9 +61,9 @@ public class RobotContainer { .withSize(2, 2).withProperties(Map.of("Label position", "LEFT")); GenericEntry autobalance = layoutauto.add("choix balance", true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); GenericEntry autosortir = layoutauto.add("choix sortir", false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); - GenericEntry reculerdistances = layoutauto.addPersistent("reculerdistancesortir", 0).getEntry(); - GenericEntry reculerdistanceb = layoutauto.addPersistent("reculerdistancebalance", 0).getEntry(); - GenericEntry avancerdistance = layoutauto.addPersistent("avancer", 0).getEntry(); + GenericEntry reculerdistances = layoutauto.addPersistent("reculerdistancesortir", -66).getEntry(); + GenericEntry reculerdistanceb = layoutauto.addPersistent("reculerdistancebalance", -31).getEntry(); + GenericEntry avancerdistance = layoutauto.addPersistent("avancer", 35).getEntry(); // subsystems BasePilotable basePilotable = new BasePilotable(); @@ -142,6 +142,7 @@ public class RobotContainer { return Commands.deadline( Commands.waitSeconds(14), new SequentialCommandGroup( + new BrakeFerme(basePilotable), Commands.select(Map.ofEntries( Map.entry(enhaut, creerCommandBras(51, -40)), Map.entry(aumilieux, creerCommandBras(45, -13)), diff --git a/src/main/java/frc/robot/commands/Avancer.java b/src/main/java/frc/robot/commands/Avancer.java index 68c0200..f7d37a1 100644 --- a/src/main/java/frc/robot/commands/Avancer.java +++ b/src/main/java/frc/robot/commands/Avancer.java @@ -30,7 +30,7 @@ public class Avancer extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - basePilotable.drive(0.3,0); + basePilotable.drive(0.4,0); } // Called once the command ends or is interrupted. From 3b22a181ccbb369e1f57774cf0c68a3425777a18 Mon Sep 17 00:00:00 2001 From: EdwardFaucher Date: Tue, 21 Mar 2023 19:54:58 -0400 Subject: [PATCH 30/32] c dfb --- src/main/java/frc/robot/commands/GratteBaisser.java | 2 +- src/main/java/frc/robot/subsystems/Limelight.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/commands/GratteBaisser.java b/src/main/java/frc/robot/commands/GratteBaisser.java index 5649059..b1fc1cd 100644 --- a/src/main/java/frc/robot/commands/GratteBaisser.java +++ b/src/main/java/frc/robot/commands/GratteBaisser.java @@ -3,7 +3,7 @@ // the WPILib BSD license file in the root directory of this project. package frc.robot.commands; -import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; + import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.Gratte; diff --git a/src/main/java/frc/robot/subsystems/Limelight.java b/src/main/java/frc/robot/subsystems/Limelight.java index 0417352..b869de3 100644 --- a/src/main/java/frc/robot/subsystems/Limelight.java +++ b/src/main/java/frc/robot/subsystems/Limelight.java @@ -4,7 +4,6 @@ package frc.robot.subsystems; -import edu.wpi.first.cameraserver.CameraServer; import org.photonvision.PhotonCamera; @@ -20,7 +19,7 @@ public class Limelight extends SubsystemBase { PhotonCamera limelight = new PhotonCamera("limelight"); /** Creates a new Limelight. */ public Limelight() { - CameraServer.startAutomaticCapture(); + PortForwarder.add(5800, "photonvision.local", 5800); } From 77a03a5b34f0d90f6adc5a34c5a59eabf648a31a Mon Sep 17 00:00:00 2001 From: EdwardFaucher Date: Wed, 22 Mar 2023 18:16:48 -0400 Subject: [PATCH 31/32] drxgfh --- src/main/java/frc/robot/RobotContainer.java | 12 +++++------- src/main/java/frc/robot/commands/Apriltag.java | 2 +- src/main/java/frc/robot/commands/Tape.java | 2 +- .../java/frc/robot/subsystems/BasePilotable.java | 4 ++++ src/main/java/frc/robot/subsystems/Limelight.java | 3 ++- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 24fa703..b6d248b 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -87,7 +87,7 @@ public class RobotContainer { Avancer avancer = new Avancer(basePilotable, () -> avancerdistance.getDouble(0)); Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY()); Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY()); - Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY()); + Tape tape = new Tape(limelight, basePilotable, () -> -manette1.getLeftY()); PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getRightY); BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getRightX); ActiverLimeLight activerLimeLight = new ActiverLimeLight(limelight); @@ -110,8 +110,8 @@ public class RobotContainer { private void configureBindings() { // manette 1 manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); - manette1.x().onTrue(brakeOuvre); - manette1.b().onTrue(brakeFerme); + manette1.b().whileTrue(gratteMonte); + manette1.x().whileTrue(gratteBaisser); manette1.leftBumper().whileTrue(aprilTag); manette1.rightBumper().whileTrue(tape); manette1.povUp().whileTrue(creerCommandBras(51, -37)); @@ -122,12 +122,10 @@ public class RobotContainer { //manette 2 manette2.povDown().whileTrue(creerCommandBras(5, -12)); manette2.povUp().whileTrue(creerCommandBras(44, 0)); - manette2.rightBumper().whileTrue(cube); - manette2.leftBumper().whileTrue(cone); manette2.y().whileTrue(gyro); manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro)); - manette2.a().whileTrue(gratteMonte); - manette2.b().whileTrue(gratteBaisser); + manette2.a().onTrue(brakeOuvre); + manette2.b().onTrue(brakeFerme); } private Command creerCommandBras(double distancePivot, double distanceBras) { diff --git a/src/main/java/frc/robot/commands/Apriltag.java b/src/main/java/frc/robot/commands/Apriltag.java index 9ef54b3..3e83057 100644 --- a/src/main/java/frc/robot/commands/Apriltag.java +++ b/src/main/java/frc/robot/commands/Apriltag.java @@ -32,7 +32,7 @@ public class Apriltag extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw()); + basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw(),false); } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/commands/Tape.java b/src/main/java/frc/robot/commands/Tape.java index e1346f0..02a9a81 100644 --- a/src/main/java/frc/robot/commands/Tape.java +++ b/src/main/java/frc/robot/commands/Tape.java @@ -32,7 +32,7 @@ public class Tape extends CommandBase { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw()); + basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw(),false); } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/subsystems/BasePilotable.java b/src/main/java/frc/robot/subsystems/BasePilotable.java index 8d0a0f1..a1e4c68 100644 --- a/src/main/java/frc/robot/subsystems/BasePilotable.java +++ b/src/main/java/frc/robot/subsystems/BasePilotable.java @@ -17,6 +17,7 @@ import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; +import frc.robot.commands.bras.Bougerbras; public class BasePilotable extends SubsystemBase { final CANSparkMax avantdroit = new CANSparkMax(Constants.avantdroit, MotorType.kBrushless); @@ -42,6 +43,9 @@ public class BasePilotable extends SubsystemBase { public void drive(double xSpeed, double zRotation){ drive.arcadeDrive(xSpeed, zRotation); } + public void drive(double xSpeed, double zRotation, boolean square){ + drive.arcadeDrive(xSpeed, zRotation, square); + } public double distance(){ return (-avantdroit.getEncoder().getPosition() +avantgauche.getEncoder().getPosition() diff --git a/src/main/java/frc/robot/subsystems/Limelight.java b/src/main/java/frc/robot/subsystems/Limelight.java index b869de3..eae8e0f 100644 --- a/src/main/java/frc/robot/subsystems/Limelight.java +++ b/src/main/java/frc/robot/subsystems/Limelight.java @@ -41,12 +41,13 @@ public class Limelight extends SubsystemBase { public void tape() { limelight.setLED(VisionLEDMode.kOn); limelight.setPipelineIndex(1); + } public double getYaw() { var result = limelight.getLatestResult(); if(result.hasTargets()){ - return -result.getBestTarget().getYaw()/30; + return -result.getBestTarget().getYaw()/45; } return 0; From 98061f51fd85edf6c5653491c99386bc46459ba5 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 11 Apr 2023 17:15:23 -0400 Subject: [PATCH 32/32] dgxhcgnvmnb, --- src/main/java/frc/robot/RobotContainer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 6ba36d8..9f8de52 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -110,8 +110,8 @@ public class RobotContainer { private void configureBindings() { // manette 1 manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); - manette1.x().onTrue(brakeOuvre); - manette1.b().onTrue(brakeFerme); + manette2.a().onTrue(brakeOuvre); + manette2.b().onTrue(brakeFerme); manette1.leftBumper().whileTrue(aprilTag); manette1.rightBumper().whileTrue(tape); manette1.povUp().whileTrue(creerCommandBras(51, -40)); @@ -126,8 +126,8 @@ public class RobotContainer { manette2.leftBumper().whileTrue(cone); manette2.y().whileTrue(gyro); manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro)); - manette2.a().whileTrue(gratteMonte); - manette2.b().whileTrue(gratteBaisser); + manette1.b().whileTrue(gratteMonte); + manette1.x().whileTrue(gratteBaisser); }