From 74a26d445462a27537933e724c6a7b0ad41506a4 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 21 Mar 2023 18:06:31 -0400 Subject: [PATCH 01/10] 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 02/10] 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 03/10] 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 04/10] 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 05/10] 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 06/10] 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 07/10] 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 08/10] 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 09/10] 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 10/10] 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;