Merge branch 'main' of https://demerso.net/pls5618/2023/robot
This commit is contained in:
commit
7a13a0f703
@ -65,9 +65,9 @@ ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto",Buil
|
||||
.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",-66).getEntry();
|
||||
GenericEntry reculerdistanceb = layoutauto.addPersistent("reculerdistancebalance", -31).getEntry();
|
||||
GenericEntry avancerdistance = layoutauto.addPersistent("avancer",-35).getEntry();
|
||||
GenericEntry reculerdistances = layoutauto.addPersistent("reculerdistancesortir",0).getEntry();
|
||||
GenericEntry reculerdistanceb = layoutauto.addPersistent("reculerdistancebalance", 0).getEntry();
|
||||
GenericEntry avancerdistance = layoutauto.addPersistent("avancer",0).getEntry();
|
||||
// subsystems
|
||||
BasePilotable basePilotable = new BasePilotable();
|
||||
Gratte gratte = new Gratte();
|
||||
@ -93,15 +93,24 @@ Reculer reculerb = new Reculer(basePilotable, ()->reculerdistanceb.getDouble(0))
|
||||
Avancer avancer = new Avancer(basePilotable, ()->avancerdistance.getDouble(0));
|
||||
PivotChercheBas pivotChercheBas = new PivotChercheBas(brasTelescopique, pivot);
|
||||
PivotChercheHaut pivotChercheHaut = new PivotChercheHaut(brasTelescopique, pivot);
|
||||
Cube cube = new Cube(limelight, basePilotable, ()-> manette1.getLeftY());
|
||||
Apriltag aprilTag = new Apriltag(limelight, basePilotable,()-> manette1.getLeftY());
|
||||
Tape tape = new Tape(limelight, basePilotable, ()-> manette1.getLeftY());
|
||||
Cube cube = new Cube(limelight, basePilotable, null);
|
||||
Apriltag aprilTag = new Apriltag(limelight, basePilotable, null);
|
||||
Tape tape = new Tape(limelight, basePilotable, null);
|
||||
PivotManuel pivotManuel = new PivotManuel(pivot,manette2::getLeftX);
|
||||
BrasManuel brasManuel = new BrasManuel(brasTelescopique,manette2::getLeftY);
|
||||
|
||||
|
||||
SendableChooser<String> chooser = new SendableChooser<>();
|
||||
String enhaut = "en bas";
|
||||
String aumilieux = "au milieux";
|
||||
String enbas = "en bas";
|
||||
String nulpart = "nul part";
|
||||
ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto",BuiltInLayouts.kList)
|
||||
.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 sorit",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||
public RobotContainer() {
|
||||
chooser.setDefaultOption(enhaut, enhaut);
|
||||
chooser.addOption(enhaut, enhaut);
|
||||
chooser.addOption(enbas, enbas);
|
||||
chooser.addOption(aumilieux, aumilieux);
|
||||
chooser.addOption(nulpart, nulpart);
|
||||
@ -117,10 +126,9 @@ public 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.leftBumper().whileTrue(aprilTag);
|
||||
manette1.rightBumper().whileTrue(tape);
|
||||
manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable));
|
||||
manette1.leftBumper().toggleOnTrue(aprilTag);
|
||||
manette1.rightBumper().toggleOnTrue(tape);
|
||||
manette1.povUp().whileTrue(pivoteBrasHaut);
|
||||
manette1.povDown().whileTrue(pivoteBrasBas);
|
||||
manette1.povRight().whileTrue(pivoteBrasMilieux);
|
||||
@ -128,18 +136,19 @@ public RobotContainer() {
|
||||
//manette 2
|
||||
manette2.povDown().onTrue(pivotChercheBas);
|
||||
manette2.povUp().onTrue(pivotChercheHaut);
|
||||
manette2.rightBumper().whileTrue(cube);
|
||||
manette2.leftBumper().whileTrue(cone);
|
||||
manette2.rightBumper().toggleOnTrue(cube);
|
||||
manette2.leftBumper().toggleOnTrue(cone);
|
||||
manette2.y().whileTrue(gyro);
|
||||
manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro));
|
||||
manette2.a().whileTrue(gratteMonte);
|
||||
manette2.b().whileTrue(gratteBaisser);
|
||||
manette2.back().onTrue(new InstantCommand(basePilotable::Reset));
|
||||
|
||||
}
|
||||
|
||||
public Command getAutonomousCommand() {
|
||||
return Commands.waitSeconds(14).deadlineWith( new SequentialCommandGroup(
|
||||
chooser.getSelected();
|
||||
autobalance.getBoolean(true);
|
||||
return new SequentialCommandGroup(
|
||||
Commands.select(Map.ofEntries(
|
||||
Map.entry(enhaut,pivoteBrasHaut),
|
||||
Map.entry(aumilieux,pivoteBrasMilieux),
|
||||
@ -154,7 +163,7 @@ public RobotContainer() {
|
||||
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(new InstantCommand(basePilotable::BrakeOuvre,basePilotable));
|
||||
).deadlineWith(Commands.waitSeconds(14.6)).andThen(brakeOuvre);
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user