diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index d5669cd..c9ad0f0 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -21,7 +21,6 @@ import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine; // Commands -import frc.robot.command.AllumeLED; import frc.robot.command.Balayer; import frc.robot.command.GrimpeurDroit; import frc.robot.command.GrimpeurGauche; @@ -33,7 +32,6 @@ import frc.robot.command.LancerNote; import frc.robot.command.Lancerampli; import frc.robot.command.Limelight_tracker; import frc.robot.command.PistonFerme; -import frc.robot.command.Pistongrimpeur; import frc.robot.command.PistonOuvre; // Subsystems import frc.robot.subsystem.Accumulateur; @@ -41,7 +39,6 @@ import frc.robot.subsystem.Balayeuse; import frc.robot.subsystem.Drive; import frc.robot.subsystem.Grimpeur; import frc.robot.subsystem.Guideur; -import frc.robot.subsystem.LED; import frc.robot.subsystem.Lanceur; import frc.robot.subsystem.Limelight; @@ -56,7 +53,6 @@ public class RobotContainer { Guideur guideur = new Guideur(); Lanceur lanceur = new Lanceur(); Limelight limelight = new Limelight(); - LED LED = new LED(); CommandJoystick joystick = new CommandJoystick(0); CommandXboxController manette = new CommandXboxController(1); /*private final Relay blue = new Relay(0); @@ -71,8 +67,6 @@ public class RobotContainer { Lancerampli lancerampli = new Lancerampli(lanceur,limelight); GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftY); GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getRightY); - AllumeLED allumeLED = new AllumeLED(LED, accumulateur); - Pistongrimpeur pistongrimpeur = new Pistongrimpeur(grimpeur, LED); public RobotContainer() { dashboard.addCamera("limelight", "limelight","limelight.local:5800") @@ -83,6 +77,8 @@ public class RobotContainer { .withSize(4, 4) .withPosition(3, 0); + CameraServer.startAutomaticCapture(); + NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur)); NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur)); NamedCommands.registerCommand("piston", new PistonFerme(grimpeur)); @@ -109,8 +105,10 @@ public class RobotContainer { grimpeur.droit(MathUtil.applyDeadband(-manette.getLeftY(), 0.2)); grimpeur.gauche(MathUtil.applyDeadband(-manette.getRightY(),0.2 ));} ,grimpeur)); - - LED.setDefaultCommand(allumeLED); + + dashboard.add("autochooser",autoChooser) + .withSize(2,1) + .withPosition(1,1); } private void configureBindings() {} diff --git a/src/main/java/frc/robot/command/AllumeLED.java b/src/main/java/frc/robot/command/AllumeLED.java deleted file mode 100644 index f070ff3..0000000 --- a/src/main/java/frc/robot/command/AllumeLED.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package frc.robot.command; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystem.Accumulateur; -import frc.robot.subsystem.LED; - -public class AllumeLED extends Command { - private LED led; - private Accumulateur accumulateur; - /** Creates a new AllumeLED. */ - public AllumeLED(LED led,Accumulateur accumulateur){ - this.accumulateur = accumulateur; - this.led = led; - addRequirements(led); - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() {} - - // Called every time the scheduler runs while the command is scheduled. - @Override - public void execute() { - if(accumulateur.limitswitch()){ - led.couleur(0, 255, 0); - } - else{ - led.couleur(255, 0, 0); - } - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - led.couleur(255, 0, 0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/command/Pistongrimpeur.java b/src/main/java/frc/robot/command/Pistongrimpeur.java deleted file mode 100644 index 93f2da2..0000000 --- a/src/main/java/frc/robot/command/Pistongrimpeur.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package frc.robot.command; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystem.Grimpeur; -import frc.robot.subsystem.LED; - -public class Pistongrimpeur extends Command { - private LED LED; - private Grimpeur grimpeur; - /** Creates a new Pistongrimpeur. */ - public Pistongrimpeur(Grimpeur grimpeur,LED LED) { - this.grimpeur = grimpeur; - this.LED = LED; - addRequirements(grimpeur,LED); - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - grimpeur.pistonouvre(); - } - - // Called every time the scheduler runs while the command is scheduled. - @Override - public void execute() { - - if(grimpeur.piston()){ - LED.couleur(0, 0, 255); - } - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - LED.couleur(0, 0, 0); - - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/subsystem/LED.java b/src/main/java/frc/robot/subsystem/LED.java deleted file mode 100644 index d3e9e76..0000000 --- a/src/main/java/frc/robot/subsystem/LED.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package frc.robot.subsystem; - -import edu.wpi.first.wpilibj.AddressableLED; -import edu.wpi.first.wpilibj.AddressableLEDBuffer; -import edu.wpi.first.wpilibj.Relay; -import edu.wpi.first.wpilibj2.command.SubsystemBase; - -public class LED extends SubsystemBase { - /** Creates a new LED. */ - public LED() {} - - AddressableLED led = new AddressableLED(9); - AddressableLEDBuffer ledBuffer = new AddressableLEDBuffer(150); - - public void led(){ - led.setData(ledBuffer); - led.start();} - - public void couleur(int R, int G,int B){ - for (int i = 0; i < ledBuffer.getLength(); i++) { - // Sets the specified LED to the RGB values for red - ledBuffer.setRGB(i, 255, 0, 0);} - } - @Override - public void periodic() { - // This method will be called once per scheduler run - } -}