This commit is contained in:
samuel desharnais 2023-03-08 19:50:19 -05:00
parent f6c56fae35
commit 46c3dcbad5
5 changed files with 11 additions and 67 deletions

View File

@ -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
}
}

View File

@ -80,4 +80,6 @@ public void BrakeFerme(){
public void periodic() {
}
public void drive(double d, double leftX) {
}
}

View File

@ -13,11 +13,7 @@ import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import frc.robot.Constants;
public class Gratte extends SubsystemBase {
<<<<<<< HEAD
ShuffleboardTab teb = Shuffleboard.getTab("teb");
=======
ShuffleboardTab teb = Shuffleboard.getTab("teb");
>>>>>>> fc4607f3c6d7203a155182eded4626d37f75de5e
ShuffleboardLayout limitswitchgratte = Shuffleboard.getTab("teb")
.getLayout("limitswitchsgratte", BuiltInLayouts.kList)
.withSize(2, 2);

View File

@ -12,14 +12,14 @@ import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
public class BrasTelescopique extends SubsystemBase {
<<<<<<< HEAD
ShuffleboardTab teb = Shuffleboard.getTab("teb");
ShuffleboardLayout layout = Shuffleboard.getTab("teb")
.getLayout("layout", BuiltInLayouts.kList)
.withSize(2, 2);
@ -27,9 +27,7 @@ public class BrasTelescopique extends SubsystemBase {
ShuffleboardLayout bras = Shuffleboard.getTab("teb")
.getLayout("bras", BuiltInLayouts.kList)
.withSize(2, 2);
=======
ShuffleboardTab teb = Shuffleboard.getTab("teb");
>>>>>>> fc4607f3c6d7203a155182eded4626d37f75de5e
/** Creates a new BrasTelescopique. */
public BrasTelescopique() {
teb .add("photocell",0.1);

View File

@ -14,12 +14,8 @@ import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
public class Pivot extends SubsystemBase {
<<<<<<< HEAD
ShuffleboardTab teb = Shuffleboard.getTab("teb");
=======
ShuffleboardTab teb = Shuffleboard.getTab("teb");
>>>>>>> fc4607f3c6d7203a155182eded4626d37f75de5e
// moteur
private CANSparkMax pivot = new CANSparkMax(Constants.pivot,MotorType.kBrushless);
private DigitalInput limitpivot = new DigitalInput(Constants.limitpivot);
@ -46,7 +42,6 @@ public class Pivot extends SubsystemBase {
@Override
public void periodic() {
}
<<<<<<< HEAD
@ -55,7 +50,5 @@ public class Pivot extends SubsystemBase {
teb.add ("encodeur pivot",0.1);
}
}
=======
}
>>>>>>> fc4607f3c6d7203a155182eded4626d37f75de5e