Limelight

This commit is contained in:
Olivier Dubois 2024-02-07 19:50:38 -05:00
parent fb12e88940
commit 039f8f5392
2 changed files with 16 additions and 7 deletions

View File

@ -9,14 +9,17 @@ package frc.robot.command;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystem.Lanceur; import frc.robot.subsystem.Lanceur;
import frc.robot.subsystem.Limelight;
public class Lancer extends Command { public class Lancer extends Command {
/** Creates a new Lanceur. */ /** Creates a new Lanceur. */
private Limelight limelight;
private Lanceur lanceur; private Lanceur lanceur;
public Lancer(Lanceur lanceur) { public Lancer(Lanceur lanceur,Limelight limelight) {
this.limelight = limelight;
this.lanceur = lanceur; this.lanceur = lanceur;
// Use addRequirements() here to declare subsystem dependencies. // Use addRequirements() here to declare subsystem dependencies.
addRequirements(lanceur); addRequirements(lanceur,limelight);
} }
// Called when the command is initially scheduled. // 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. // Called every time the scheduler runs while the command is scheduled.
@Override @Override
public void execute() { public void execute() {
if(limelight.getv()){
lanceur.lancerspeaker(); lanceur.lancerspeaker();
}
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.

View File

@ -9,15 +9,16 @@ package frc.robot.command;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystem.Lanceur; import frc.robot.subsystem.Lanceur;
import frc.robot.subsystem.Limelight;
public class Lancerampli extends Command { public class Lancerampli extends Command {
/** Creates a new Lanceur. */ /** Creates a new Lanceur. */
private Lanceur lanceur; private Lanceur lanceur;
private Limelight limelight;
public Lancerampli(Lanceur lanceur) { public Lancerampli(Lanceur lanceur,Limelight limelight) {
// Use addRequirements() here to declare subsystem dependencies. // Use addRequirements() here to declare subsystem dependencies.
addRequirements(lanceur); addRequirements(lanceur, limelight);
this.limelight = limelight;
this.lanceur = lanceur; this.lanceur = lanceur;
} }
@ -28,7 +29,10 @@ public class Lancerampli extends Command {
// Called every time the scheduler runs while the command is scheduled. // Called every time the scheduler runs while the command is scheduled.
@Override @Override
public void execute() { public void execute() {
lanceur.lanceramp(); if(limelight.getv()){
lanceur.lanceramp();
}
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.