From 59a7c30154c26e1efcd213391b182961d70f8e74 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Thu, 13 Apr 2023 18:25:05 -0400 Subject: [PATCH] fhcgjvhbm, --- src/main/java/frc/robot/RobotContainer.java | 8 ++------ .../java/frc/robot/commands/bras/Bougerbras.java | 13 ++++--------- .../java/frc/robot/commands/bras/Bougerpivot.java | 12 +++--------- .../frc/robot/commands/bras/DescendrePivotBras.java | 8 +++----- .../frc/robot/commands/bras/MonterPivotBras.java | 10 +++++----- 5 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index f39e5a9..62f6cad 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -61,10 +61,6 @@ public class RobotContainer { String aumilieux = "au milieux"; String enbas = "en bas"; String nulpart = "nul part"; - GenericEntry forcebrasmonter = Shuffleboard.getTab("teb").addPersistent("force bras monter", 0.35).getEntry(); - GenericEntry forcebrasdescendre = Shuffleboard.getTab("teb").addPersistent("force bras descendre", -0.35).getEntry(); - GenericEntry forcepivotmonter = Shuffleboard.getTab("teb").addPersistent("force pivot monter", 0.5).getEntry(); - GenericEntry forcepivotdescendre = Shuffleboard.getTab("teb").addPersistent("force pivot descendre", -0.5).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(); @@ -144,8 +140,8 @@ public class RobotContainer { private Command creerCommandBras(double distancePivot, double distanceBras) { return Commands.either( - new MonterPivotBras(brasTelescopique, pivot, distanceBras, distancePivot,forcebrasmonter,forcebrasdescendre,forcepivotmonter,forcepivotdescendre), - new DescendrePivotBras(brasTelescopique, pivot, distanceBras, distancePivot,forcebrasmonter,forcebrasdescendre,forcepivotmonter,forcepivotdescendre), + new MonterPivotBras(brasTelescopique, pivot, distanceBras, distancePivot), + new DescendrePivotBras(brasTelescopique, pivot, distanceBras, distancePivot), () -> pivot.distance() < distancePivot); } diff --git a/src/main/java/frc/robot/commands/bras/Bougerbras.java b/src/main/java/frc/robot/commands/bras/Bougerbras.java index 8a97404..8c658e0 100644 --- a/src/main/java/frc/robot/commands/bras/Bougerbras.java +++ b/src/main/java/frc/robot/commands/bras/Bougerbras.java @@ -4,8 +4,6 @@ package frc.robot.commands.bras; -import edu.wpi.first.networktables.GenericEntry; -import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.bras.BrasTelescopique; @@ -13,14 +11,11 @@ public class Bougerbras extends CommandBase { /** Creates a new bougerbras. */ double distance; BrasTelescopique brasTelescopique; - private GenericEntry forcebrasdescendre; - private GenericEntry forcebrasmonter; - public Bougerbras(BrasTelescopique brasTelescopique,double distance,GenericEntry forcebrasdescendre, GenericEntry forcebrasmonter) { + public Bougerbras(BrasTelescopique brasTelescopique,double distance) { this.brasTelescopique = brasTelescopique; this.distance = distance; - this.forcebrasdescendre = forcebrasdescendre; - this.forcebrasmonter = forcebrasmonter; + addRequirements(brasTelescopique); // Use addRequirements() here to declare subsystem dependencies. } @@ -35,11 +30,11 @@ public class Bougerbras extends CommandBase { @Override public void execute() { if(brasTelescopique.distance()>distance+0.5 ) { - brasTelescopique.AvanceRecule(forcebrasdescendre.getDouble(-0.35)); + brasTelescopique.AvanceRecule(0.35); } else if(brasTelescopique.distance()distance+0.5 ) { - pivot.monteDescendre(forcepivotdescendre.getDouble(-0.5)); + pivot.monteDescendre(0.5); } else if(pivot.distance()pivot.distance()>10), - new ParallelCommandGroup(new Bougerpivot(pivot, distancePivot,forcepivotdescendre,forcepivotmonter)), - new ParallelCommandGroup(new Bougerbras(brasTelescopique, distanceBras,forcebrasdescendre,forcebrasmonter)) + new Bougerpivot(pivot, 10).unless(()->pivot.distance()>10), + new ParallelCommandGroup(new Bougerpivot(pivot, distancePivot)), + new ParallelCommandGroup(new Bougerbras(brasTelescopique, distanceBras)) );