mode auto

This commit is contained in:
Antoine PerreaultE 2025-03-04 12:52:13 -05:00
parent 5009a1c928
commit 28d5118c1f

View File

@ -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));