From 28d5118c1f6c9cdffbb3190bdb72043fa272bc53 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Tue, 4 Mar 2025 12:52:13 -0500 Subject: [PATCH] mode auto --- src/main/java/frc/robot/RobotContainer.java | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 8007c00..4945b80 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -61,6 +61,9 @@ public class RobotContainer { ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto", BuiltInLayouts.kList) .withSize(2, 2).withProperties(Map.of("Label position", "LEFT")); GenericEntry L1 = layoutauto.add("choix L1",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); + GenericEntry sortirAngle = layoutauto.add("Cote?",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); + GenericEntry Reculer = layoutauto.add("Reculer",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); + GenericEntry L4 = layoutauto.add("L4",true).withWidget(BuiltInWidgets.kToggleSwitch).getEntry(); private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity @@ -157,11 +160,29 @@ public class RobotContainer { drivetrain.applyRequest(()-> drive.withVelocityX(-0.5*MaxSpeed) .withVelocityY(0) - .withRotationalRate(0)).withTimeout(2), + .withRotationalRate(0)).unless(()->!Reculer.getBoolean(true)).withTimeout(2), + drivetrain.applyRequest(()-> + drive.withVelocityX(0.5*MaxSpeed) + .withVelocityY(0) + .withRotationalRate(0)).unless(()->!L4.getBoolean(true)).withTimeout(2), + drivetrain.applyRequest(()-> + drive.withVelocityX(-0.5*MaxSpeed) + .withVelocityY(0) + .withRotationalRate(0)).unless(()->!sortirAngle.getBoolean(true)).withTimeout(2), drivetrain.applyRequest(()-> drive.withVelocityX(0) .withVelocityY(0) .withRotationalRate(0)).withTimeout(0.1), + new L4(elevateur, pince).unless(()->!L4.getBoolean(true)).withTimeout(4), + drivetrain.applyRequest(()-> + drive.withVelocityX(0.2*MaxSpeed) + .withVelocityY(0) + .withRotationalRate(0)).unless(()->!L4.getBoolean(true)).withTimeout(0.5), + drivetrain.applyRequest(()-> + drive.withVelocityX(0*MaxSpeed) + .withVelocityY(0) + .withRotationalRate(0)).unless(()->!L4.getBoolean(true)).withTimeout(2), + new CoralExpire(pince, bougie).unless(()->!L4.getBoolean(true)).withTimeout(2), new L1Requin(requin, bougie).unless(()-> !L1.getBoolean(true)).withTimeout(2), new ExpireCorail(requin, bougie).unless(()->!L1.getBoolean(true)).withTimeout(2), new RainBow(bougie));