diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index b6d248b..c4aff39 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -6,6 +6,7 @@ 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; @@ -64,7 +65,6 @@ public class RobotContainer { 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(); Gratte gratte = new Gratte(); @@ -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,22 +110,25 @@ public class RobotContainer { private void configureBindings() { // manette 1 manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); - manette1.b().whileTrue(gratteMonte); - manette1.x().whileTrue(gratteBaisser); + manette2.a().onTrue(brakeOuvre); + manette2.b().onTrue(brakeFerme); manette1.leftBumper().whileTrue(aprilTag); manette1.rightBumper().whileTrue(tape); - manette1.povUp().whileTrue(creerCommandBras(51, -37)); - manette1.povDown().whileTrue(creerCommandBras(12, -9)); - manette1.povRight().whileTrue(creerCommandBras(45, -13)); + manette1.povUp().whileTrue(creerCommandBras(51, -40)); + 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(5, -12)); + manette2.povDown().whileTrue(creerCommandBras(9, -18)); 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().onTrue(brakeOuvre); - manette2.b().onTrue(brakeFerme); + manette1.b().whileTrue(gratteMonte); + manette1.x().whileTrue(gratteBaisser); + } private Command creerCommandBras(double distancePivot, double distanceBras) { @@ -136,15 +139,15 @@ public class RobotContainer { } public Command getAutonomousCommand() { - + chooser.getSelected(); + autobalance.getBoolean(true); return Commands.deadline( - Commands.waitSeconds(14), + Commands.waitSeconds(14.6), new SequentialCommandGroup( - new BrakeFerme(basePilotable), Commands.select(Map.ofEntries( Map.entry(enhaut, creerCommandBras(51, -40)), - Map.entry(aumilieux, creerCommandBras(45, -13)), - Map.entry(enbas, creerCommandBras(12, -9)), + 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), @@ -153,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(new Gyro(basePilotable), Commands.none(), () -> autobalance.getBoolean(true)))) - .andThen(new BrakeOuvre(basePilotable)); + Commands.either(gyro, Commands.none(), () -> autobalance.getBoolean(true)))) + .andThen(brakeOuvre); } } diff --git a/src/main/java/frc/robot/commands/GratteMonte.java b/src/main/java/frc/robot/commands/GratteMonte.java index 5dce6f8..d72480b 100644 --- a/src/main/java/frc/robot/commands/GratteMonte.java +++ b/src/main/java/frc/robot/commands/GratteMonte.java @@ -5,6 +5,7 @@ package frc.robot.commands; + import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.Gratte; diff --git a/src/main/java/frc/robot/commands/Gyro.java b/src/main/java/frc/robot/commands/Gyro.java index e6b1598..7874235 100644 --- a/src/main/java/frc/robot/commands/Gyro.java +++ b/src/main/java/frc/robot/commands/Gyro.java @@ -4,6 +4,7 @@ package frc.robot.commands; + import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.BasePilotable; diff --git a/src/main/java/frc/robot/commands/bras/Bougerbras.java b/src/main/java/frc/robot/commands/bras/Bougerbras.java index 6390c94..d807832 100644 --- a/src/main/java/frc/robot/commands/bras/Bougerbras.java +++ b/src/main/java/frc/robot/commands/bras/Bougerbras.java @@ -28,11 +28,11 @@ public class Bougerbras extends CommandBase { @Override public void execute() { if(brasTelescopique.distance()>distance+0.5 ) { - brasTelescopique.AvanceRecule(-0.3); + brasTelescopique.AvanceRecule(-0.35); } else if(brasTelescopique.distance()