|
|
|
@ -12,6 +12,7 @@ import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
|
|
|
|
|
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.Command;
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.Commands;
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.RunCommand;
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
|
|
|
|
|
|
|
|
@ -22,7 +23,6 @@ import frc.robot.subsystems.bras.BrasTelescopique;
|
|
|
|
|
import frc.robot.subsystems.bras.Pince;
|
|
|
|
|
import frc.robot.subsystems.bras.Pivot;
|
|
|
|
|
import frc.robot.subsystems.Limelight;
|
|
|
|
|
import frc.robot.commands.Apriltag;
|
|
|
|
|
// command
|
|
|
|
|
import frc.robot.commands.BrakeFerme;
|
|
|
|
|
import frc.robot.commands.BrakeOuvre;
|
|
|
|
@ -30,25 +30,17 @@ import frc.robot.commands.Cone;
|
|
|
|
|
import frc.robot.commands.GratteBaisser;
|
|
|
|
|
import frc.robot.commands.GratteMonte;
|
|
|
|
|
import frc.robot.commands.Gyro;
|
|
|
|
|
import frc.robot.commands.Reculer;
|
|
|
|
|
import frc.robot.commands.bras.FermePince;
|
|
|
|
|
import frc.robot.commands.bras.OuvrePince;
|
|
|
|
|
import frc.robot.commands.bras.PivotBrasRentre;
|
|
|
|
|
import frc.robot.commands.bras.PivoteBrasBas;
|
|
|
|
|
import frc.robot.commands.bras.PivoteBrasHaut;
|
|
|
|
|
import frc.robot.commands.bras.PivoteBrasMilieux;
|
|
|
|
|
//subsystems
|
|
|
|
|
import frc.robot.commands.bras.PivotChercheBas;
|
|
|
|
|
import frc.robot.commands.bras.PivotChercheHaut;
|
|
|
|
|
import frc.robot.commands.Cube;
|
|
|
|
|
import frc.robot.commands.Tape;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class RobotContainer {
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
|
|
|
|
|
=======
|
|
|
|
|
//CameraServer.startAutomaticCapture();
|
|
|
|
|
>>>>>>> fc4607f3c6d7203a155182eded4626d37f75de5e
|
|
|
|
|
CommandXboxController manette1 = new CommandXboxController(0);
|
|
|
|
|
CommandXboxController manette2 = new CommandXboxController(1);
|
|
|
|
|
// subsystems
|
|
|
|
@ -57,7 +49,7 @@ Gratte gratte = new Gratte();
|
|
|
|
|
BrasTelescopique brasTelescopique = new BrasTelescopique();
|
|
|
|
|
Pince pince = new Pince();
|
|
|
|
|
Pivot pivot = new Pivot();
|
|
|
|
|
Limelight limelight = new Limelight();/** */
|
|
|
|
|
Limelight limelight = new Limelight();
|
|
|
|
|
//commands
|
|
|
|
|
BrakeFerme brakeFerme = new BrakeFerme(basePilotable);
|
|
|
|
|
BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable);
|
|
|
|
@ -81,12 +73,6 @@ String nulpart = "nul part";
|
|
|
|
|
ShuffleboardLayout layoutauto = Shuffleboard.getTab("teb").getLayout("auto");
|
|
|
|
|
GenericEntry autobalance = layoutauto.add("choix balance",true).getEntry();
|
|
|
|
|
GenericEntry autosortir = layoutauto.add("choix sorit",false).getEntry();
|
|
|
|
|
PivotChercheBas pivotChercheBas = new PivotChercheBas(brasTelescopique, pivot);
|
|
|
|
|
PivotChercheHaut pivotChercheHaut = new PivotChercheHaut(brasTelescopique, pivot);
|
|
|
|
|
Cube cube = new Cube(limelight, basePilotable, null);
|
|
|
|
|
Apriltag aprilTag = new Apriltag(limelight, basePilotable, null);
|
|
|
|
|
Tape tape = new Tape(limelight, basePilotable, null);
|
|
|
|
|
|
|
|
|
|
public RobotContainer() {
|
|
|
|
|
chooser.setDefaultOption(enhaut, enhaut);
|
|
|
|
|
chooser.addOption(enbas, enbas);
|
|
|
|
@ -96,25 +82,16 @@ public RobotContainer() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
configureBindings();
|
|
|
|
|
CameraServer.startAutomaticCapture();
|
|
|
|
|
|
|
|
|
|
basePilotable.setDefaultCommand(new RunCommand(() -> {
|
|
|
|
|
basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX(), 0);
|
|
|
|
|
basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX());
|
|
|
|
|
},basePilotable));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void configureBindings() {
|
|
|
|
|
basePilotable.setDefaultCommand(new RunCommand(() -> {
|
|
|
|
|
basePilotable.drive(-manette1.getLeftY(), -manette1.getLeftX(), 0);
|
|
|
|
|
},basePilotable));
|
|
|
|
|
// manette 1
|
|
|
|
|
manette1.povDown().onTrue(pivoteBrasHaut);
|
|
|
|
|
manette1.povUp().onTrue(pivoteBrasBas);
|
|
|
|
|
manette1.povLeft().onTrue(pivoteBrasMilieux);
|
|
|
|
|
manette1.povRight().onTrue(pivotBrasRentre);
|
|
|
|
|
manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince));
|
|
|
|
|
manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable));
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
manette1.y().whileTrue(gyro);
|
|
|
|
|
manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable));
|
|
|
|
|
/*manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
|
|
|
|
@ -145,27 +122,5 @@ public RobotContainer() {
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=======
|
|
|
|
|
manette1.b().onTrue(Commands.either(gratteBaisser, gratteMonte, gratte::getenHaut));
|
|
|
|
|
manette1.leftBumper().toggleOnTrue(cube);
|
|
|
|
|
manette1.rightBumper().toggleOnTrue(cone);
|
|
|
|
|
// manette 2
|
|
|
|
|
manette2.y().whileTrue(gyro);
|
|
|
|
|
manette2.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable));
|
|
|
|
|
manette2.povRight().onTrue(pivotChercheBas);
|
|
|
|
|
manette2.povLeft().onTrue(pivotChercheHaut);
|
|
|
|
|
manette2.rightBumper().toggleOnTrue(aprilTag);
|
|
|
|
|
manette2.leftBumper().toggleOnTrue(tape);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Command getAutonomousCommand() {
|
|
|
|
|
return null;
|
|
|
|
|
//return new SequentialCommandGroup(
|
|
|
|
|
//new PivoteBrasMilieux(brasTelescopique, pivot),
|
|
|
|
|
//new OuvrePince(pince),
|
|
|
|
|
//new PivotBrasRentre(brasTelescopique, pivot).alongWith(new Reculer(basePilotable)),
|
|
|
|
|
//new Gyro(basePilotable)
|
|
|
|
|
//);
|
|
|
|
|
>>>>>>> fc4607f3c6d7203a155182eded4626d37f75de5e
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|