diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 62f6cad..ee10622 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -6,7 +6,6 @@ package frc.robot; import java.util.Map; - import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts; @@ -50,6 +49,7 @@ 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); @@ -71,7 +71,7 @@ public class RobotContainer { GenericEntry avancerforce = layoutauto.addPersistent("avancer force", 0.4).getEntry(); GenericEntry reculerforce = layoutauto.addPersistent("reculer force", -0.45).getEntry(); GenericEntry gyroforce = layoutauto.addPersistent("gyro force", 0.3).getEntry(); - + // subsystems BasePilotable basePilotable = new BasePilotable(); Gratte gratte = new Gratte(); @@ -85,13 +85,13 @@ public class RobotContainer { BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable); GratteBaisser gratteBaisser = new GratteBaisser(gratte); GratteMonte gratteMonte = new GratteMonte(gratte); - Gyro gyro = new Gyro(basePilotable,()->gyroforce.getDouble(0)); + Gyro gyro = new Gyro(basePilotable, () -> gyroforce.getDouble(0)); 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),()->reculerforce.getDouble(0)); - Reculer reculerb = new Reculer(basePilotable, () -> reculerdistanceb.getDouble(0),()->reculerforce.getDouble(0)); - Avancer avancer = new Avancer(basePilotable, () -> avancerdistance.getDouble(0),()-> avancerforce.getDouble(0)); + Reculer reculers = new Reculer(basePilotable, () -> reculerdistances.getDouble(0), () -> reculerforce.getDouble(0)); + Reculer reculerb = new Reculer(basePilotable, () -> reculerdistanceb.getDouble(0), () -> reculerforce.getDouble(0)); + Avancer avancer = new Avancer(basePilotable, () -> avancerdistance.getDouble(0), () -> avancerforce.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()); @@ -116,7 +116,7 @@ public class RobotContainer { private void configureBindings() { // manette 1 - manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); + manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer, pince)); manette2.a().onTrue(brakeOuvre); manette2.b().onTrue(brakeFerme); manette1.leftBumper().whileTrue(aprilTag); @@ -126,7 +126,7 @@ public class RobotContainer { manette1.povRight().whileTrue(creerCommandBras(44, -17)); manette1.povLeft().whileTrue(creerCommandBras(0, 0)); manette1.y().whileTrue(activerLimeLight); - //manette 2 + // manette 2 manette2.povDown().whileTrue(creerCommandBras(9, -18)); manette2.povUp().whileTrue(creerCommandBras(44, 0)); manette2.rightBumper().whileTrue(cube); @@ -156,14 +156,17 @@ public class RobotContainer { Map.entry(aumilieux, creerCommandBras(45, -13)), Map.entry(enbas, creerCommandBras(12, -9)), Map.entry(nulpart, creerCommandBras(0, 0))), chooser::getSelected), - //creerCommandBras(50, -40).unless(() -> !chooser.getSelected().equals(enhaut)), - //creerCommandBras(51, -40).unless(() -> !chooser.getSelected().equals(enhaut)), + // creerCommandBras(50, -40).unless(() -> + // !chooser.getSelected().equals(enhaut)), + // creerCommandBras(51, -40).unless(() -> + // !chooser.getSelected().equals(enhaut)), new OuvrePince(pince).unless(() -> chooser.getSelected().equals(nulpart)), Commands.waitSeconds(1), - new FermePince(pince).unless(() -> chooser.getSelected().equals(nulpart)), - new ParallelCommandGroup (creerCommandBras(0, 0).unless(() -> chooser.getSelected().equals(nulpart)), - Commands.either(reculers, reculerb, () -> autosortir.getBoolean(true))), - new Avancer(basePilotable, () -> avancerdistance.getDouble(0),()->avancerforce.getDouble(0)).unless(() -> !autosortir.getBoolean(true) || !autobalance.getBoolean(false)), + new FermePince(pince).unless(() -> chooser.getSelected().equals(nulpart)), + new ParallelCommandGroup(creerCommandBras(0, 0).unless(() -> chooser.getSelected().equals(nulpart)), + Commands.either(reculers, reculerb, () -> autosortir.getBoolean(true))), + new Avancer(basePilotable, () -> avancerdistance.getDouble(0), () -> avancerforce.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/Bougerbras.java b/src/main/java/frc/robot/commands/bras/Bougerbras.java index 8c658e0..20c3a99 100644 --- a/src/main/java/frc/robot/commands/bras/Bougerbras.java +++ b/src/main/java/frc/robot/commands/bras/Bougerbras.java @@ -30,11 +30,11 @@ public class Bougerbras extends CommandBase { @Override public void execute() { if(brasTelescopique.distance()>distance+0.5 ) { - brasTelescopique.AvanceRecule(0.35); + brasTelescopique.AvanceRecule(-0.35); } else if(brasTelescopique.distance()distance+0.5 ) { - pivot.monteDescendre(0.5); + pivot.monteDescendre(-0.5); } else if(pivot.distance()