|
|
@ -6,18 +6,9 @@ package frc.robot;
|
|
|
|
|
|
|
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.Command;
|
|
|
|
import edu.wpi.first.wpilibj2.command.Command;
|
|
|
|
import edu.wpi.first.wpilibj2.command.Commands;
|
|
|
|
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.RunCommand;
|
|
|
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
|
|
|
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
|
|
|
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
|
|
|
|
|
|
|
|
|
|
|
//subsystems
|
|
|
|
|
|
|
|
import frc.robot.subsystems.BasePilotable;
|
|
|
|
|
|
|
|
import frc.robot.subsystems.Gratte;
|
|
|
|
|
|
|
|
import frc.robot.subsystems.bras.BrasTelescopique;
|
|
|
|
|
|
|
|
import frc.robot.subsystems.bras.Pince;
|
|
|
|
|
|
|
|
import frc.robot.subsystems.bras.Pivot;
|
|
|
|
|
|
|
|
import pabeles.concurrency.ConcurrencyOps.Reset;
|
|
|
|
|
|
|
|
import frc.robot.subsystems.Limelight;
|
|
|
|
|
|
|
|
// command
|
|
|
|
// command
|
|
|
|
import frc.robot.commands.BrakeFerme;
|
|
|
|
import frc.robot.commands.BrakeFerme;
|
|
|
|
import frc.robot.commands.BrakeOuvre;
|
|
|
|
import frc.robot.commands.BrakeOuvre;
|
|
|
@ -32,71 +23,63 @@ import frc.robot.commands.bras.PivotBrasRentre;
|
|
|
|
import frc.robot.commands.bras.PivoteBrasBas;
|
|
|
|
import frc.robot.commands.bras.PivoteBrasBas;
|
|
|
|
import frc.robot.commands.bras.PivoteBrasHaut;
|
|
|
|
import frc.robot.commands.bras.PivoteBrasHaut;
|
|
|
|
import frc.robot.commands.bras.PivoteBrasMilieux;
|
|
|
|
import frc.robot.commands.bras.PivoteBrasMilieux;
|
|
|
|
import frc.robot.commands.bras.PivotChercheBas;
|
|
|
|
//subsystems
|
|
|
|
import frc.robot.commands.bras.PivotChercheHaut;
|
|
|
|
import frc.robot.subsystems.BasePilotable;
|
|
|
|
import edu.wpi.first.apriltag.AprilTag;
|
|
|
|
|
|
|
|
import frc.robot.commands.Cube;
|
|
|
|
|
|
|
|
import frc.robot.commands.Cone;
|
|
|
|
|
|
|
|
import frc.robot.commands.Tape;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class RobotContainer {
|
|
|
|
public class RobotContainer {
|
|
|
|
CommandXboxController manette1 = new CommandXboxController(0);
|
|
|
|
CommandXboxController manette1 = new CommandXboxController(0);
|
|
|
|
CommandXboxController manette2 = new CommandXboxController(1);
|
|
|
|
CommandXboxController manette2 = new CommandXboxController(1);
|
|
|
|
// subsystems
|
|
|
|
// subsystems
|
|
|
|
BasePilotable basePilotable = new BasePilotable();
|
|
|
|
BasePilotable basePilotable = new BasePilotable();
|
|
|
|
Gratte gratte = new Gratte();
|
|
|
|
/*Gratte gratte = new Gratte();
|
|
|
|
BrasTelescopique brasTelescopique = new BrasTelescopique();
|
|
|
|
BrasTelescopique brasTelescopique = new BrasTelescopique();
|
|
|
|
Pince pince = new Pince();
|
|
|
|
Pince pince = new Pince();
|
|
|
|
Pivot pivot = new Pivot();
|
|
|
|
Pivot pivot = new Pivot();
|
|
|
|
Limelight limelight = new Limelight();
|
|
|
|
Limelight limelight = new Limelight();/** */
|
|
|
|
//commands
|
|
|
|
//commands
|
|
|
|
BrakeFerme brakeFerme = new BrakeFerme(basePilotable);
|
|
|
|
//BrakeFerme brakeFerme = new BrakeFerme(basePilotable);
|
|
|
|
BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable);
|
|
|
|
//BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable);
|
|
|
|
GratteBaisser gratteBaisser = new GratteBaisser(gratte);
|
|
|
|
//GratteBaisser gratteBaisser = new GratteBaisser(gratte);
|
|
|
|
GratteMonte gratteMonte = new GratteMonte(gratte);
|
|
|
|
//GratteMonte gratteMonte = new GratteMonte(gratte);
|
|
|
|
Gyro gyro = new Gyro(basePilotable);
|
|
|
|
Gyro gyro = new Gyro(basePilotable);
|
|
|
|
FermePince fermePince = new FermePince(pince);
|
|
|
|
/*FermePince fermePince = new FermePince(pince);
|
|
|
|
OuvrePince ouvrePince = new OuvrePince(pince);
|
|
|
|
OuvrePince ouvrePince = new OuvrePince(pince);
|
|
|
|
PivotBrasRentre pivotBrasRentre = new PivotBrasRentre(brasTelescopique, pivot);
|
|
|
|
PivotBrasRentre pivotBrasRentre = new PivotBrasRentre(brasTelescopique, pivot);
|
|
|
|
PivoteBrasBas pivoteBrasBas = new PivoteBrasBas(brasTelescopique, pivot);
|
|
|
|
PivoteBrasBas pivoteBrasBas = new PivoteBrasBas(brasTelescopique, pivot);
|
|
|
|
PivoteBrasMilieux pivoteBrasMilieux = new PivoteBrasMilieux(brasTelescopique, pivot);
|
|
|
|
PivoteBrasMilieux pivoteBrasMilieux = new PivoteBrasMilieux(brasTelescopique, pivot);
|
|
|
|
PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot);
|
|
|
|
PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot);
|
|
|
|
Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY());
|
|
|
|
Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY());**/
|
|
|
|
public RobotContainer() {
|
|
|
|
public RobotContainer() {
|
|
|
|
configureBindings();
|
|
|
|
configureBindings();
|
|
|
|
|
|
|
|
}
|
|
|
|
basePilotable.setDefaultCommand(new RunCommand(() -> {
|
|
|
|
|
|
|
|
basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX());
|
|
|
|
|
|
|
|
},basePilotable));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void configureBindings() {
|
|
|
|
private void configureBindings() {
|
|
|
|
manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince));
|
|
|
|
basePilotable.setDefaultCommand(new RunCommand(() -> {
|
|
|
|
|
|
|
|
basePilotable.drive(-manette1.getLeftY(), -manette1.getLeftX());
|
|
|
|
|
|
|
|
},basePilotable));
|
|
|
|
|
|
|
|
//manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince));
|
|
|
|
manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable));
|
|
|
|
manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable));
|
|
|
|
manette1.y().whileTrue(gyro);
|
|
|
|
manette1.y().whileTrue(gyro);
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
|
|
|
// manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
|
|
|
|
// manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
|
|
|
|
=======
|
|
|
|
|
|
|
|
>>>>>>> 4b22cac30fd2b3c5e7b1af3c7f890c4def2d21f7
|
|
|
|
|
|
|
|
manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable));
|
|
|
|
manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable));
|
|
|
|
manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
|
|
|
|
/** manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
|
|
|
|
manette2.a().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasHaut, brasTelescopique::pivoteBrasHaut));
|
|
|
|
manette2.a().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasHaut, brasTelescopique::pivoteBrasHaut));
|
|
|
|
manette2.b().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasBas, brasTelescopique::pivoteBrasBas, brasTelescopique));
|
|
|
|
manette2.b().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasBas, brasTelescopique::pivoteBrasBas, brasTelescopique));
|
|
|
|
manette2.x().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasMilieux, brasTelescopique::pivoteBrasMilieux, brasTelescopique));
|
|
|
|
manette2.x().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasMilieux, brasTelescopique::pivoteBrasMilieux, brasTelescopique));
|
|
|
|
manette2.y().toggleOnTrue(Commands.startEnd(brasTelescopique::pivotBrasRentre, brasTelescopique::pivotBrasRentre, brasTelescopique));
|
|
|
|
manette2.y().toggleOnTrue(Commands.startEnd(brasTelescopique::pivotBrasRentre, brasTelescopique::pivotBrasRentre, brasTelescopique));
|
|
|
|
manette2.povRight().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheBas, brasTelescopique::PivotChercheBas, brasTelescopique));
|
|
|
|
manette2.povRight().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheBas, brasTelescopique::PivotChercheBas, brasTelescopique));
|
|
|
|
manette2.povLeft().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheHaut, brasTelescopique::PivotChercheHaut, brasTelescopique));
|
|
|
|
manette2.povLeft().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheHaut, brasTelescopique::PivotChercheHaut, brasTelescopique));*/
|
|
|
|
manette2.rightBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
|
|
|
// manette2.rightBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
|
|
|
manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
|
|
|
// manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Command getAutonomousCommand() {
|
|
|
|
public Command getAutonomousCommand() {
|
|
|
|
return new SequentialCommandGroup(
|
|
|
|
return null;
|
|
|
|
new PivoteBrasMilieux(brasTelescopique, pivot),
|
|
|
|
//return new SequentialCommandGroup(
|
|
|
|
new OuvrePince(pince),
|
|
|
|
//new PivoteBrasMilieux(brasTelescopique, pivot),
|
|
|
|
new PivotBrasRentre(brasTelescopique, pivot).alongWith(new Reculer(basePilotable)),
|
|
|
|
//new OuvrePince(pince),
|
|
|
|
new Gyro(basePilotable)
|
|
|
|
//new PivotBrasRentre(brasTelescopique, pivot).alongWith(new Reculer(basePilotable)),
|
|
|
|
);
|
|
|
|
//new Gyro(basePilotable)
|
|
|
|
|
|
|
|
//);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|