diff --git a/src/main/java/frc/robot/command/Lancer.java b/src/main/java/frc/robot/command/Lancer.java index de4314e..01eb49c 100644 --- a/src/main/java/frc/robot/command/Lancer.java +++ b/src/main/java/frc/robot/command/Lancer.java @@ -9,14 +9,17 @@ package frc.robot.command; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystem.Lanceur; +import frc.robot.subsystem.Limelight; public class Lancer extends Command { /** Creates a new Lanceur. */ + private Limelight limelight; private Lanceur lanceur; - public Lancer(Lanceur lanceur) { + public Lancer(Lanceur lanceur,Limelight limelight) { + this.limelight = limelight; this.lanceur = lanceur; // Use addRequirements() here to declare subsystem dependencies. - addRequirements(lanceur); + addRequirements(lanceur,limelight); } // Called when the command is initially scheduled. @@ -26,7 +29,9 @@ public class Lancer extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { + if(limelight.getv()){ lanceur.lancerspeaker(); + } } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc/robot/command/Lancerampli.java b/src/main/java/frc/robot/command/Lancerampli.java index 450c87a..4a9b3c8 100644 --- a/src/main/java/frc/robot/command/Lancerampli.java +++ b/src/main/java/frc/robot/command/Lancerampli.java @@ -9,15 +9,16 @@ package frc.robot.command; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystem.Lanceur; +import frc.robot.subsystem.Limelight; public class Lancerampli extends Command { /** Creates a new Lanceur. */ - private Lanceur lanceur; - - public Lancerampli(Lanceur lanceur) { + private Limelight limelight; + public Lancerampli(Lanceur lanceur,Limelight limelight) { // Use addRequirements() here to declare subsystem dependencies. - addRequirements(lanceur); + addRequirements(lanceur, limelight); + this.limelight = limelight; this.lanceur = lanceur; } @@ -28,7 +29,10 @@ public class Lancerampli extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - lanceur.lanceramp(); + if(limelight.getv()){ + lanceur.lanceramp(); + } + } // Called once the command ends or is interrupted.